sqlleaf 0.0.7__tar.gz → 0.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. {sqlleaf-0.0.7/sqlleaf.egg-info → sqlleaf-0.0.8}/PKG-INFO +2 -2
  2. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/pyproject.toml +2 -2
  3. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/__init__.py +0 -1
  4. sqlleaf-0.0.8/sqlleaf/dialects/__init__.py +8 -0
  5. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/athena/config.py +11 -3
  6. sqlleaf-0.0.8/sqlleaf/dialects/base.py +86 -0
  7. sqlleaf-0.0.8/sqlleaf/dialects/mysql/config.py +33 -0
  8. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/postgres/config.py +5 -5
  9. sqlleaf-0.0.8/sqlleaf/dialects/redshift/config.py +12 -0
  10. sqlleaf-0.0.8/sqlleaf/exception.py +94 -0
  11. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/lineage.py +7 -7
  12. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/mappings.py +48 -20
  13. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/context.py +2 -2
  14. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/__init__.py +2 -0
  15. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/base.py +9 -3
  16. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/ctas.py +3 -2
  17. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/declare_item.py +6 -2
  18. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/execute.py +6 -0
  19. sqlleaf-0.0.8/sqlleaf/models/query/prepare.py +108 -0
  20. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/procedure.py +9 -8
  21. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/reset.py +2 -2
  22. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/select.py +13 -1
  23. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/set.py +7 -7
  24. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/table.py +6 -2
  25. sqlleaf-0.0.8/sqlleaf/models/query/use.py +26 -0
  26. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/user_defined_function.py +19 -1
  27. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/path.py +6 -6
  28. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/collector/classify.py +62 -8
  29. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/collector/collector.py +25 -26
  30. sqlleaf-0.0.8/sqlleaf/processors/generator/__init__.py +0 -0
  31. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/generator/dialects/base.py +1 -1
  32. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/generator/generator.py +11 -8
  33. sqlleaf-0.0.8/sqlleaf/processors/substitutor/__init__.py +0 -0
  34. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/substitutor/substitute.py +37 -7
  35. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/base.py +30 -3
  36. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/transformer.py +8 -1
  37. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/util/__init__.py +2 -0
  38. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/util/expression.py +82 -5
  39. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/util/graph.py +11 -10
  40. {sqlleaf-0.0.7 → sqlleaf-0.0.8/sqlleaf.egg-info}/PKG-INFO +2 -2
  41. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf.egg-info/SOURCES.txt +6 -2
  42. sqlleaf-0.0.8/sqlleaf.egg-info/requires.txt +2 -0
  43. sqlleaf-0.0.7/sqlleaf/dialects/__init__.py +0 -20
  44. sqlleaf-0.0.7/sqlleaf/dialects/base.py +0 -57
  45. sqlleaf-0.0.7/sqlleaf/exception.py +0 -67
  46. sqlleaf-0.0.7/sqlleaf/models/query/prepare.py +0 -66
  47. sqlleaf-0.0.7/sqlleaf.egg-info/requires.txt +0 -2
  48. sqlleaf-0.0.7/tests/test_hooks.py +0 -64
  49. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/LICENSE +0 -0
  50. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/README.md +0 -0
  51. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/setup.cfg +0 -0
  52. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/athena/__init__.py +0 -0
  53. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/loader.py +0 -0
  54. {sqlleaf-0.0.7/sqlleaf/dialects/postgres → sqlleaf-0.0.8/sqlleaf/dialects/mysql}/__init__.py +0 -0
  55. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/plpgsql/__init__.py +0 -0
  56. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/plpgsql/p_classes.py +0 -0
  57. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/plpgsql/p_dialect.py +0 -0
  58. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/plpgsql/p_generator.py +0 -0
  59. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/plpgsql/p_parser.py +0 -0
  60. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/dialects/plpgsql/p_tokenizer.py +0 -0
  61. {sqlleaf-0.0.7/sqlleaf/models → sqlleaf-0.0.8/sqlleaf/dialects/postgres}/__init__.py +0 -0
  62. {sqlleaf-0.0.7/sqlleaf/processors → sqlleaf-0.0.8/sqlleaf/dialects/redshift}/__init__.py +0 -0
  63. {sqlleaf-0.0.7/sqlleaf/processors/collector → sqlleaf-0.0.8/sqlleaf/models}/__init__.py +0 -0
  64. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/hook.py +0 -0
  65. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/__init__.py +0 -0
  66. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/base.py +0 -0
  67. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/column.py +0 -0
  68. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/counter.py +0 -0
  69. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/dynamodb.py +0 -0
  70. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/function.py +0 -0
  71. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/interval.py +0 -0
  72. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/json.py +0 -0
  73. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/literal.py +0 -0
  74. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/null.py +0 -0
  75. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/pivot.py +0 -0
  76. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/program.py +0 -0
  77. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/sequence.py +0 -0
  78. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/star.py +0 -0
  79. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/stream.py +0 -0
  80. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/user_defined_function.py +0 -0
  81. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/var.py +0 -0
  82. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/variable.py +0 -0
  83. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/node/window.py +0 -0
  84. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/block.py +0 -0
  85. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/call.py +0 -0
  86. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/case.py +0 -0
  87. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/copy.py +0 -0
  88. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/database.py +0 -0
  89. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/delete.py +0 -0
  90. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/do.py +0 -0
  91. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/exception_.py +0 -0
  92. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/execute_dynamic.py +0 -0
  93. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/fetch.py +0 -0
  94. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/for_in.py +0 -0
  95. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/holder.py +0 -0
  96. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/if_.py +0 -0
  97. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/insert.py +0 -0
  98. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/loop.py +0 -0
  99. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/merge.py +0 -0
  100. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/multitable_insert.py +0 -0
  101. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/open.py +0 -0
  102. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/perform.py +0 -0
  103. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/put.py +0 -0
  104. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/replace.py +0 -0
  105. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/schema.py +0 -0
  106. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/sequence.py +0 -0
  107. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/stage.py +0 -0
  108. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/trigger.py +0 -0
  109. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/type.py +0 -0
  110. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/unload.py +0 -0
  111. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/update.py +0 -0
  112. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/values.py +0 -0
  113. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/view.py +0 -0
  114. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/models/query/while_.py +0 -0
  115. {sqlleaf-0.0.7/sqlleaf/processors/generator → sqlleaf-0.0.8/sqlleaf/processors}/__init__.py +0 -0
  116. {sqlleaf-0.0.7/sqlleaf/processors/substitutor → sqlleaf-0.0.8/sqlleaf/processors/collector}/__init__.py +0 -0
  117. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/generator/dialects/__init__.py +0 -0
  118. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/generator/dialects/athena.py +0 -0
  119. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/generator/dialects/mysql.py +0 -0
  120. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/generator/dialects/postgres.py +0 -0
  121. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/generator/dialects/redshift.py +0 -0
  122. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/generator/dialects/snowflake.py +0 -0
  123. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/__init__.py +0 -0
  124. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/assignment.py +0 -0
  125. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/call.py +0 -0
  126. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/case.py +0 -0
  127. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/copy.py +0 -0
  128. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/ctas.py +0 -0
  129. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/delete.py +0 -0
  130. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/execute.py +0 -0
  131. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/execute_dynamic.py +0 -0
  132. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/expressions/__init__.py +0 -0
  133. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/expressions/format.py +0 -0
  134. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/expressions/functional_notation.py +0 -0
  135. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/expressions/operator.py +0 -0
  136. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/expressions/row.py +0 -0
  137. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/expressions/values.py +0 -0
  138. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/for_in.py +0 -0
  139. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/insert.py +0 -0
  140. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/merge.py +0 -0
  141. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/multitable_insert.py +0 -0
  142. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/open.py +0 -0
  143. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/prepare.py +0 -0
  144. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/replace.py +0 -0
  145. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/unload.py +0 -0
  146. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/update.py +0 -0
  147. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/processors/transformer/values.py +0 -0
  148. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/typing.py +0 -0
  149. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/util/helpers.py +0 -0
  150. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf/util/iterators.py +0 -0
  151. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf.egg-info/dependency_links.txt +0 -0
  152. {sqlleaf-0.0.7 → sqlleaf-0.0.8}/sqlleaf.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlleaf
