Skip to content

Instantly share code, notes, and snippets.

Created December 28, 2014 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9dabf0db48bb689c9390 to your computer and use it in GitHub Desktop.
Save anonymous/9dabf0db48bb689c9390 to your computer and use it in GitHub Desktop.
from pony.orm import *
db = Database('sqlite', 'data.sqlite', create_db=True)
class Base(db.Entity):
pass
class A(Base):
a = Required(int)
class B(Base):
b = Required(int)
db.generate_mapping(create_tables=True)
with db_session:
A(a=1)
B(b=1)
with db_session:
select(x for x in Base if x.a == 1 or x.b == 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment