added example with object-oriented API to readme
This commit is contained in:
parent
b7bef6ddc4
commit
d0155938d1
14
README.md
14
README.md
@ -45,6 +45,19 @@ Another example, updating data in a datastore, might look like this:
|
||||
upsert(engine, table, item, ['key1', 'key2'])
|
||||
|
||||
|
||||
Here's the same example, but using the object-oriented API:
|
||||
|
||||
import sqlaload
|
||||
|
||||
db = sqlaload.create('sqlite:///things.db')
|
||||
table = db.get_table('data')
|
||||
|
||||
for item in magic_data_source_that_produces_entries():
|
||||
assert 'key1' in item
|
||||
assert 'key2' in item
|
||||
table.upsert(item, ['key1', 'key2'])
|
||||
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
@ -74,6 +87,7 @@ The library currently exposes the following functions:
|
||||
* ``delete(engine, table, **kw)`` will remove records from a table. ``**kw`` is the same as in ``find`` and can be used to limit the set of records to be removed.
|
||||
|
||||
|
||||
|
||||
Feedback
|
||||
--------
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user