ydb-sqlglot-plugin 0.2.6__tar.gz → 0.2.7__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.
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/PKG-INFO +1 -1
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/pyproject.toml +1 -1
- ydb_sqlglot_plugin-0.2.7/ydb_sqlglot/version.py +1 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot/ydb.py +4 -35
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/PKG-INFO +1 -1
- ydb_sqlglot_plugin-0.2.6/ydb_sqlglot/version.py +0 -1
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/LICENSE +0 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/README.md +0 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/setup.cfg +0 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot/__init__.py +0 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/SOURCES.txt +0 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/dependency_links.txt +0 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/entry_points.txt +0 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/requires.txt +0 -0
- {ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.2.7"
|
|
@@ -1532,31 +1532,6 @@ class YDB(Dialect):
|
|
|
1532
1532
|
return None
|
|
1533
1533
|
return super()._parse_table_alias(alias_tokens=alias_tokens)
|
|
1534
1534
|
|
|
1535
|
-
def _normalize_ydb_table_path(self, table: exp.Expression) -> exp.Expression:
|
|
1536
|
-
if not isinstance(table, exp.Table):
|
|
1537
|
-
return table
|
|
1538
|
-
|
|
1539
|
-
identifier = table.this
|
|
1540
|
-
if not isinstance(identifier, exp.Identifier) or table.catalog:
|
|
1541
|
-
return table
|
|
1542
|
-
|
|
1543
|
-
path = identifier.this
|
|
1544
|
-
if "/" not in path:
|
|
1545
|
-
if table.db:
|
|
1546
|
-
table.set("catalog", table.args.get("db"))
|
|
1547
|
-
table.set("db", None)
|
|
1548
|
-
return table
|
|
1549
|
-
|
|
1550
|
-
schema, name = path.rsplit("/", 1)
|
|
1551
|
-
if not schema or not name:
|
|
1552
|
-
return table
|
|
1553
|
-
|
|
1554
|
-
if table.db:
|
|
1555
|
-
table.set("catalog", table.args.get("db"))
|
|
1556
|
-
table.set("db", exp.to_identifier(schema, quoted=True))
|
|
1557
|
-
table.set("this", exp.to_identifier(name, quoted=True))
|
|
1558
|
-
return table
|
|
1559
|
-
|
|
1560
1535
|
def _parse_table_hints(self) -> t.Optional[t.List[exp.Expression]]:
|
|
1561
1536
|
if not (self._curr and self._curr.token_type == TokenType.WITH):
|
|
1562
1537
|
return super()._parse_table_hints()
|
|
@@ -1870,9 +1845,9 @@ class YDB(Dialect):
|
|
|
1870
1845
|
parts.append(self._curr.text)
|
|
1871
1846
|
self._advance()
|
|
1872
1847
|
self._match(TokenType.R_BRACKET)
|
|
1873
|
-
table = self.expression(exp.Table(this=exp.to_identifier("".join(parts)
|
|
1848
|
+
table = self.expression(exp.Table(this=exp.to_identifier("".join(parts))))
|
|
1874
1849
|
table.set("alias", self._parse_table_alias())
|
|
1875
|
-
return
|
|
1850
|
+
return table
|
|
1876
1851
|
|
|
1877
1852
|
table = super()._parse_table(*args, **kwargs)
|
|
1878
1853
|
if (
|
|
@@ -1886,8 +1861,6 @@ class YDB(Dialect):
|
|
|
1886
1861
|
param = self._parse_parameter()
|
|
1887
1862
|
table = self.expression(exp.Table(this=param))
|
|
1888
1863
|
table.set("alias", self._parse_table_alias())
|
|
1889
|
-
if table:
|
|
1890
|
-
table = self._normalize_ydb_table_path(table)
|
|
1891
1864
|
if table and self._match(TokenType.VIEW):
|
|
1892
1865
|
table.set("ydb_index_view", self._parse_id_var(any_token=True))
|
|
1893
1866
|
explicit_alias = bool(self._curr and self._curr.token_type == TokenType.ALIAS)
|
|
@@ -2439,12 +2412,8 @@ class YDB(Dialect):
|
|
|
2439
2412
|
if expression.alias:
|
|
2440
2413
|
sql += f" AS {expression.alias}"
|
|
2441
2414
|
return _with_table_joins(sql)
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
table_identifier = f"`{path}`" if expression.db else self.sql(expression, "this")
|
|
2445
|
-
sql = f"{expression.catalog}.{table_identifier}"
|
|
2446
|
-
else:
|
|
2447
|
-
sql = f"`{path}`"
|
|
2415
|
+
prefix = f"{expression.db}/" if expression.db else ""
|
|
2416
|
+
sql = f"`{prefix}{expression.name}`"
|
|
2448
2417
|
|
|
2449
2418
|
ydb_index_view = self.sql(expression, "ydb_index_view")
|
|
2450
2419
|
if ydb_index_view:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.2.6"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/requires.txt
RENAMED
|
File without changes
|
{ydb_sqlglot_plugin-0.2.6 → ydb_sqlglot_plugin-0.2.7}/ydb_sqlglot_plugin.egg-info/top_level.txt
RENAMED
|
File without changes
|