Skip to content

Instantly share code, notes, and snippets.

@marcofalcioni
Created March 12, 2012 16:56
Show Gist options
  • Save marcofalcioni/2023319 to your computer and use it in GitHub Desktop.
Save marcofalcioni/2023319 to your computer and use it in GitHub Desktop.
Inserting and retrieving a numeric value with SQLite
from sqlalchemy import *
engine = create_engine('sqlite:///:memory:')
metadata = MetaData()
table = Table('has_decimal', metadata,
Column('id', Integer, primary_key=True),
Column('numeric', Numeric(10,3)))
metadata.bind = engine
table.create()
engine.execute(table.insert({"numeric":"10"}))
for row in engine.execute(table.select()):
print str(row[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment