Skip to content

Commit 4884a7d

Browse files
committed
Add engine specific rules
1 parent f5f7137 commit 4884a7d

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/databricks_sql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ def __init__(self):
1717

1818
self.database_engine = DatabaseEngine.DATABRICKS
1919

20+
@property
21+
def engine_specific_rules(self) -> str:
22+
"""Get the engine specific rules."""
23+
return
24+
2025
@property
2126
def engine_specific_fields(self) -> list[str]:
2227
"""Get the engine specific fields."""

text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/snowflake_sql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ def __init__(self):
1717

1818
self.database_engine = DatabaseEngine.SNOWFLAKE
1919

20+
@property
21+
def engine_specific_rules(self) -> str:
22+
"""Get the engine specific rules."""
23+
return """When an ORDER BY clause is included in the SQL query, always append the ORDER BY clause with 'NULLS LAST' to ensure that NULL values are at the end of the result set. e.g. 'ORDER BY column_name DESC NULLS LAST'."""
24+
2025
@property
2126
def engine_specific_fields(self) -> list[str]:
2227
"""Get the engine specific fields."""

text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/sql.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ def __init__(self):
3131

3232
self.database_engine = None
3333

34+
@property
35+
@abstractmethod
36+
def engine_specific_rules(self) -> str:
37+
"""Get the engine specific rules."""
38+
pass
39+
3440
@property
3541
@abstractmethod
3642
def invalid_identifiers(self) -> list[str]:

text_2_sql/text_2_sql_core/src/text_2_sql_core/connectors/tsql_sql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ def __init__(self):
1616

1717
self.database_engine = DatabaseEngine.TSQL
1818

19+
@property
20+
def engine_specific_rules(self) -> str:
21+
"""Get the engine specific rules."""
22+
return """Use TOP X instead of LIMIT X to limit the number of rows returned."""
23+
1924
@property
2025
def engine_specific_fields(self) -> list[str]:
2126
"""Get the engine specific fields."""

0 commit comments

Comments
 (0)