3
- Version: 0.0.7
3
+ Version: 0.0.8
4
4
  Summary: Trace your data
5
5
  Author-email: zac <zac@sqlleaf.io>
6
6
  Project-URL: Homepage, https://github.com/sqlleaf-io/sqlleaf
@@ -8,7 +8,7 @@ Requires-Python: >=3.14
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: networkx==3.7
11
- Requires-Dist: sqlglot==30.23.0
11
+ Requires-Dist: sqlglot==30.30.0
12
12
  Dynamic: license-file
13
13
 
14
14
  # sqlleaf
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sqlleaf"
3
- version = "0.0.7"
3
+ version = "0.0.8"
4
4
  authors = [
5
5
  {name = "zac", email = "zac@sqlleaf.io"}
6
6
  ]
@@ -9,7 +9,7 @@ readme = "README.md"
9
9
  requires-python = ">=3.14"
10
10
  dependencies = [
11
11
  "networkx==3.7",
12
- "sqlglot==30.23.0",
12
+ "sqlglot==30.30.0",
13
13
  ]
14
14
 
15
15
  [dependency-groups]
@@ -2,4 +2,3 @@ from sqlleaf.lineage import Lineage as Lineage
2
2
  from sqlleaf.processors.collector.collector import collect_queries as collect_queries
3
3
  from sqlleaf.processors.generator.generator import generate_lineage_for_query as generate_lineage_for_query
