3 ms·
I've been using SQLAlchemy for some time now. I found two things that are just great: 1. sqlacodegen (https://github.com/ksindi/sqlacodegen https://github.com/
by aabajian 11y ago
I've been using SQLAlchemy for some time now. I found two things that are just great:
1. sqlacodegen (https://github.com/ksindi/sqlacodegen https://github.com/ksindi/sqlacodegen) - Creates a single Python file with the SQLAlchemy model from your existing database.
2. Bulk inserts:
new_people = []
for person in list_of_new_people:
new_people.append({'name' : person.name, 'age' : person.age })
People.__table__.insert().values(new_people)
I've prototyped databases in under 30 minutes using the combination of:
1. MySQL Workbench for design and database creation
2. sqlacodgen to create SQLAlchemy Python model
3. SQLAlchemy's bulk insert to populate the database