Created
June 3, 2014 22:19
-
-
Save Stiivi/4fc4d05ab376f82dca88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine, MetaData, Table, Integer, Date, Column | |
import sqlalchemy.sql as sql | |
engine = create_engine("sqlite://") | |
md = MetaData(bind=engine) | |
table = Table("data", md) | |
table.append_column(Column("id", Integer)) | |
table.append_column(Column("adate", Date)) | |
table.append_column(Column("value", Integer)) | |
data = [ | |
{"id": 1, "value": "foo", "adate": sql.func.now()}, | |
{"id": 2, "value": "bar", "adate": sql.func.now()} | |
] | |
print str(table.insert().values(data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment