diff --git a/db_to_sqlite/cli.py b/db_to_sqlite/cli.py index bfd4dcf..a80c258 100644 --- a/db_to_sqlite/cli.py +++ b/db_to_sqlite/cli.py @@ -125,7 +125,7 @@ def cli( except NotImplementedError: column_type = str create_columns[column["name"]] = column_type - db[table].create(create_columns) + db[table].create(create_columns, pks) else: rows = itertools.chain([first], rows) if progress: diff --git a/tests/test_db_to_sqlite.py b/tests/test_db_to_sqlite.py index e12b98a..ba82ee4 100644 --- a/tests/test_db_to_sqlite.py +++ b/tests/test_db_to_sqlite.py @@ -27,7 +27,7 @@ def test_db_to_sqlite(connection, tmpdir, cli_runner): assert [{"id": 1, "name": "Lila"}] == list(db["user"].rows) assert ( db["empty_table"].schema - == "CREATE TABLE [empty_table] (\n [id] INTEGER,\n [name] TEXT,\n [ip] TEXT\n)" + == "CREATE TABLE [empty_table] (\n [id] INTEGER PRIMARY KEY,\n [name] TEXT,\n [ip] TEXT\n)" ) # Check foreign keys assert [