From 467234154a09c24031dea4a9985372c724be7dc7 Mon Sep 17 00:00:00 2001 From: Tommaso Date: Fri, 15 Sep 2023 13:40:45 +0200 Subject: [PATCH] Add fix for test_update_rows This will be removed once issue with dolt table import -u is fixed https://github.com/dolthub/dolt/issues/6675 --- doltcli/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doltcli/utils.py b/doltcli/utils.py index 46e6ea1..694abf1 100644 --- a/doltcli/utils.py +++ b/doltcli/utils.py @@ -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 @@ -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))]