pythonorm

pythonorm Git Source Tree


Root/example.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from orm import MySQLModel
 
class MyModel(MySQLModel):
    def __init__(self):
        self.connect("127.0.0.1", 3308, "test", "PASSWORD", "test2")
 
class flavor(MyModel):
    pass
 
class color(MyModel):
    pass
 
class user(MyModel):
    pass
    _has_one = [color()]
    #_has_many_to_many = [flavor()]
 
x = user()
while x.select("username").select_related("color", ["color"]).get():
    print x.username
x.username = "adamsna"
x.save()
x.color.color = "green"
x.color.save()

Archive Download this file

Branches

Number of commits:
Page rendered in 0.07478s using 11 queries.