Skip to content

Commit fe83969

Browse files
committed
Tweak update example for ORM
I'm settling on update_* for methods that modify the database, and set_* for methods that modify local object state.
1 parent c055aa1 commit fe83969

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

postgres/orm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
...
142142
... typname = "foo"
143143
...
144-
... def set_baz(self, baz):
144+
... def update_baz(self, baz):
145145
... self.db.run( "UPDATE foo SET baz=%s WHERE bar=%s"
146146
... , (baz, self.bar)
147147
... )
@@ -154,7 +154,7 @@
154154
>>> db.one("SELECT baz FROM foo WHERE bar='blam'")
155155
42
156156
>>> foo = db.one("SELECT foo.*::foo FROM foo WHERE bar='blam'")
157-
>>> foo.set_baz(90210)
157+
>>> foo.update_baz(90210)
158158
>>> foo.baz
159159
90210
160160
>>> db.one("SELECT baz FROM foo WHERE bar='blam'")

0 commit comments

Comments
 (0)