Skip to content

Update utils.py - replace/force-create import_mode were not being handled - #32

Open
sidphbot wants to merge 1 commit into
dolthub:mainfrom
sidphbot:main
Open

Update utils.py - replace/force-create import_mode were not being handled#32
sidphbot wants to merge 1 commit into
dolthub:mainfrom
sidphbot:main

Conversation

@sidphbot

Copy link
Copy Markdown

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()
ifimport_modeandimport_modenotinimport_modes:
raiseValueError(f"update_mode must be one of: {import_modes}")
else:
iftablein [table.namefortableindolt.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
returnimport_mode

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

@codecov-commenter

codecov-commenter commented Nov 6, 2021

Copy link
Copy Markdown

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 freeto 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

@sidphbot@codecov-commenter