Skip to content

Commit

Permalink
Add fix for test_update_rows
Browse files Browse the repository at this point in the history
This will be removed once issue with dolt table import -u is fixed
dolthub/dolt#6675
  • Loading branch information
tommasogritti committed Sep 15, 2023
1 parent 48c28dd commit 4672341
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion doltcli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ def writer(filepath: str):
for row in rows:
fieldnames = fieldnames.union(set(row.keys()))

csv_writer = csv.DictWriter(f, fieldnames)
# TODO: this is only needed to make sure test_update_rows passes until an issue
# with dolt table import -u is addressed:
# https://github.com/dolthub/dolt/issues/6675
csv_writer = csv.DictWriter(f, sorted(fieldnames))
csv_writer.writeheader()
csv_writer.writerows(rows)
return filepath
Expand Down Expand Up @@ -222,6 +225,8 @@ def _import_helper(
import_flags = IMPORT_MODES_TO_FLAGS[import_mode]
try:
import_file = write_import_file(fname)
with open(import_file, "r") as f:
print(f.read())
args = ["table", "import", table] + import_flags
if primary_key:
args += ["--pk={}".format(",".join(primary_key))]
Expand Down

0 comments on commit 4672341

Please sign in to comment.