Skip to content

Conversation

sidphbot
Copy link

@sidphbot sidphbot commented Nov 5, 2021

code snippet to reproduce:
doltcli
write_rows(write_rows(dolt, "characters", TEST_ROWS, REPLACE, ["id"])

or via doltpy:
write_pandas(dolt, table_name, df, import_mode='replace')

both call _import_helper which refers to

doltcli/doltcli/utils.py

Lines 251 to 265 in a807c93

def _get_import_mode_and_flags(
dolt: DoltT, table: str, import_mode: Optional[str] = None
) -> str:
import_modes = IMPORT_MODES_TO_FLAGS.keys()
if import_mode and import_mode not in import_modes:
raise ValueError(f"update_mode must be one of: {import_modes}")
else:
if table in [table.name for table in dolt.ls()]:
logger.info(f'No import mode specified, table exists, using "{UPDATE}"')
import_mode = UPDATE
else:
logger.info(f'No import mode specified, table exists, using "{CREATE}"')
import_mode = CREATE
return import_mode

the checks force it to return only create/update mode depending on existence of table, replace/force-create modes are ignored

@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2021

Codecov Report

Merging #32 (a807c93) into main (a807c93) will not change coverage.
The diff coverage is n/a.

❗ Current head a807c93 differs from pull request most recent head 059a7c6. Consider uploading reports for the commit 059a7c6 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main      #32   +/-   ##
=======================================
  Coverage   66.04%   66.04%           
=======================================
  Files           5        5           
  Lines         972      972           
=======================================
  Hits          642      642           
  Misses        330      330           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a807c93...059a7c6. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants