Created
September 26, 2020 17:38
-
-
Save mdipierro/ffd127c83cf081daff73c7546d39bbe5 to your computer and use it in GitHub Desktop.
pydal reference examples
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 pydal import DAL, Field | |
db=DAL() | |
db.define_table('person', Field('name')) | |
id = db.person.insert(name="Max") | |
print("%(name)s" % id) | |
db.define_table('dog', Field('name'), Field('owner', db.person)) | |
db.dog.insert(name="Snoopy", owner=id) | |
dog = db(db.dog).select().first() | |
print("%(name)s" % dog.owner) | |
print(dog.owner.name) |
Author
mdipierro
commented
Sep 26, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment