Just added SQLAlchemy from @zzzeek to our list! From raw SQL nightmares to elegant Python ORM - you've transformed how an entire generation of developers works with databases.
Thank you for this masterpiece of engineering!
Just added SQLAlchemy from @zzzeek to our list! From raw SQL nightmares to elegant Python ORM - you've transformed how an entire generation of developers works with databases.
Thank you for this masterpiece of engineering!
I love this magick:
```
In [1]: import model
In [2]: model.Tooter
Out[2]: model.Tooter
In [3]: model.Tooter.account
Out[3]: <sqlalchemy.orm.attributes.InstrumentedAttribute at 0x7fbf7bd31bc0>
In [4]: model.Tooter.account == 'foo'
Out[4]: <sqlalchemy.sql.elements.BinaryExpression object at 0x7fbf8183a960>
```
Holy s*it, I just tried #tortoise-orm for #Python and my mind is blown away. After using #SQLAlchemy for a long time this is like night and day!
Well this is messing with me:
SQLAlchemy column definition:
start_time = Column(DateTime, nullable=False, comment="Activity start date (DateTime)")
SQLAlchemy query:
activity_db = (db.query(activities_models.Activity).filter(activities_models.Activity.id == activity_id).first())
print(type(activity_db.start_time))
print(activity_db.start_time)
First print returns: <class 'str'>
Second print returns: 2024-11-25T16:49:52+0100
Boost welcomed
Why?! #Python #help #MySQL #SQLAlchemy #boost
As a DBA, I always want developers to use database transactions and appropriate levels of locking. Because I'm tired of seeing explicit locking of tables or autocommit enabled.
BUT, after two days of trying to patch a simple CRUD app to apply my own rules, failing miserably, I just want to remove all this ORM crap and use raw SQL.
That's it.
Tomorrow, I will rewrite this monstrosity.
@veronica #sqlalchemy has been nothing but trouble in our team. Lazy loading makes you have more transactions that last longer and also leads to the n+1 query problem. And I hate the query constructor to me it’s harder to understand than plain old SQL. We’re stripping it off to get back down to the #psycopg2 layer.
@veronica Give a try to #peewee - much more simple than #SQLAlchemy !
a little bit confusing with #sqlalchemy, the database is there and contain tables with fine column but I can't insert data to the table because the table is not found.
weird.
trying #alembic (with #sqlalchemy) to migrate some sql schema, everything running with smooth except when I change constraint (unique=True).
alembic can't process this migrate because SQLite have limitation on modifying constraint schema using ALTER TABLE.
I have trying to use BATCH MODE but did not meet my expectations.
I am feeling extremely pleased with myself to have had some code accepted into #SQLAlchemy!
It's just a few lines to let unique constraint detection on #SQLite handle tabs, but I've been using SQLAlchemy for years, and it's in lots other #python libraries like #pandas. It's exciting that now some of the code is mine!
For non-programmers, I think this is how it must have felt to have played 2nd triangle in the orchestra doing the backing on the Beatles' Eleanor Rigby.
Just released Flask-Alembic 3.1.0, which integrates Flask with Alembic database migrations. It now supports Flask-SQLAlchemy-Lite or plain SQLAlchemy in addition to Flask-SQLAlchemy; multiple databases; and postprocessing generated files with tools like black, ruff, pre-commit, or even `git add`. It also has other cool features, check it out: https://flask-alembic.readthedocs.io #Python #Flask #SQLAlchemy
@textovervideo or use a library like #sqlalchemy that has connectors to about every db system out there, and abstracts over the differences.
Announcing Flask-SQLAlchemy-Lite, a new lightweight replacement for Flask-SQLAlchemy that provides engine configuration and session lifetime, but none of the other custom stuff in the prior extension. It works with Flask and Quart, sync and async. I figured out the core idea on the flight to PyCon US, teased it during FlaskCon, and now it's available! Check out the docs to get started! https://flask-sqlalchemy-lite.readthedocs.io #Python #Flask #SQLAlchemy
NEWS ALERT: new version of BESSER, now with a full #backend #code #generator
Go from a simple #classdiagram to a fully functional backend: #database + #RESTAPI + data validators, relying on #FastAPI, #pydantic and #sqlalchemy Try it out!
https://modeling-languages.com/generating-software-backend-lowcode/
Looking forward to SQLAlchemy 2.1 so I can do `ForeignKey(lambda: Other.id)` instead of `ForeignKey("other.id")`, and `relationship(back_populates=lambda: Other.things)`. Last little bit needed to for (non-string) forward references that don't cause circular imports. #Python #SQLAlchemy
Sooo… I wanted to give #superset a try to dig into some #OpenSearch data. But the #SQLAlchemy dependency it use to connect to data sources only has partial support for OpenSearch ATM, and while testing I had a lot of weird issues. Currently the connector stick to an old version of elasticsearch-py, so I started to add support for OpenSearch to it using opensearch-py hoping it would help.
In the end, I unfortunately seem to be at the same place with most queries not working as expected . (1/4)
Mise à jour de mon tutoriel #FastAPI #python pour débutants (comme quoi tout arrive !).
Passage de Tortoise ORM à #SQLAlchemy 2 et quelques autres nouveautés mineures (explication de l'utilisation d'un Enum dans la partie 4 par exemple).
La suite bientôt ? Qui sait !
Just released Flask-Alembic 3.0! This extension combines Flask and Flask-SQLAlchemy with the Alembic migration library, providing CLI and programatic access to Alembic's functionality. It went 7.5 years without needing a release. This fixes compatibility with Flask-SQLAlchemy 3.1, and generally modernizes the project, tooling, and minimum requirements. https://github.com/davidism/flask-alembic/releases/tag/3.0.0 #Python #Flask #SQLAlchemy
I've got a sneak peak of my latest open source project: Paracelsus.
Long story short, I got sick of manually making database diagrams for SQLAlchemy. The data is all there, so why not generate the diagrams directly?
Paracelsus (named after the alchemist who wrote about mermaids) will read your database models and create diagrams in either Mermaid or Dot format. It can also be used to inject diagrams in markdown files as code blocks.