4
4
  from sqlleaf.processors.transformer.transformer import transform_query as transform_query
5
- from sqlleaf.dialects import PlPgSQL
@@ -0,0 +1,8 @@
1
+ # Maps each dialect name to the module that registers its config or parser. Lazily imported for performance.
2
+ DIALECT_MODULES = {
3
+ "athena": "sqlleaf.dialects.athena.config",
4
+ "mysql": "sqlleaf.dialects.mysql.config",
5
+ "plpgsql": "sqlleaf.dialects.plpgsql.p_dialect",
6
+ "postgres": "sqlleaf.dialects.postgres.config",
7
+ "redshift": "sqlleaf.dialects.redshift.config",
8
+ }
@@ -1,9 +1,10 @@
1
1
  from sqlglot import exp
2
+ from sqlglot.dialects import athena
2
3
 
3
- from sqlleaf.dialects.base import BaseDialectSettings
4
+ from sqlleaf.dialects.base import DialectConfig
4
5
 
5
6
 
6
- class AthenaSettings(BaseDialectSettings):
7
+ class AthenaConfig(DialectConfig):
7
8
  DIALECT = "athena"
8
9
  DEFAULT_USER_CATALOG = "awsdatacatalog"
9
10
  DEFAULT_SYSTEM_CATALOG = ""
@@ -77,8 +78,15 @@ class AthenaSettings(BaseDialectSettings):
77
78
  }
78
79
 
79
80
  @property
80
- def system_columns(self) -> list[exp.ColumnDef]:
81
+ def SYSTEM_COLUMNS(self) -> list[exp.ColumnDef]:
81
82
  return [
82
83
  exp.ColumnDef(this=exp.to_identifier(name), kind=exp.DataType.build(kind, self.DIALECT))
83
84
  for name, kind in self.PSEUDOCOLUMNS.items()
84
85
  ]
