Allow --destination_dialect=bigquery in convert_file#1997
Open
Chessing234 wants to merge 1 commit intoMIT-LCP:mainfrom
Open
Allow --destination_dialect=bigquery in convert_file#1997Chessing234 wants to merge 1 commit intoMIT-LCP:mainfrom
Chessing234 wants to merge 1 commit intoMIT-LCP:mainfrom
Conversation
The convert_folder subcommand accepts
--destination_dialect {bigquery,postgres,duckdb}
but convert_file's matching argument is restricted to
--destination_dialect {postgres,duckdb},
so `mimic_utils convert_file --destination_dialect bigquery ...` fails at
argparse time even though the underlying transpile_file /
transpile_query pipeline supports bigquery as a destination (it is in
_FUNCTION_MAPPING in transpile.py, alongside postgres and duckdb). The
two subcommands should have the same set of destination dialects since
they call the same transpilation code. Add "bigquery" to the file parser's
choices to mirror the folder parser.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
The
convert_filesubcommand ofmimic_utilsrejects--destination_dialect bigqueryat argparse time, even though thepipeline underneath supports bigquery as a destination. The
convert_foldersubcommand accepts it.Root cause
In
src/mimic_utils/__main__.py:file_parseris missing"bigquery"from its choices. Both subparsersultimately dispatch into
transpile_file/transpile_folder, whichboth call
transpile_query(..., destination_dialect=...). That functionvalidates the dialect via
_FUNCTION_MAPPING, which contains{'bigquery': {}, 'postgres': {...}, 'duckdb': {...}}— so bigquery isa supported destination; the CLI choice list is the only thing blocking
it.
Why the fix is correct
destination choices should match.
transpile_query/_FUNCTION_MAPPINGalreadyaccepts
bigqueryas a destination dialect.dispatch remain unchanged.
Change
src/mimic_utils/__main__.py: add"bigquery"to thefile_parser--destination_dialectchoices.