Merge pull request #60 from abhinav-upadhyay/fix-table-insert
Fix insert for tables that do not have any primary key.
This commit is contained in:
commit
dc0a6f1f49
@ -68,6 +68,7 @@ class Table(object):
|
|||||||
if ensure:
|
if ensure:
|
||||||
self._ensure_columns(row, types=types)
|
self._ensure_columns(row, types=types)
|
||||||
res = self.database.executable.execute(self.table.insert(row))
|
res = self.database.executable.execute(self.table.insert(row))
|
||||||
|
if len(res.inserted_primary_key) > 0:
|
||||||
return res.inserted_primary_key[0]
|
return res.inserted_primary_key[0]
|
||||||
|
|
||||||
def insert_many(self, rows, chunk_size=1000, ensure=True, types={}):
|
def insert_many(self, rows, chunk_size=1000, ensure=True, types={}):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user