SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Python ORMs
Cosmin Poieana
<cmin@ropython.org>
→ baze de date
→ tipuri de ORM (modele)
→ comparații (exemple)
→ peewee
→ resurse
Database APIs
NoSQL
● redis
● mongodb
● …
SQL
● pyodbc
● sqlite3
● pymysql
● ...
sqlite3
● Nu are nevoie de driver, server
● Static pe disc / memorie
● Interogări simple (+ mici diferențe)
1. conexiune
2. obținere cursor
3. execuție interogare
*. commit
4. închidere
sqlite3
>>> import sqlite3
>>> conn = sqlite3.connect("ropy.db")
>>> c = conn.cursor()
>>> c.execute("CREATE TABLE persoana (nume text,
adresa text, varsta real)")
>>> c.execute("INSERT INTO persoana VALUES
('Nume1', 'Adresa1', 20)")
>>> conn.commit()
>>> c.execute("SELECT * FROM persoana")
>>> c.fetchall()
[(u'Nume1', u'Adresa1', 20.0)]
ORM
● Object-relational mapping
(convertire date dintr-un sistem incompatibil in
POO)
● Pony, Django ORM, peewee, SQLAlchemy
● Modele
– DataMapper
– ActiveRecord
● SQLite, MySQL, PostgreSQL[, Oracle]
Django ORM
$ django-admin.py startproject ropy
$ cd ropy
$ python manage.py syncdb
>>> from django.db import models
>>> class Person(models.Model):
... name = models.TextField()
... class Meta:
... app_label = 'demo'
>>> class Address(models.Model):
... address = models.TextField()
... person = models.ForeignKey(Person)
... class Meta:
... app_label = 'demo'
Django ORM
>>> p = Person(name='person')
>>> p.save()
>>> print "%r, %r" % (p.id, p.name)
1, 'person'
>>> a = Address(person=p, address='address')
>>> a.save()
>>> print "%r, %r" % (a.id, a.address)
1, 'address'
Django ORM
>>> persons = Person.objects.filter(name='person')
>>> p = persons[0]
>>> print "%r, %r" % (p.id, p.name)
1, u'person'
>>> addresses = Address.objects.filter(person=p)
>>> addresses
[<address>]
>>> a = addresses[0]
>>> print "%r, %r" % (a.id, a.address)
1, u'address'
Peewee
>>> from peewee import SqliteDatabase, CharField,
ForeignKeyField, Model
>>> db = SqliteDatabase(':memory:')
>>> class Person(Model):
... name = CharField()
... class Meta:
... database = db
>>> class Address(Model):
... address = CharField()
... person = ForeignKeyField(Person)
... class Meta:
... database = db
>>> Person.create_table()
>>> Address.create_table()
Peewee
>>> p = Person(name='person')
>>> p.save()
>>> a = Address(address='address',
person=p)
>>> a.save()
Peewee
>>> person = Person.select().where(Person.name ==
'person').get()
>>> print '%r, %r' % (person.id, person.name)
1, u'person'
>>> address = Address.select().where(Address.person ==
person).get()
>>> print '%r, %r' % (address.id, address.address)
1, u'address'
Resurse
● http://www.pythoncentral.io/sqlalchemy-vs-orms/
● http://peewee.readthedocs.org/en/latest/
● http://effectivedjango.com/orm.html
● http://www.sqlalchemy.org/
● http://ponyorm.com/

Weitere ähnliche Inhalte

Was ist angesagt?

MongoDB a document store that won't let you down.
MongoDB a document store that won't let you down.MongoDB a document store that won't let you down.
MongoDB a document store that won't let you down.Nurul Ferdous
 
The Art of Command Line (2021)
The Art of Command Line (2021)The Art of Command Line (2021)
The Art of Command Line (2021)Kenta Yamamoto
 
Neoito — *NIX kungfu for web devs
Neoito — *NIX kungfu for web devsNeoito — *NIX kungfu for web devs
Neoito — *NIX kungfu for web devsNeoito
 
The Lesser Known Features of ECMAScript 6
The Lesser Known Features of ECMAScript 6The Lesser Known Features of ECMAScript 6
The Lesser Known Features of ECMAScript 6Bryan Hughes
 
Mongo db pagination
Mongo db paginationMongo db pagination
Mongo db paginationzarigatongy
 
仮想化環境におけるバイナリー・ポータビリティの考察 (WebAssemblyの場合)
仮想化環境におけるバイナリー・ポータビリティの考察 (WebAssemblyの場合)仮想化環境におけるバイナリー・ポータビリティの考察 (WebAssemblyの場合)
仮想化環境におけるバイナリー・ポータビリティの考察 (WebAssemblyの場合)Naoto MATSUMOTO
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialGagah Arifianto
 
Node lt
Node ltNode lt
Node ltsnodar
 
FrozenRails Training
FrozenRails TrainingFrozenRails Training
FrozenRails TrainingMike Dirolf
 
node.js workshop- node.js basics
node.js workshop- node.js basicsnode.js workshop- node.js basics
node.js workshop- node.js basicsQiong Wu
 
Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Yuriko IKEDA
 
Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust languageGines Espada
 
자바스터디 4
자바스터디 4자바스터디 4
자바스터디 4jangpd007
 

Was ist angesagt? (20)

GroovyConsole
GroovyConsoleGroovyConsole
GroovyConsole
 
MongoDB a document store that won't let you down.
MongoDB a document store that won't let you down.MongoDB a document store that won't let you down.
MongoDB a document store that won't let you down.
 
The Art of Command Line (2021)
The Art of Command Line (2021)The Art of Command Line (2021)
The Art of Command Line (2021)
 
Neoito — *NIX kungfu for web devs
Neoito — *NIX kungfu for web devsNeoito — *NIX kungfu for web devs
Neoito — *NIX kungfu for web devs
 
The Lesser Known Features of ECMAScript 6
The Lesser Known Features of ECMAScript 6The Lesser Known Features of ECMAScript 6
The Lesser Known Features of ECMAScript 6
 
Clojure入門
Clojure入門Clojure入門
Clojure入門
 
Gitkata refspec
Gitkata refspecGitkata refspec
Gitkata refspec
 
Mongo db pagination
Mongo db paginationMongo db pagination
Mongo db pagination
 
Clojure functions
Clojure functionsClojure functions
Clojure functions
 
仮想化環境におけるバイナリー・ポータビリティの考察 (WebAssemblyの場合)
仮想化環境におけるバイナリー・ポータビリティの考察 (WebAssemblyの場合)仮想化環境におけるバイナリー・ポータビリティの考察 (WebAssemblyの場合)
仮想化環境におけるバイナリー・ポータビリティの考察 (WebAssemblyの場合)
 
NUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline TutorialNUMOSS 4th Week - Commandline Tutorial
NUMOSS 4th Week - Commandline Tutorial
 
Node lt
Node ltNode lt
Node lt
 
FrozenRails Training
FrozenRails TrainingFrozenRails Training
FrozenRails Training
 
node.js workshop- node.js basics
node.js workshop- node.js basicsnode.js workshop- node.js basics
node.js workshop- node.js basics
 
Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境
 
Message Decrypt
Message DecryptMessage Decrypt
Message Decrypt
 
Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust language
 
Linux Command Line
Linux Command LineLinux Command Line
Linux Command Line
 
자바스터디 4
자바스터디 4자바스터디 4
자바스터디 4
 
01 linux basics
01 linux basics01 linux basics
01 linux basics
 

Andere mochten auch

Almost 2009
Almost 2009Almost 2009
Almost 2009paobazzi
 
How A Web Page Is Seen
How A Web Page Is SeenHow A Web Page Is Seen
How A Web Page Is Seenbwebster719
 
Ms.Nl.9031 Smoelenboek Wpc Final2
Ms.Nl.9031 Smoelenboek Wpc Final2Ms.Nl.9031 Smoelenboek Wpc Final2
Ms.Nl.9031 Smoelenboek Wpc Final2Renataadelino
 
21st Century Skills Pp
21st Century Skills Pp21st Century Skills Pp
21st Century Skills Ppheyjohnreese
 
Fundraising Day - New York: Taking Leadership Online
Fundraising Day - New York: Taking Leadership OnlineFundraising Day - New York: Taking Leadership Online
Fundraising Day - New York: Taking Leadership OnlineSeaChangeStrategies
 
Crew documents 020334 - 020392
Crew documents 020334 - 020392Crew documents 020334 - 020392
Crew documents 020334 - 020392Obama White House
 
Dump The Tubes The Economic Case For Led Backlighting Revised
Dump The Tubes   The Economic Case For Led Backlighting   RevisedDump The Tubes   The Economic Case For Led Backlighting   Revised
Dump The Tubes The Economic Case For Led Backlighting Revisedandyclark
 
Towards An Integrated Ecosystem Based Management
Towards An Integrated Ecosystem Based ManagementTowards An Integrated Ecosystem Based Management
Towards An Integrated Ecosystem Based ManagementUniversity of Tasmania
 
Beautiful Lanscape
Beautiful LanscapeBeautiful Lanscape
Beautiful Lanscapefauzanmuslim
 
Crew, Foia, Documents 011994 - 012108
Crew, Foia, Documents 011994 - 012108Crew, Foia, Documents 011994 - 012108
Crew, Foia, Documents 011994 - 012108Obama White House
 
Social Media Basics
Social Media BasicsSocial Media Basics
Social Media Basicsbcornell1
 
Crew documents 020549 - 020563
Crew documents 020549 - 020563Crew documents 020549 - 020563
Crew documents 020549 - 020563Obama White House
 
Crew, Foia, Documents 008692 - 008793
Crew, Foia, Documents 008692 - 008793Crew, Foia, Documents 008692 - 008793
Crew, Foia, Documents 008692 - 008793Obama White House
 
The Scientific Method on the Semantic Web
The Scientific Method on the Semantic WebThe Scientific Method on the Semantic Web
The Scientific Method on the Semantic WebMark Wilkinson
 
Another Introduce to Redis
Another Introduce to RedisAnother Introduce to Redis
Another Introduce to Redisjiaqing zheng
 

Andere mochten auch (20)

Almost 2009
Almost 2009Almost 2009
Almost 2009
 
How A Web Page Is Seen
How A Web Page Is SeenHow A Web Page Is Seen
How A Web Page Is Seen
 
Krecenje
KrecenjeKrecenje
Krecenje
 
Ms.Nl.9031 Smoelenboek Wpc Final2
Ms.Nl.9031 Smoelenboek Wpc Final2Ms.Nl.9031 Smoelenboek Wpc Final2
Ms.Nl.9031 Smoelenboek Wpc Final2
 
21st Century Skills Pp
21st Century Skills Pp21st Century Skills Pp
21st Century Skills Pp
 
Fundraising Day - New York: Taking Leadership Online
Fundraising Day - New York: Taking Leadership OnlineFundraising Day - New York: Taking Leadership Online
Fundraising Day - New York: Taking Leadership Online
 
BDM Brochure
BDM BrochureBDM Brochure
BDM Brochure
 
Crew documents 020334 - 020392
Crew documents 020334 - 020392Crew documents 020334 - 020392
Crew documents 020334 - 020392
 
Dump The Tubes The Economic Case For Led Backlighting Revised
Dump The Tubes   The Economic Case For Led Backlighting   RevisedDump The Tubes   The Economic Case For Led Backlighting   Revised
Dump The Tubes The Economic Case For Led Backlighting Revised
 
Project
ProjectProject
Project
 
Towards An Integrated Ecosystem Based Management
Towards An Integrated Ecosystem Based ManagementTowards An Integrated Ecosystem Based Management
Towards An Integrated Ecosystem Based Management
 
Beautiful Lanscape
Beautiful LanscapeBeautiful Lanscape
Beautiful Lanscape
 
Crew, Foia, Documents 011994 - 012108
Crew, Foia, Documents 011994 - 012108Crew, Foia, Documents 011994 - 012108
Crew, Foia, Documents 011994 - 012108
 
Social Media Basics
Social Media BasicsSocial Media Basics
Social Media Basics
 
Crew documents 020549 - 020563
Crew documents 020549 - 020563Crew documents 020549 - 020563
Crew documents 020549 - 020563
 
Crew, Foia, Documents 008692 - 008793
Crew, Foia, Documents 008692 - 008793Crew, Foia, Documents 008692 - 008793
Crew, Foia, Documents 008692 - 008793
 
The Scientific Method on the Semantic Web
The Scientific Method on the Semantic WebThe Scientific Method on the Semantic Web
The Scientific Method on the Semantic Web
 
Another Introduce to Redis
Another Introduce to RedisAnother Introduce to Redis
Another Introduce to Redis
 
CAS N° 003 2015
CAS N° 003 2015CAS N° 003 2015
CAS N° 003 2015
 
Digital Native
Digital NativeDigital Native
Digital Native
 

Ähnlich wie Orm

The Ring programming language version 1.3 book - Part 20 of 88
The Ring programming language version 1.3 book - Part 20 of 88The Ring programming language version 1.3 book - Part 20 of 88
The Ring programming language version 1.3 book - Part 20 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196Mahmoud Samir Fayed
 
Code as data as code.
Code as data as code.Code as data as code.
Code as data as code.Mike Fogus
 
The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202Mahmoud Samir Fayed
 
Python SQite3 database Tutorial | SQlite Database
Python SQite3 database Tutorial | SQlite DatabasePython SQite3 database Tutorial | SQlite Database
Python SQite3 database Tutorial | SQlite DatabaseElangovanTechNotesET
 
The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189Mahmoud Samir Fayed
 
MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013
MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013
MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013Mosky Liu
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
 
Owasp Indy Q2 2012 Advanced SQLi
Owasp Indy Q2 2012 Advanced SQLiOwasp Indy Q2 2012 Advanced SQLi
Owasp Indy Q2 2012 Advanced SQLiowaspindy
 
Introduction to PiCloud
Introduction to PiCloudIntroduction to PiCloud
Introduction to PiCloudBill Koch
 
The Ring programming language version 1.10 book - Part 37 of 212
The Ring programming language version 1.10 book - Part 37 of 212The Ring programming language version 1.10 book - Part 37 of 212
The Ring programming language version 1.10 book - Part 37 of 212Mahmoud Samir Fayed
 
Python postgre sql a wonderful wedding
Python postgre sql   a wonderful weddingPython postgre sql   a wonderful wedding
Python postgre sql a wonderful weddingStéphane Wirtel
 
Shrug2017 arcpy data_and_you
Shrug2017 arcpy data_and_youShrug2017 arcpy data_and_you
Shrug2017 arcpy data_and_youSHRUG GIS
 
Clojure: Simple By Design
Clojure: Simple By DesignClojure: Simple By Design
Clojure: Simple By DesignAll Things Open
 
The Ring programming language version 1.5.2 book - Part 28 of 181
The Ring programming language version 1.5.2 book - Part 28 of 181The Ring programming language version 1.5.2 book - Part 28 of 181
The Ring programming language version 1.5.2 book - Part 28 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 18 of 84
The Ring programming language version 1.2 book - Part 18 of 84The Ring programming language version 1.2 book - Part 18 of 84
The Ring programming language version 1.2 book - Part 18 of 84Mahmoud Samir Fayed
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesTatiana Al-Chueyr
 
The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180Mahmoud Samir Fayed
 
Codified PostgreSQL Schema
Codified PostgreSQL SchemaCodified PostgreSQL Schema
Codified PostgreSQL SchemaSean Chittenden
 

Ähnlich wie Orm (20)

The Ring programming language version 1.3 book - Part 20 of 88
The Ring programming language version 1.3 book - Part 20 of 88The Ring programming language version 1.3 book - Part 20 of 88
The Ring programming language version 1.3 book - Part 20 of 88
 
The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196
 
Code as data as code.
Code as data as code.Code as data as code.
Code as data as code.
 
The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202
 
Python SQite3 database Tutorial | SQlite Database
Python SQite3 database Tutorial | SQlite DatabasePython SQite3 database Tutorial | SQlite Database
Python SQite3 database Tutorial | SQlite Database
 
The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189
 
MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013
MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013
MoSQL: More than SQL, but Less than ORM @ PyCon APAC 2013
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
 
Owasp Indy Q2 2012 Advanced SQLi
Owasp Indy Q2 2012 Advanced SQLiOwasp Indy Q2 2012 Advanced SQLi
Owasp Indy Q2 2012 Advanced SQLi
 
Introduction to PiCloud
Introduction to PiCloudIntroduction to PiCloud
Introduction to PiCloud
 
The Ring programming language version 1.10 book - Part 37 of 212
The Ring programming language version 1.10 book - Part 37 of 212The Ring programming language version 1.10 book - Part 37 of 212
The Ring programming language version 1.10 book - Part 37 of 212
 
Python postgre sql a wonderful wedding
Python postgre sql   a wonderful weddingPython postgre sql   a wonderful wedding
Python postgre sql a wonderful wedding
 
Shrug2017 arcpy data_and_you
Shrug2017 arcpy data_and_youShrug2017 arcpy data_and_you
Shrug2017 arcpy data_and_you
 
Clojure: Simple By Design
Clojure: Simple By DesignClojure: Simple By Design
Clojure: Simple By Design
 
The Ring programming language version 1.5.2 book - Part 28 of 181
The Ring programming language version 1.5.2 book - Part 28 of 181The Ring programming language version 1.5.2 book - Part 28 of 181
The Ring programming language version 1.5.2 book - Part 28 of 181
 
The Ring programming language version 1.2 book - Part 18 of 84
The Ring programming language version 1.2 book - Part 18 of 84The Ring programming language version 1.2 book - Part 18 of 84
The Ring programming language version 1.2 book - Part 18 of 84
 
OrientDB
OrientDBOrientDB
OrientDB
 
PythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummiesPythonBrasil[8] - CPython for dummies
PythonBrasil[8] - CPython for dummies
 
The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180
 
Codified PostgreSQL Schema
Codified PostgreSQL SchemaCodified PostgreSQL Schema
Codified PostgreSQL Schema
 

Orm

  • 1. Python ORMs Cosmin Poieana <cmin@ropython.org> → baze de date → tipuri de ORM (modele) → comparații (exemple) → peewee → resurse
  • 2. Database APIs NoSQL ● redis ● mongodb ● … SQL ● pyodbc ● sqlite3 ● pymysql ● ...
  • 3. sqlite3 ● Nu are nevoie de driver, server ● Static pe disc / memorie ● Interogări simple (+ mici diferențe) 1. conexiune 2. obținere cursor 3. execuție interogare *. commit 4. închidere
  • 4. sqlite3 >>> import sqlite3 >>> conn = sqlite3.connect("ropy.db") >>> c = conn.cursor() >>> c.execute("CREATE TABLE persoana (nume text, adresa text, varsta real)") >>> c.execute("INSERT INTO persoana VALUES ('Nume1', 'Adresa1', 20)") >>> conn.commit() >>> c.execute("SELECT * FROM persoana") >>> c.fetchall() [(u'Nume1', u'Adresa1', 20.0)]
  • 5. ORM ● Object-relational mapping (convertire date dintr-un sistem incompatibil in POO) ● Pony, Django ORM, peewee, SQLAlchemy ● Modele – DataMapper – ActiveRecord ● SQLite, MySQL, PostgreSQL[, Oracle]
  • 6. Django ORM $ django-admin.py startproject ropy $ cd ropy $ python manage.py syncdb >>> from django.db import models >>> class Person(models.Model): ... name = models.TextField() ... class Meta: ... app_label = 'demo' >>> class Address(models.Model): ... address = models.TextField() ... person = models.ForeignKey(Person) ... class Meta: ... app_label = 'demo'
  • 7. Django ORM >>> p = Person(name='person') >>> p.save() >>> print "%r, %r" % (p.id, p.name) 1, 'person' >>> a = Address(person=p, address='address') >>> a.save() >>> print "%r, %r" % (a.id, a.address) 1, 'address'
  • 8. Django ORM >>> persons = Person.objects.filter(name='person') >>> p = persons[0] >>> print "%r, %r" % (p.id, p.name) 1, u'person' >>> addresses = Address.objects.filter(person=p) >>> addresses [<address>] >>> a = addresses[0] >>> print "%r, %r" % (a.id, a.address) 1, u'address'
  • 9. Peewee >>> from peewee import SqliteDatabase, CharField, ForeignKeyField, Model >>> db = SqliteDatabase(':memory:') >>> class Person(Model): ... name = CharField() ... class Meta: ... database = db >>> class Address(Model): ... address = CharField() ... person = ForeignKeyField(Person) ... class Meta: ... database = db >>> Person.create_table() >>> Address.create_table()
  • 10. Peewee >>> p = Person(name='person') >>> p.save() >>> a = Address(address='address', person=p) >>> a.save()
  • 11. Peewee >>> person = Person.select().where(Person.name == 'person').get() >>> print '%r, %r' % (person.id, person.name) 1, u'person' >>> address = Address.select().where(Address.person == person).get() >>> print '%r, %r' % (address.id, address.address) 1, u'address'
  • 12. Resurse ● http://www.pythoncentral.io/sqlalchemy-vs-orms/ ● http://peewee.readthedocs.org/en/latest/ ● http://effectivedjango.com/orm.html ● http://www.sqlalchemy.org/ ● http://ponyorm.com/