Skip to content

Commit 4d7256d

Browse files
committed
[DOP-26403] Set output type based on SQL query type
1 parent 84d25c3 commit 4d7256d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

data_rentgen/consumer/extractors/generic/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def _extract_output_type(
165165
def _extract_output_type_from_sql(self, sql: str) -> OutputTypeDTO | None:
166166
found = SQL_QUERY_SYNTAX.search(sql)
167167
if found:
168-
return QUERY_TYPE_TO_OUTPUT_TYPE[found.group("query_type")]
168+
return QUERY_TYPE_TO_OUTPUT_TYPE[found.group("query_type").upper()]
169169
found = ALTER_SYNTAX.search(sql)
170170
if found:
171171
return OutputTypeDTO.ALTER

tests/test_consumer/test_extractors/test_extractors_interaction.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ def test_extractors_extract_output_batch_with_lifecycle(
261261
[
262262
("CREATE TABLE AS SELECT * FROM mytable", OutputTypeDTO.CREATE),
263263
("INSERT INTO mytable SELECT * FROM mytable", OutputTypeDTO.APPEND),
264+
("insert into mytable select * from mytable", OutputTypeDTO.APPEND),
264265
("UPDATE mytable SET a=1", OutputTypeDTO.UPDATE),
265266
("DELETE FROM mytable", OutputTypeDTO.DELETE),
266267
("COPY mytable FROM '...'", OutputTypeDTO.APPEND),

0 commit comments

Comments
 (0)