pytrilogy 0.0.1.105__py3-none-any.whl → 0.0.1.107__py3-none-any.whl
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.
Potentially problematic release.
This version of pytrilogy might be problematic. Click here for more details.
- {pytrilogy-0.0.1.105.dist-info → pytrilogy-0.0.1.107.dist-info}/METADATA +79 -1
- {pytrilogy-0.0.1.105.dist-info → pytrilogy-0.0.1.107.dist-info}/RECORD +26 -25
- {pytrilogy-0.0.1.105.dist-info → pytrilogy-0.0.1.107.dist-info}/WHEEL +1 -1
- trilogy/__init__.py +3 -2
- trilogy/constants.py +1 -0
- trilogy/core/models.py +128 -31
- trilogy/core/optimization.py +141 -0
- trilogy/core/processing/nodes/base_node.py +4 -2
- trilogy/core/processing/nodes/group_node.py +5 -2
- trilogy/core/processing/nodes/merge_node.py +13 -8
- trilogy/core/query_processor.py +5 -2
- trilogy/dialect/base.py +73 -51
- trilogy/dialect/bigquery.py +6 -4
- trilogy/dialect/common.py +8 -6
- trilogy/dialect/config.py +69 -1
- trilogy/dialect/duckdb.py +5 -4
- trilogy/dialect/enums.py +40 -19
- trilogy/dialect/postgres.py +4 -2
- trilogy/dialect/presto.py +6 -4
- trilogy/dialect/snowflake.py +6 -4
- trilogy/dialect/sql_server.py +4 -1
- trilogy/executor.py +18 -5
- trilogy/parsing/parse_engine.py +1 -1
- {pytrilogy-0.0.1.105.dist-info → pytrilogy-0.0.1.107.dist-info}/LICENSE.md +0 -0
- {pytrilogy-0.0.1.105.dist-info → pytrilogy-0.0.1.107.dist-info}/entry_points.txt +0 -0
- {pytrilogy-0.0.1.105.dist-info → pytrilogy-0.0.1.107.dist-info}/top_level.txt +0 -0
trilogy/executor.py
CHANGED
|
@@ -99,7 +99,14 @@ class Executor(object):
|
|
|
99
99
|
raise NotImplementedError("Cannot execute type {}".format(type(query)))
|
|
100
100
|
|
|
101
101
|
@execute_query.register
|
|
102
|
-
def _(self, query: SelectStatement
|
|
102
|
+
def _(self, query: SelectStatement) -> CursorResult:
|
|
103
|
+
sql = self.generator.generate_queries(
|
|
104
|
+
self.environment, [query], hooks=self.hooks
|
|
105
|
+
)
|
|
106
|
+
return self.execute_query(sql[0])
|
|
107
|
+
|
|
108
|
+
@execute_query.register
|
|
109
|
+
def _(self, query: PersistStatement) -> CursorResult:
|
|
103
110
|
sql = self.generator.generate_queries(
|
|
104
111
|
self.environment, [query], hooks=self.hooks
|
|
105
112
|
)
|
|
@@ -117,16 +124,22 @@ class Executor(object):
|
|
|
117
124
|
)
|
|
118
125
|
|
|
119
126
|
@execute_query.register
|
|
120
|
-
def _(self, query: ProcessedQuery
|
|
127
|
+
def _(self, query: ProcessedQuery) -> CursorResult:
|
|
128
|
+
sql = self.generator.compile_statement(query)
|
|
129
|
+
# connection = self.engine.connect()
|
|
130
|
+
output = self.connection.execute(text(sql))
|
|
131
|
+
return output
|
|
132
|
+
|
|
133
|
+
@execute_query.register
|
|
134
|
+
def _(self, query: ProcessedQueryPersist) -> CursorResult:
|
|
121
135
|
sql = self.generator.compile_statement(query)
|
|
122
136
|
# connection = self.engine.connect()
|
|
123
137
|
output = self.connection.execute(text(sql))
|
|
124
|
-
|
|
125
|
-
self.environment.add_datasource(query.datasource)
|
|
138
|
+
self.environment.add_datasource(query.datasource)
|
|
126
139
|
return output
|
|
127
140
|
|
|
128
141
|
@singledispatchmethod
|
|
129
|
-
def generate_sql(self, command
|
|
142
|
+
def generate_sql(self, command) -> list[str]:
|
|
130
143
|
raise NotImplementedError(
|
|
131
144
|
"Cannot generate sql for type {}".format(type(command))
|
|
132
145
|
)
|
trilogy/parsing/parse_engine.py
CHANGED
|
@@ -864,7 +864,7 @@ class ParseToObjects(Transformer):
|
|
|
864
864
|
elif isinstance(val, Grain):
|
|
865
865
|
grain = val
|
|
866
866
|
elif isinstance(val, Query):
|
|
867
|
-
address = Address(location=f"({val.text})")
|
|
867
|
+
address = Address(location=f"({val.text})", is_query=True)
|
|
868
868
|
if not address:
|
|
869
869
|
raise ValueError(
|
|
870
870
|
"Malformed datasource, missing address or query declaration"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|