Skip to content
Myr

moved Table import to next code block

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christopher Su · committed by Christopher Su · parent 8089eb5 · Browse files · 1 file+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:docs/patterns/sqlalchemy.rst+3 added-1 removed
175 unmodified lines
176177If you just want to use the database system (and SQL) abstraction layer178you basically only need the engine::179180 from sqlalchemy import create_engine, MetaData, Table180 from sqlalchemy import create_engine, MetaData181182 engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True)183 metadata = MetaData(bind=engine)184185Then you can either declare the tables in your code like in the examples186above, or automatically load them::187188 from sqlalchemy import Table189 190 users = Table('users', metadata, autoload=True)191192To insert data you can use the `insert` method. We have to get a193connection first so that we can use a transaction:
25 unmodified lines