86
+
87
+
88
+ # sqlglot is missing pseudocolumns for Athena
89
+ athena.Athena.PSEUDOCOLUMNS = {c.upper() for c in AthenaConfig.PSEUDOCOLUMNS.keys()}
90
+
91
+ # Prevents pseudocolumns from being included in 'SELECT *' expansions
92
+ athena.Athena.EXCLUDES_PSEUDOCOLUMNS_FROM_STAR = True
@@ -0,0 +1,86 @@
1
+ import importlib
2
+ import typing as t
3
+
4
+ import sqlglot
5
+ from sqlglot import Dialect, exp
6
+
7
+ from sqlleaf.dialects import DIALECT_MODULES
8
+
9
+
10
+ # Wrap a function parameter parser so that it also accepts IN, OUT, and INOUT parameter modes
11
+ def with_parameter_modes(parse_function_parameter: t.Callable) -> t.Callable:
12
+ def _parse_function_parameter(self) -> exp.Expr | None:
13
+ mode = self._match_texts(("INOUT", "IN", "OUT")) and self._prev.text.upper()
14
+ parameter = parse_function_parameter(self)
15
+ if mode and parameter:
16
+ parameter.append(
17
+ "constraints",
18
+ exp.InOutColumnConstraint(input_=mode in ("IN", "INOUT"), output=mode in ("OUT", "INOUT")),
19
+ )
20
+ return parameter
21
+
22
+ return _parse_function_parameter
23
+
24
+
25
+ class DialectConfig:
26
+ # A registry to store subclasses
27
+ _dialects = {}
28
+ DIALECT = ""
29
+ DEFAULT_USER_CATALOG = ""
30
+ DEFAULT_SYSTEM_CATALOG = ""
31
+ # The language of procedures that do not declare one explicitly
32
+ DEFAULT_PROCEDURE_LANGUAGE: str | None = None
33
+ # Metadata fields, keyed by their suffix (e.g. '$files' in 'my_table$files'), mapped to their column names and types
34
+ METADATA_FIELDS: dict[str, dict[str, str]] = {}
35
+
36
+ def __init_subclass__(cls, **kwargs):
37
+ """Automatically registers subclasses when they are defined."""
38
+ super().__init_subclass__(**kwargs)
39
+ if cls.DIALECT:
40
+ DialectConfig._dialects[cls.DIALECT] = cls
41
+
42
+ def __new__(cls, dialect: str) -> DialectConfig:
43
+ """Returns the config registered for the dialect name, or the base config if none is registered."""
44
+ if dialect in DIALECT_MODULES:
45
+ importlib.import_module(DIALECT_MODULES[dialect])
46
+ return super().__new__(DialectConfig._dialects.get(dialect, DialectConfig))
47
+
48
+ @property
49
+ def SYSTEM_COLUMNS(self) -> list[exp.ColumnDef]:
50
+ """
51
+ Represents system columns.
52
+ """
53
+ return []
54
+
55
+ @property
56
+ def SYSTEM_FUNCTIONS(self) -> dict[str, list[str]]:
57
+ """
58
+ Represents system functions.
59
+ """
60
+ return {}
61
+
62
+ def get_metadata_field(self, table_name: str) -> str | None:
63
+ """
64
+ Returns the metadata field of a table name (e.g. '$files' for 'my_table$files').
65
+ """
66
+ for suffix in self.METADATA_FIELDS:
67
+ if table_name.lower().endswith(suffix):
68
+ return suffix
69
+ return None
70
+
71
+ def get_metadata_field_column_defs(self, suffix: str) -> list[exp.ColumnDef]:
72
+ """
73
+ Returns the column definitions of the metadata table with the given field (e.g. '$files').
74
+ """
75
+ return [
76
+ exp.ColumnDef(this=exp.to_identifier(name), kind=exp.DataType.build(kind, self.DIALECT))
77
+ for name, kind in self.METADATA_FIELDS[suffix].items()
78
+ ]
79
+
80
+ class ParameterModeDialect(Dialect):
81
+ """
82
+ The generic dialect, which also accepts IN, OUT, and INOUT parameter modes in procedure parameters.
83
+ """
84
+
85
+ class Parser(sqlglot.Parser):
86
+ _parse_function_parameter = with_parameter_modes(sqlglot.Parser._parse_function_parameter)
@@ -0,0 +1,33 @@
1
+ from sqlglot import TokenType
2
+ from sqlglot.dialects.mysql import MySQL
3
+
4
+ from sqlleaf.dialects.base import DialectConfig, with_parameter_modes
5
+
6
+
7
+ class MySQLConfig(DialectConfig):
8
+ DIALECT = "mysql"
9
+ DEFAULT_PROCEDURE_LANGUAGE = "SQL"
10
+
11
+
12
+ # Monkeypatch sqlglot's MySQL parser so that MySQL procedure parameters also accept parameter modes
13
+ MySQL.Parser._parse_function_parameter = with_parameter_modes(MySQL.Parser._parse_function_parameter)
14
+
15
+
16
+ def _parse_user_defined_function_expression(self):
17
+ """
18
+ Parse a MySQL function body that starts with BEGIN as a block, so that every statement is kept inside the function
19
+ rather than only the first one.
20
+ """
21
+ if self._prev.token_type == TokenType.BEGIN:
22
+ return self._parse_block()
23
+ return _parse_user_defined_function_expression_default(self)
24
+
25
+
26
+ _parse_user_defined_function_expression_default = MySQL.Parser._parse_user_defined_function_expression
27
+ MySQL.Parser._parse_user_defined_function_expression = _parse_user_defined_function_expression
28
+
29
+ # Tokenize 'DECLARE' as a keyword so procedure variable declarations are parsed by sqlglot's declare parser rather than an exp.Column
30
+ MySQL.Tokenizer.KEYWORDS["DECLARE"] = TokenType.DECLARE
31
+
32
+ # MySQL supports 'SELECT ... INTO @var', so keep it as a SELECT rather than rewriting it to 'CREATE TABLE AS'
33
+ MySQL.Generator.SUPPORTS_SELECT_INTO = True
@@ -1,10 +1,10 @@
1
1
  from sqlglot import exp
2
2
  from sqlglot.dialects import postgres
3
3
 
4
- from sqlleaf.dialects.base import BaseDialectSettings
4
+ from sqlleaf.dialects.base import DialectConfig
5
5
 
6
6
 
7
- class PostgresSettings(BaseDialectSettings):
7
+ class PostgresConfig(DialectConfig):
8
8
  DIALECT = "postgres"
9
9
  DEFAULT_USER_CATALOG = "public"
10
10
  DEFAULT_SYSTEM_CATALOG = "pg_catalog"
@@ -19,14 +19,14 @@ class PostgresSettings(BaseDialectSettings):
19
19
  }
20
20
 
21
21
  @property
22
- def system_columns(self) -> list[exp.ColumnDef]:
22
+ def SYSTEM_COLUMNS(self) -> list[exp.ColumnDef]:
23
23
  return [
24
24
  exp.ColumnDef(this=exp.to_identifier(name), kind=exp.DataType.build(kind, self.DIALECT))
25
25
  for name, kind in self.PSEUDOCOLUMNS.items()
26
26
  ]
27
27
 
28
28
  @property
29
- def system_functions(self) -> dict[str, list[str]]:
29
+ def SYSTEM_FUNCTIONS(self) -> dict[str, list[str]]:
30
30
  """
31
31
  Map function names to their returned column names.
32
32
  """
@@ -48,7 +48,7 @@ class PostgresSettings(BaseDialectSettings):
48
48
 
49
49
 
50
50
  # sqlglot is missing pseudocolumns for Postgres
51
- postgres.Postgres.PSEUDOCOLUMNS = {c.upper() for c in PostgresSettings.PSEUDOCOLUMNS.keys()}
51
+ postgres.Postgres.PSEUDOCOLUMNS = {c.upper() for c in PostgresConfig.PSEUDOCOLUMNS.keys()}
52
52
 
