eupolicy.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
This Mastodon server is a friendly and respectful discussion space for people working in areas related to EU policy. When you request to create an account, please tell us something about you.

Server stats:

223
active users

#sqlalchemy

0 posts0 participants0 posts today

⚙️Are you looking for an #online #database #modeling #tool with #SQL generation?

With the latest updates (e.g. modeling of #association #classes), BESSER is your ideal tool to #design and #generate your databases in many different "flavours" :

☑️ #SQLLite

☑️ #PostgresQL

☑️ #MySQL

☑️ #MariaDB

☑️ #MSSQLServer

☑️ and even #SQLAlchemy

Ready to give it a try? No installation required! ➡️ editor.besser-pearl.org/

Did I already mention is completely 🆓 and #opensource?

editor.besser-pearl.orgBESSER Web Modeling Editor

I have a #Python codebase using #sqlalchemy Core -- *NOT* ORM -- for its data layer, and I'm currently not happy with the way it's doing data for testing. Who has a pattern for this that they actually like?

I already have ephemeral per-test-function isolation of the database, so that's taken care of.

If this were ORM I'd just use something like factory-boy, but the fact that it's Core and doesn't really map neatly to objects the way ORM stuff does rules that out. I think ideally what I'd like is some sort of declarative JSON file format or whatever that lets me provide a mapping of table names to lists of rows to insert into them, and then a pytest fixture that lets me say "load that JSON file for this test". Has anyone written something like that? Do I get to go write my own?

Continued thread

As an example, I have started using #SQLAlchemy recently in my daily work. Starting out with a new software library can take a long time reading documentation to get started using it properly.
ChatGPT has been very helpful here. I might ask it something like: "I need to represent these two different kinds of objects that have these properties, and I need to be able to track many-to-many relationships between them through foreign keys. How can I achieve this using SQLAlchemy and ORM models?"

Replied in thread

@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.

Continued thread

At first I just wanted to play with some parts of the code like the ranking function. However it didn't take long before I decided that I wanted to build something more and, why not, play with some things I normally don't get to play with in #python like #async stuff and the #SQLAlchemy #ORM

Thus, winzig was born:
github.com/dnlzrgz/winzig

GitHubGitHub - dnlzrgz/winzig: A tiny search engine for personal use.A tiny search engine for personal use. Contribute to dnlzrgz/winzig development by creating an account on GitHub.