Flask-SQLAlchemy 3.1.0 released, with support for SQLAlchemy 2's new annotation-based model definition. Thanks to @pamelafox for becoming a maintainer and enabling that support!
https://github.com/pallets-eco/flask-sqlalchemy/releases/tag/3.1.0
https://pypi.org/project/Flask-SQLAlchemy/3.1.0/
#Python #Flask #SQLAlchemy
#Pythonβs #SQLAlchemy: 3 powerful features you need to know
https://itnext.io/pythons-sqlalchemy-3-powerful-features-you-need-to-know-433a8af565ec
#python #sqlalchemy #orm #database
Question involving #python #sqlalchemy #factoryboy #postgresql #pytest
Currently, we run end-to-end API tests against a sqlite DB, which takes about 2 seconds. I want to switch to postgres (what we use in prod) but that makes the tests take a lot longer, about 12 seconds.
Is there a way to improve this?
What might be causing the slowness? Where can I look? Is it networking to the docker container? Postgres enforcing constraints? Running flush after every DB fixture? Something else?
#python #sqlalchemy #factoryboy #postgresql #pytest
I really enjoyed this week's awesome #vscode livestream with Pamela Fox, showing connecting to #postgresql database by various ways in VSCode, and #python.
Covers #sqltools, #sqlalchemy, running in a dev container with docker compose and connecting to local and azure DBs, environment management... so many things crammed in an hour!
Also shows of GitHub Copilot a lot, but you don't need it to follow along (I'm going to try it using GitLab Duo).
#vscode #postgresql #python #sqltools #sqlalchemy
Python: Just Write SQL
https://joaodlf.com/python-just-write-sql
#ycombinator #python #sql #postgresql #orm #raw_sql #sqlalchemy #django_orm
#ycombinator #python #sql #postgresql #orm #raw_sql #sqlalchemy #django_orm
Designing a replacement for an internal #networking tool this week, and am picking up #SQLAlchemy for the first time. Using the ORM is forcing me to take an object-oriented approach to this project, despite my brain's protesting. π
π£ New ETL pipeline course module out! Grasp the difference between .pyscript & Jupyter notebooks and master Python script drafting best practices.
Dive into function definitions, modularization, code documentation, and Python script packaging. We also introduce Pandas and DuckDB Python API for efficient data handling. Discover more at
#Python #DataScience #SQLAlchemy #Pandas #Automation #Modularization.
#python #datascience #sqlalchemy #pandas #automation #modularization
κΈ°μ‘΄μ νλ νλ‘μ νΈ #sqlalchemy v2λ‘ μ ν.
```py
id: Mapped[master_id]
slug: Mapped[slug]
name: Mapped[str | None]
```
μ΄λ°μμΌλ‘ ORM λͺ¨λΈ ν΄λμ€λ₯Ό κ΅¬μ± ν μ μμ΄μ μ½λκ° νκ²° κΉλν΄μ‘λ€. 쿼리μͺ½μ v1 νμλ κ·Έλλ‘ μΈ μ μκ³ , μ λ§λ€ λμ΄μ 미리 ꡬμ±ν΄ λ μλ μμ΄μ 골λΌλ¨ΉκΈ° μ’λλΌ.
μ΄λμ κ°λ pydantic ν΄λμ€λ§μΌλ‘ λμνλ ORMμ μ§νμ€μ΄λλ° μλλ©΄ μ’κ² λ€.
I have to say #sqlalchemy docs are painful. Very very difficult to find the right information. In contrast #sqlmodel docs are a pleasure to read! slqmodel is a thin layer to combine sqlalchemy and pydantic. Thus you need to lookup the touch stuff in the sqlalchemy docs.
In memory #sqlite is also a good option. I like sqlite because there are great tools like #SQLAlchemy which allows you to have #ORM features, but if it is simple I would just go with the built-in libraries to improve performance.
I also like sqlite with #Docker, as I have the simplicity of a sqlite database, but I can easily share it with containers with mounts and persist the data during development and production.
#VScode also has greay extensions for viewing sqlite databases, making it a glorified csv with advanced query capabilities.
#sqlite #sqlalchemy #orm #docker #vscode
I am quite lazy with them and whoch they were more automatically detected, especially for diciotnaries. During development, my dictionaries often change, and I get lazy. Once my code base grows, it is very frustrating to have to go back!
But I have to say, with something liek #SQLAlchemy. Their type hints really make development easier!
Looking for suggestions, SQLAlchemy says:
Evaluating non-mapped column expression 'run_updates.run_id' onto ORM instances; this is a deprecated use case. Please make use of the actual mapped columns in ORM-evaluated UPDATE / DELETE expressions.
Gathering counts out of band and wanting to update counts of multiple rows at once.
x = Values(...).data(...)
then
update(Table).where(Table.field == x.c.field).values(field2 = Table.field2 + x.c.field2)
ideas?
When you find that stack overflow question and answer that tells you exactly what you need.
https://gifdb.com/images/high/chef-s-kiss-emoji-ac11f2imaqahmhf2.gif
https://stackoverflow.com/questions/18858291/values-clause-in-sqlalchemy
I haven't used async and wait with #Python yet. So this will also be a fun way to get into it with #SQLAlchemy. What I like about it is that I could also easily move away from #SQLite if I need to, and #PostgreSQL has great #Docker support, so I would need to change much.
#python #sqlalchemy #sqlite #PostgreSQL #docker
I prefer to use something more popular, that the support is better. The docs of #SQLAlchemy are a bit odd. I found myself getting stuck after the tutorial, like you said. It seems 2.0 documentation isn't the best with the new declarative style, but I found some other resources, and I am diving into code I found on #Github to see how others did it.
#Peewee is cool, but the names like that always turn me off. I need serious names for libraries I use, I don't know. But I can see that it had great influence from modern #JS #ORM styles, so it might be better for people coming from that.
Thanks for the info!
#sqlalchemy #github #peewee #js #orm #python
I am aware of the limitations, but I am far below them. I want to project to be easily deployable by others and then the usage will also be low enough for it to suffice.
#Peewee feels a lot like the web-development #ORM that you get for #React and #JS, but I like #SQLAlchemy, the docs also seem good.
#peewee #orm #react #js #sqlalchemy
What is your favorite #Python #ORM for #SQL and #SQLite? I am currently looking for an ORM judt to sinplify my implementation.
I am considering going for SQLite because the writes and reads are low, and the total size will also be a few 100 records, but I want the strengths of SQL. Also, I am running it in #Docker, so it simplifies the deployment.
I am looking at #SQLAlchemy and also saw #Peewee on #Github.
This is the first time I am doing something like this. Normally, my data is simply printed to CSV files.
#python #orm #sql #sqlite #docker #sqlalchemy #peewee #github
@justindz @RethinkJeff Most people use #SQLAlchemy as #Python #ORM but it can be hard to grasp sometimes. There are many ways to do the same thing and the documentation is a mess. Still, I don't know other alternatives with as good support for async and typing. Plus, it's popularity means lots of tutorials.
If you still want to try alternatives, I listed some of them here:
https://t.me/itgram_channel/581
The birth of #DjudgePortal for #LatherGames and #AustereAugust
Developed at https://gitlab.com/djudges/djudgeportal under the #OpenSource #APGL license using #Python, #Flask, #SQLAlchemy.
Contributions are not only welcome, but necessary.
If you ever wanted to join a dev project to help the #wetshaving community, this is your chance. Newbies welcome, all you need is the will to read tutorials.
#djudgeportal #lathergames #austereaugust #opensource #apgl #python #flask #sqlalchemy #wetshaving