53
53
  # Prevents pseudocolumns from being included in 'SELECT *' expansions
54
54
  postgres.Postgres.EXCLUDES_PSEUDOCOLUMNS_FROM_STAR = True
@@ -0,0 +1,12 @@
1
+ from sqlglot.dialects.redshift import Redshift
2
+
3
+ from sqlleaf.dialects.base import DialectConfig
4
+
5
+
6
+ class RedshiftConfig(DialectConfig):
7
+ DIALECT = "redshift"
8
+ DEFAULT_PROCEDURE_LANGUAGE = "PLPGSQL"
9
+
10
+
11
+ # Redshift supports 'SELECT ... INTO', so keep it as a SELECT rather than rewriting it to 'CREATE TABLE AS'
12
+ Redshift.Generator.SUPPORTS_SELECT_INTO = True
@@ -0,0 +1,94 @@
1
+ import logging
2
+ import sys
3
+ from enum import StrEnum, auto
4
+
5
+ logger = logging.getLogger("sqlleaf")
6
+
7
+ class ErrorLevel(StrEnum):
8
+ ERROR = auto()
9
+ WARN = auto()
10
+
11
+
12
+ ERROR_LEVEL = ErrorLevel.ERROR
13
+
14
+
15
+ def raise_error(cls: type, message: str):
16
+ """
17
+ Raise a custom exception based on the error level.
18
+ """
19
+ if ERROR_LEVEL == ErrorLevel.ERROR:
20
+ raise cls(message).with_traceback(None)
21
+ elif ERROR_LEVEL == ErrorLevel.WARN:
22
+ logger.error(message)
23
+
24
+
25
+ def set_error_action(action: str) -> None:
26
+ """
27
+ Set the error level for exceptions ('error' or 'warn').
28
+ """
29
+ if action not in {level.value for level in ErrorLevel}:
30
+ raise ValueError("The error action must be 'error' or 'warn'.")
31
+
32
+ global ERROR_LEVEL
33
+ ERROR_LEVEL = ErrorLevel(action)
34
+
35
+
36
+ class SqlGlotException(Exception):
37
+ def __init__(self, message, table=""):
38
+ super().__init__(message)
39
+
40
+ self.message = message
41
+
42
+ def __str__(self):
43
+ return "%s" % (self.message,)
44
+
45
+
46
+ class SqlLeafException(Exception):
47
+ def __init__(self, message):
48
+ super().__init__(message)
49
+
50
+ self.message = message
51
+
52
+ def __str__(self):
53
+ return "%s" % (self.message,)
54
+
55
+
56
+ class InvalidQueryError(SqlLeafException):
57
+ pass
58
+
59
+
60
+ class UnsupportedFeatureError(SqlLeafException):
61
+ pass
62
+
63
+
64
+ class MappingError(SqlLeafException):
65
+ pass
66
+
67
+
68
+ class GeneratorError(SqlLeafException):
69
+ pass
70
+
71
+
72
+ class GraphError(SqlLeafException):
73
+ pass
74
+
75
+ PRINT_FULL_EXCEPTION = False
76
+
77
+
78
+ def set_print_full_exception(enabled: bool) -> None:
79
+ """
80
+ Set whether uncaught exceptions print the full traceback instead of only the error type and message.
81
+ """
82
+ global PRINT_FULL_EXCEPTION
83
+ PRINT_FULL_EXCEPTION = enabled
84
+
85
+
86
+ def suppress_exception_message(kind, message, traceback):
87
+ if not PRINT_FULL_EXCEPTION and SqlLeafException in kind.__bases__:
88
+ # Short form
89
+ print('{0}: {1}'.format(kind.__name__, message))
90
+ else:
91
+ # Regular form
92
+ sys.__excepthook__(kind, message, traceback)
93
+
94
+ sys.excepthook = suppress_exception_message
@@ -2,7 +2,7 @@ import json
2
2
  import logging
3
3
  import typing as t
4
4
 
5
- import networkx as nx
5
+ from networkx import MultiDiGraph, descendants
6
6
 
7
7
  from sqlleaf import exception, mappings, path, util
8
8
  from sqlleaf.models.hook import Hook
@@ -25,13 +25,13 @@ class Lineage:
25
25
 
26
26
  def __init__(self):
27
27
  self.graph = new_graph() # The graph that contains all lineage
28
- self.subgraphs: list[nx.MultiDiGraph] = [] # The subgraphs that make up the main graph
28
+ self.subgraphs: list[MultiDiGraph] = [] # The subgraphs that make up the main graph
29
29
  self.paths: dict[str, list[LineagePath]] = {} # The paths throughout the graph
30
30
  self.collected_queries: collector.CollectQueryResult | None = None
31
31
  self.user_defined_hooks: list[Hook] = []
