Skip to content

Commit 007a17a

Browse files
committed
fix(sampling): trim quotes in estimate query
1 parent 151598a commit 007a17a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

testgen/commands/queries/profiling_query.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from testgen.commands.queries.refresh_data_chars_query import CRefreshDataCharsSQL
55
from testgen.commands.queries.rollup_scores_query import CRollupScoresSQL
66
from testgen.common import date_service, read_template_sql_file, read_template_yaml_file
7-
from testgen.common.database.database_service import replace_params
7+
from testgen.common.database.database_service import get_flavor_service, replace_params
88
from testgen.common.read_file import replace_templated_functions
99

1010

@@ -121,6 +121,7 @@ def _get_params(self) -> dict:
121121
"CONTINGENCY_MAX_VALUES": self.contingency_max_values,
122122
"PROCESS_ID": self.process_id,
123123
"SQL_FLAVOR": self.flavor,
124+
"QUOTE": get_flavor_service(self.flavor).quote_character
124125
}
125126

126127
def _get_query(

testgen/template/profiling/project_update_profile_results_to_estimates.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ set sample_ratio = :PROFILE_SAMPLE_RATIO,
2424
future_date_ct = ROUND(future_date_ct * :PROFILE_SAMPLE_RATIO, 0),
2525
boolean_true_ct = ROUND(boolean_true_ct * :PROFILE_SAMPLE_RATIO, 0)
2626
where profile_run_id = :PROFILE_RUN_ID
27-
and schema_name = split_part(:SAMPLING_TABLE, '.', 1)
28-
and table_name = split_part(:SAMPLING_TABLE, '.', 2)
27+
and schema_name = TRIM(SPLIT_PART(:SAMPLING_TABLE, '.', 1), :QUOTE)
28+
and table_name = TRIM(SPLIT_PART(:SAMPLING_TABLE, '.', 2), :QUOTE)
2929
and sample_ratio IS NULL;
3030

3131

0 commit comments

Comments
 (0)