1414 CLPConfig ,
1515 Database ,
1616 FILES_TABLE_SUFFIX ,
17- StorageEngine ,
1817)
1918from clp_py_utils .sql_adapter import SQL_Adapter
2019from job_orchestration .scheduler .constants import QueryJobStatus , QueryJobType
4140logger = logging .getLogger (__file__ )
4241
4342
44- def get_orig_file_id (
45- db_config : Database , storage_engine : StorageEngine , dataset : str , path : str
46- ) -> Optional [str ]:
43+ def get_orig_file_id (db_config : Database , path : str ) -> Optional [str ]:
4744 """
4845 :param db_config:
49- :param storage_engine:
50- :param dataset:
5146 :param path: Path of the original file.
5247 :return: The ID of an original file which has the given path, or None if no such file exists.
5348 NOTE: Multiple original files may have the same path in which case this method returns the ID of
@@ -56,9 +51,6 @@ def get_orig_file_id(
5651 sql_adapter = SQL_Adapter (db_config )
5752 clp_db_connection_params = db_config .get_clp_connection_params_and_type (True )
5853 table_prefix = clp_db_connection_params ["table_prefix" ]
59- if StorageEngine .CLP_S == storage_engine :
60- table_prefix = f"{ table_prefix } { dataset } _"
61-
6254 with closing (sql_adapter .create_connection (True )) as db_conn , closing (
6355 db_conn .cursor (dictionary = True )
6456 ) as db_cursor :
@@ -136,12 +128,7 @@ def handle_extract_stream_cmd(
136128 orig_file_id = parsed_args .orig_file_id
137129 else :
138130 orig_file_path = parsed_args .orig_file_path
139- orig_file_id = get_orig_file_id (
140- clp_config .database ,
141- clp_config .package .storage_engine ,
142- CLP_DEFAULT_DATASET_NAME ,
143- orig_file_path ,
144- )
131+ orig_file_id = get_orig_file_id (clp_config .database , orig_file_path )
145132 if orig_file_id is None :
146133 logger .error (f"Cannot find orig_file_id corresponding to '{ orig_file_path } '." )
147134 return - 1
0 commit comments