32
32
  self.object_mapping: mappings.ObjectMapping | None = None
33
33
 
34
- def generate(self, sql: str, dialect: str, on_error: str = "stop") -> None:
34
+ def generate(self, sql: str, dialect: str, on_error: str = "error") -> None:
35
35
  """
36
36
  Generate lineage for one or more SQL statements.
37
37
  """
@@ -58,7 +58,7 @@ class Lineage:
58
58
  self.merge_graph(graph)
59
59
  self.graph.graph["attrs"].add_query_to_graph(parent_holder)
60
60
 
61
- def merge_graph(self, subgraph: nx.MultiDiGraph) -> None:
61
+ def merge_graph(self, subgraph: MultiDiGraph) -> None:
62
62
  """
63
63
  Merge the subgraph into the main graph, and also track the individual subgraphs.
64
64
  """
@@ -224,7 +224,7 @@ class Lineage:
224
224
  # Swap the parent and child
225
225
  parent_name = edge_attrs.child.full_name
226
226
  child_name = edge_attrs.parent.full_name
227
- num_descendents_of_child = len(nx.descendants(g, child_name))
227
+ num_descendents_of_child = len(descendants(g, child_name))
228
228
 
229
229
  parent_node = g.nodes[parent_name]["attrs"]
230
230
  child_node = g.nodes[child_name]["attrs"]
@@ -307,8 +307,8 @@ class Lineage:
307
307
  self.object_mapping = mappings.ObjectMapping(dialect=dialect, object_loader=collector.SystemObjectLoader(dialect))
308
308
 
309
309
 
310
- def new_graph() -> nx.MultiDiGraph:
310
+ def new_graph() -> MultiDiGraph:
311
311
  """
312
312
  A graph has attributes along with its node and edges.
313
313
  """
314
- return nx.MultiDiGraph(attrs=GraphAttributes())
314
+ return MultiDiGraph(attrs=GraphAttributes())
@@ -11,8 +11,7 @@ from sqlglot.schema import nested_set
11
11
  from sqlglot.trie import new_trie
12
12
 
13
13
  from sqlleaf import exception, util
