4 ms·
I use Django ORM and SQLAlchemy on a daily basis. The Django ORM is somewhat limited, but it is OK for what it is used for. SQLAlchemy is a joy to use, it maps
by scardine 10y ago
I use Django ORM and SQLAlchemy on a daily basis. The Django ORM is somewhat limited, but it is OK for what it is used for. SQLAlchemy is a joy to use, it maps SQL 1:1 but is way more secure and easier to use than string-based composition of SQL statements. Pony ORM is other Python alternative worth a look.
This bold statement is clearly wrong, at least for Python.
- chucksmash 10y ago+1 on SQLAlchemy. I find myself using the SQL expression API all the time these days for ad hoc queries where in the past I would have fired up psql. from sqlalchemy import create_engine, func, select query = select([ my_table.c.column1, my_table.c.column2 ]).select_from( my_table ).where( my_table.c.column3 == datetime.date(2016, 5, 10) ).where( func.coalesce(func.array_length(my_table.c.my_stupid_column4_is_an_array, 1), 0) > 0 ) The above: a) isn't too much more boilerplate-y than the actual SQL statement itself but is composable so later on in my IPython session I can easily do other_query = query.order_by(-my_table.c.column1).limit(10) b) can always just be written in straight SQL if I don't remember the specific SQLAlchemy invocation or can even be written as a mish-mash of SQLAlchemy expression language and textual SQL.