From d0155938d1a030d27e7a762bd877972d042201cb Mon Sep 17 00:00:00 2001 From: Gregor Aisch Date: Mon, 1 Apr 2013 14:07:31 +0200 Subject: [PATCH] added example with object-oriented API to readme --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 2828ef5..1022772 100644 --- a/README.md +++ b/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 --------