14
- from sqlleaf.dialects.base import BaseDialectSettings
15
- from sqlleaf.path import NodeIndex
14
+ from sqlleaf.dialects.base import DialectConfig
16
15
  from sqlleaf.models.query import (
17
16
  CallQuery,
18
17
  CTASQuery,
@@ -30,6 +29,7 @@ from sqlleaf.models.query import (
30
29
  UserDefinedFunctionQuery,
31
30
  ViewQuery,
32
31
  )
32
+ from sqlleaf.path import NodeIndex
33
33
 
34
34
  ColumnMapping = t.Union[dict, str, list]
35
35
  FunctionCallable = ProcedureQuery | UserDefinedFunctionQuery
@@ -37,25 +37,47 @@ FunctionCallable = ProcedureQuery | UserDefinedFunctionQuery
37
37
  logger = logging.getLogger("sqlleaf")
38
38
 
39
39
 
40
+ ParamMode = t.Literal["IN", "OUT", "INOUT"]
41
+
42
+
40
43
  @dataclass
41
44
  class ParamBinding:
42
45
  """One parameter's binding for the lifetime of a single CALL."""
43
46
 
44
47
  value: exp.Expr
48
+ mode: ParamMode
45
49
  arg_name: str | None = None
46
50
 
51
+ @property
52
+ def is_input(self) -> bool:
53
+ return self.mode in ("IN", "INOUT")
54
+
55
+ @property
56
+ def is_output(self) -> bool:
57
+ return self.mode in ("OUT", "INOUT")
58
+
47
59
 
48
60
  @dataclass
49
61
  class VariableScope:
50
- """One CALL boundary: its block stack and parameter bindings."""
62
+ """Holds variables related to one CALL statement.
63
+
64
+ The two are separated because they have different lifetimes:
65
+ - blocks are created and destroyed along with a BEGIN block
66
+ - bindings are kept across all blocks at its level and below
67
+ """
51
68
 
52
- blocks: list[dict[str, exp.Expr]] = field(default_factory=list)
69
+ # A stack of DECLARE/BEGIN blocks. Holds variable names mapped to their current values.
70
+ blocks: list[dict[str, exp.Expr]] = field(default_factory=lambda: [{}])
71
+ # Parameters passed to a CALL(). Holds parameter names mapped to their bound values. Used for OUT/INOUT write-back
53
72
  bindings: dict[str, ParamBinding] = field(default_factory=dict)
54
73
 
55
74
 
56
75
  class Variables:
76
+ """
77
+ Tracks the state of every variable currently available to SQL statements.
78
+ """
57
79
  def __init__(self):
58
- # The base scope runs DO / top-level code and is never popped
80
+ # An initial scope exists for the top-level statements
59
81
  self.scopes: list[VariableScope] = [VariableScope()]
60
82
 
61
83
  @property
@@ -66,7 +88,6 @@ class Variables:
66
88
  def _active_bindings(self) -> dict[str, ParamBinding]:
67
89
  return self.scopes[-1].bindings
68
90
 
69
- # ---- Block API ----
70
91
  def push_block(self) -> None:
71
92
  """Enter a new DECLARE/BEGIN block."""
72
93
  self._active_blocks.append({})
@@ -76,7 +97,6 @@ class Variables:
76
97
  if self._active_blocks:
77
98
  self._active_blocks.pop()
78
99
 
79
- # ---- Scope API ----
80
100
  def push_scope(self, bindings: dict[str, ParamBinding]) -> None:
81
101
  """Enter a CALL boundary."""
82
102
  self.scopes.append(VariableScope(bindings=bindings))
@@ -88,7 +108,7 @@ class Variables:
88
108
  scope = self.scopes.pop()
89
109
  if write_back:
90
110
  for binding in scope.bindings.values():
91
- if binding.arg_name is not None:
111
+ if binding.is_output and binding.arg_name is not None:
92
112
  self.set_variable(binding.arg_name, binding.value)
93
113
 
94
114
  def declare_variable(self, name: str, value: exp.Expr | None = None) -> None:
@@ -97,8 +117,10 @@ class Variables:
97
117
  self._active_blocks[-1][name] = val
98
118
  logger.debug(f"Declared variable: {name} := {val}")
99
119
 
100
- def set_variable(self, name: str, value: exp.Expr) -> None:
101
- """Assign a variable in the nearest block where it was declared."""
120
+ def set_variable(self, name: str, value: exp.Expr, declare: bool = False) -> None:
121
+ """
122
+ Assign a variable in the nearest block where it was declared.
123
+ """
102
124
  for block in reversed(self._active_blocks):
103
125
  if name in block:
104
126
  block[name] = value
@@ -110,6 +132,10 @@ class Variables:
110
132
  binding.value = value
111
133
  return
112
134
 
135
+ if declare:
136
+ self.declare_variable(name, value)
137
+ return
138
+
113
139
  raise exception.MappingError(f'"{name}" is not a known variable')
114
140
 
115
141
  def get_variable(self, name: str, raise_on_missing: bool = True) -> exp.Expr | None:
@@ -124,6 +150,10 @@ class Variables:
124
150
  raise exception.MappingError(f"Could not find value for variable: {name}")
125
151
  return None
126
152
 
153
+ def get_variables(self) -> dict[str, exp.Expr]:
154
+ """Get all variables currently visible."""
155
+ return self.get_scope()
156
+
127
157
  def get_variables_for(self, expressions: list[exp.Expr]) -> list[exp.Expr]:
128
158
  """
129
159
  Given a list of expressions as keys, fetch their values from the variable scope if they exist.
@@ -168,14 +198,13 @@ class ObjectMapping(MappingSchema):
168
198
  ) # Set `normalize=False` to prevent an unnecessary second parse.
169
199
  self.kind_mapping = {}
170
200
  self.kind_mapping_trie = {}
171
- settings = BaseDialectSettings.from_dialect(dialect)
201
+ config = DialectConfig(dialect)
172
202
  # The catalog that unqualified user objects are created in, and the one holding system objects
173
- self.current_user_catalog: str = settings.DEFAULT_USER_CATALOG
174
- self.current_system_catalog: str = settings.DEFAULT_SYSTEM_CATALOG
203
+ self.current_user_catalog: str = config.DEFAULT_USER_CATALOG
204
+ self.current_system_catalog: str = config.DEFAULT_SYSTEM_CATALOG
205
+ self.current_database: str | None = None # For MySQL
175
206
  # Load system objects lazily from disk
176
207
  self.system_object_loader = object_loader
177
- # Session/global variables (e.g., SET var = ...)
178
- self.session_variables: dict[str, exp.Expr] = {}
179
208
  self.variables = Variables()
180
209
  # Nodes that have been added to the graph, indexed by class
181
210
  self.node_index = NodeIndex()
@@ -392,8 +421,9 @@ class ObjectMapping(MappingSchema):
392
421
  else:
393
422
  knd = "CREATE " + {"udf": "FUNCTION"}.get(kind, kind).upper()
394
423
 
395
- raise exception.MappingError(
396
- f"Could not find '{object.this}' of type '{kind}' in mapping. Did you forget to define a '{knd}' statement?"
424
+ raise exception.raise_error(
425
+ exception.MappingError,
426
+ f"Could not find {kind} '{object.this}'. Did you forget to define a '{knd}' statement?",
397
427
  )
398
428
  return None
399
429
 
@@ -457,9 +487,7 @@ class ObjectMapping(MappingSchema):
457
487
 
458
488
  return resolve_overloaded_function(node, candidates)
459
489
 
460
- def lookup_procedure_call(
461
- self, node: CallQuery, args: list[exp.Expr] | None = None
462
- ) -> ProcedureQuery | None:
490
+ def lookup_procedure_call(self, node: CallQuery, args: list[exp.Expr] | None = None) -> ProcedureQuery | None:
463
491
  """
464
492
  Looks up the procedure definition for a CALL statement.
465
493
  Returns the matched procedure definition, or None if no procedure with that name exists.
@@ -5,7 +5,7 @@ import logging
5
5
  import typing as t
6
6
  from dataclasses import InitVar, dataclass
7
7
 
8
- import networkx as nx
8
+ from networkx import MultiDiGraph
9
9
  from sqlglot import exp
10
10
  from sqlglot.optimizer import Scope, traverse_scope
11
11
 
@@ -65,7 +65,7 @@ Holds all the information required to generate lineage for an expression.
65
65
  """
66
66
  @dataclass(frozen=True)
67
67
  class GeneratorContext[Q, N]:
68
- graph: nx.MultiDiGraph
68
+ graph: MultiDiGraph
69
69
  query: Q
70
70
  expr: exp.Expr
71
71
  scope: TableOrScopeType
@@ -34,6 +34,7 @@ from sqlleaf.models.query.sequence import SequenceQuery as SequenceQuery
34
34
  from sqlleaf.models.query.set import SetQuery as SetQuery
35
35
  from sqlleaf.models.query.stage import StageQuery as StageQuery
36
36
  from sqlleaf.models.query.table import TableQuery as TableQuery
37
+ from sqlleaf.models.query.use import UseQuery as UseQuery
37
38
  from sqlleaf.models.query.trigger import TriggerQuery as TriggerQuery
38
39
  from sqlleaf.models.query.type import TypeQuery as TypeQuery
39
40
  from sqlleaf.models.query.unload import UnloadQuery as UnloadQuery
@@ -83,6 +84,7 @@ __all__ = [
83
84
  "SetQuery",
84
85
  "StageQuery",
85
86
  "TableQuery",
87
+ "UseQuery",
86
88
  "TriggerQuery",
87
89
  "TypeQuery",
88
90
  "UnloadQuery",
@@ -134,8 +134,8 @@ class Query:
134
134
  """
135
135
  Compute the source and target expressions for a query.
136
136
  """
137
- source_exprs: list[exp.Expr] = []
138
- target_exprs: list[exp.Expr] = []
137
+ source_exprs: t.Sequence[exp.Expr] = []
138
+ target_exprs: t.Sequence[exp.Expr] = []
139
139
 
140
140
  if source_info and source_info.type == SqlObjectType.SET and isinstance(source_info.expression, list):
141
141
  # UPDATE .. SET a = 1: the right-hand side is the source, the left-hand column is the target
@@ -166,12 +166,18 @@ class Query:
166
166
  exp.ColumnDef(this=exp.to_identifier(col.alias_or_name), kind=col.unalias().type)
167
167
  for col in source_exprs
168
168
  ]
169
+ elif target_info.type == SqlObjectType.TABLE and not target_exprs and source_info.type == SqlObjectType.SELECT:
170
+ # SELECT .. INTO <new table>: the new table's columns are the projections of the select
171
+ target_exprs = [
172
+ exp.ColumnDef(this=exp.to_identifier(col.alias_or_name), kind=col.unalias().type)
173
+ for col in source_exprs
174
+ ]
169
175
 
170
176
  source_info = dataclasses.replace(source_info, expressions=source_exprs) if source_info else None
171
177
  target_info = dataclasses.replace(target_info, expressions=target_exprs) if target_info else None
172
178
  return source_info, target_info
173
179
 
174
- def _get_table_column_copies(self, table: exp.Table | exp.Var | exp.Schema) -> list[exp.Expr]:
180
+ def _get_table_column_copies(self, table: exp.Table | exp.Var | exp.Schema) -> list[exp.ColumnDef]:
175
181
  """
176
182
  Return copies of a table's columns, so that the object mapping is never aliased.
177
183
  """
@@ -1,13 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
- import typing as t
4
-
5
3
  from sqlglot import exp
6
4
 
7
5
  from sqlleaf import mappings, util
8
6
  from sqlleaf.models.query.base import Query
9
7
  from sqlleaf.models.query.table import TableQuery
10
8
  from sqlleaf.typing import SourceInfo, TargetInfo
9
+ from sqlleaf.util import validate_athena_table_options
11
10
 
12
11
 
13
12
  class CTASQuery(Query):
@@ -22,6 +21,8 @@ class CTASQuery(Query):
22
21
  system_columns: list[exp.ColumnDef],
23
22
  statement_index: int,
24
23
  ):
24
+ validate_athena_table_options(expr, dialect, is_ctas=True)
25
+
25
26
  source = expr.expression
26
27
  if source is None:
27
28
  if exec_prop := expr.find(exp.ExecuteAsProperty):