I haven't had to write a Python app that uses a database in a very long time.
-
I haven't had to write a Python app that uses a database in a very long time. I thought things were different now. Better, I would hope. But, seriously? Do I still need to write my own SQL statements? What year is that?

PS: if someone can suggest a Python library that I can use to manipulate SQLite without writing SQL, I would appreciate it.
@badnetmask You can if you want to, but you could also use SQLAlchemy if you don't. What is your objection to writing SQL statements?
-
I haven't had to write a Python app that uses a database in a very long time. I thought things were different now. Better, I would hope. But, seriously? Do I still need to write my own SQL statements? What year is that?

PS: if someone can suggest a Python library that I can use to manipulate SQLite without writing SQL, I would appreciate it.
SQLAlchemy can do exactly what you describe; use it at the ORM level, and you need never write any SQL at all.
It also makes your code (more) portable to other RDBMSes.
-
@badnetmask You can if you want to, but you could also use SQLAlchemy if you don't. What is your objection to writing SQL statements?
-
I haven't had to write a Python app that uses a database in a very long time. I thought things were different now. Better, I would hope. But, seriously? Do I still need to write my own SQL statements? What year is that?

PS: if someone can suggest a Python library that I can use to manipulate SQLite without writing SQL, I would appreciate it.
@badnetmask Another recommendation for SQLAlchemy.
-
I haven't had to write a Python app that uses a database in a very long time. I thought things were different now. Better, I would hope. But, seriously? Do I still need to write my own SQL statements? What year is that?

PS: if someone can suggest a Python library that I can use to manipulate SQLite without writing SQL, I would appreciate it.
@badnetmask is this the thing you feel should exist in current year? I can't endorse it specifically but I think the magic words are sqlalchemy and pydantic and that's what this is.
SQLModel
SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.
(sqlmodel.tiangolo.com)
-
@badnetmask is this the thing you feel should exist in current year? I can't endorse it specifically but I think the magic words are sqlalchemy and pydantic and that's what this is.
SQLModel
SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.
(sqlmodel.tiangolo.com)
@octarine_wiggle
I'll take a look at that. Thanks. -
@badnetmask @cazabon Any abstraction is necessarily incomplete. The documentation for your database is always going to be in SQL, and you should probably care about the specifics of your database.
My own attempt to square this circle is https://dbxs.readthedocs.io/en/latest/ β with it, you write SQL manually, but it's in a structured and organized way; rather than try to hide the seam between the Python and the database, it carefully arranges that seam so it is all in one place and easy to inspect.
-
@badnetmask @cazabon Any abstraction is necessarily incomplete. The documentation for your database is always going to be in SQL, and you should probably care about the specifics of your database.
My own attempt to square this circle is https://dbxs.readthedocs.io/en/latest/ β with it, you write SQL manually, but it's in a structured and organized way; rather than try to hide the seam between the Python and the database, it carefully arranges that seam so it is all in one place and easy to inspect.
@badnetmask @cazabon If you give it a try let me know, it hasn't seen a lot of production use yet, but it ought to be very simple

-
I haven't had to write a Python app that uses a database in a very long time. I thought things were different now. Better, I would hope. But, seriously? Do I still need to write my own SQL statements? What year is that?

PS: if someone can suggest a Python library that I can use to manipulate SQLite without writing SQL, I would appreciate it.
@badnetmask is there a language that has an ORM in their std lib?
-
@badnetmask @cazabon If you give it a try let me know, it hasn't seen a lot of production use yet, but it ought to be very simple

-
I haven't had to write a Python app that uses a database in a very long time. I thought things were different now. Better, I would hope. But, seriously? Do I still need to write my own SQL statements? What year is that?

PS: if someone can suggest a Python library that I can use to manipulate SQLite without writing SQL, I would appreciate it.
-
R relay@relay.an.exchange shared this topic
