Skip to content

Commit

Permalink
Merge pull request #173 from rethinkdb/fix-171-restore-primary-key
Browse files Browse the repository at this point in the history
Fixing import command no primary key issue
  • Loading branch information
gabor-boros authored Mar 2, 2020
2 parents 9aa68fe + 08c2739 commit 1089a24
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rethinkdb/_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ def __init__(
self.write_hook = write_hook or []

# options
self.source_options = source_options or {}
self.source_options = source_options or {
"create_args": {
"primary_key": self.primary_key
}
}

# name
if hasattr(self._source, 'name') and self._source.name:
Expand Down Expand Up @@ -249,7 +253,7 @@ def setup_table(self):
ast.expr([self.table]).set_difference(
query.db(self.db).table_list()
).for_each(query.db(self.db).table_create(
query.row, **self.source_options.create_args if 'create_args' in self.source_options else {})
query.row, **self.source_options["create_args"] if 'create_args' in self.source_options else {})
)
)

Expand Down

0 comments on commit 1089a24

Please sign in to comment.