sqlframe 3.17.1__py3-none-any.whl → 3.18.1__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.
sqlframe/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '3.17.1'
16
- __version_tuple__ = version_tuple = (3, 17, 1)
15
+ __version__ = version = '3.18.1'
16
+ __version_tuple__ = version_tuple = (3, 18, 1)
@@ -23,7 +23,6 @@ from sqlglot import lineage as sqlglot_lineage
23
23
  from sqlglot.helper import ensure_list, flatten, object_to_dict, seq_get
24
24
  from sqlglot.optimizer.pushdown_projections import pushdown_projections
25
25
  from sqlglot.optimizer.qualify import qualify
26
- from sqlglot.optimizer.qualify_columns import quote_identifiers
27
26
 
28
27
  from sqlframe.base.catalog import Column as CatalogColumn
29
28
  from sqlframe.base.operations import Operation, operation
@@ -616,6 +615,7 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
616
615
  self,
617
616
  optimize: bool = True,
618
617
  openai_config: t.Optional[t.Union[t.Dict[str, t.Any], OpenAIConfig]] = None,
618
+ quote_identifiers: bool = True,
619
619
  ) -> t.List[exp.Expression]:
620
620
  df = self._resolve_pending_hints()
621
621
  select_expressions = df._get_select_expressions()
@@ -644,7 +644,7 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
644
644
  if optimize:
645
645
  select_expression = t.cast(
646
646
  exp.Select,
647
- self.session._optimize(select_expression),
647
+ self.session._optimize(select_expression, quote_identifiers=quote_identifiers),
648
648
  )
649
649
  elif openai_config:
650
650
  qualify(
@@ -713,8 +713,9 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
713
713
  dialect: DialectType = ...,
714
714
  optimize: bool = ...,
715
715
  pretty: bool = ...,
716
+ quote_identifiers: bool = ...,
716
717
  *,
717
- as_list: t.Literal[False],
718
+ as_list: t.Literal[False] = False,
718
719
  **kwargs: t.Any,
719
720
  ) -> str: ...
720
721
 
@@ -724,6 +725,7 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
724
725
  dialect: DialectType = ...,
725
726
  optimize: bool = ...,
726
727
  pretty: bool = ...,
728
+ quote_identifiers: bool = ...,
727
729
  *,
728
730
  as_list: t.Literal[True],
729
731
  **kwargs: t.Any,
@@ -734,14 +736,23 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
734
736
  dialect: DialectType = None,
735
737
  optimize: bool = True,
736
738
  pretty: bool = True,
739
+ quote_identifiers: bool = True,
737
740
  openai_config: t.Optional[t.Union[t.Dict[str, t.Any], OpenAIConfig]] = None,
738
741
  as_list: bool = False,
739
742
  **kwargs,
740
743
  ) -> t.Union[str, t.List[str]]:
741
744
  dialect = Dialect.get_or_raise(dialect) if dialect else self.session.output_dialect
742
745
  results = []
743
- for expression in self._get_expressions(optimize=optimize, openai_config=openai_config):
744
- sql = self.session._to_sql(expression, dialect=dialect, pretty=pretty, **kwargs)
746
+ for expression in self._get_expressions(
747
+ optimize=optimize, openai_config=openai_config, quote_identifiers=quote_identifiers
748
+ ):
749
+ sql = self.session._to_sql(
750
+ expression,
751
+ dialect=dialect,
752
+ pretty=pretty,
753
+ quote_identifiers=quote_identifiers,
754
+ **kwargs,
755
+ )
745
756
  if openai_config:
746
757
  assert isinstance(openai_config, OpenAIConfig)
747
758
  verify_openai_installed()
@@ -1055,7 +1066,7 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
1055
1066
  left_col.sql(dialect=self.session.input_dialect),
1056
1067
  right_col.sql(dialect=self.session.input_dialect),
1057
1068
  ).alias(left_col.alias_or_name)
1058
- if how == "full"
1069
+ if join_type == "full outer"
1059
1070
  else left_col.alias_or_name
1060
1071
  for left_col, right_col in join_column_pairs
1061
1072
  ]
sqlframe/base/session.py CHANGED
@@ -16,6 +16,7 @@ from sqlglot import Dialect, exp
16
16
  from sqlglot.dialects.dialect import DialectType, NormalizationStrategy
17
17
  from sqlglot.expressions import parse_identifier
18
18
  from sqlglot.helper import ensure_list, seq_get
19
+ from sqlglot.optimizer import RULES as OPTIMIZER_RULES
19
20
  from sqlglot.optimizer import optimize
20
21
  from sqlglot.optimizer.normalize_identifiers import normalize_identifiers
21
22
  from sqlglot.optimizer.qualify import qualify as qualify_func
@@ -556,6 +557,7 @@ class _BaseSession(t.Generic[CATALOG, READER, WRITER, DF, TABLE, CONN, UDF_REGIS
556
557
  dialect: DialectType = None,
557
558
  quote_identifiers: bool = True,
558
559
  pretty: bool = False,
560
+ **kwargs,
559
561
  ) -> str:
560
562
  return normalize_string(
561
563
  sql,
@@ -574,9 +576,19 @@ class _BaseSession(t.Generic[CATALOG, READER, WRITER, DF, TABLE, CONN, UDF_REGIS
574
576
  ) -> exp.Expression:
575
577
  dialect = dialect or self.input_dialect
576
578
  normalize_identifiers(expression, dialect=dialect)
579
+ rules = list(OPTIMIZER_RULES)
577
580
  if quote_identifiers:
578
581
  quote_identifiers_func(expression, dialect=dialect)
579
- return optimize(expression, dialect=dialect, schema=self.catalog._schema, infer_schema=True)
582
+ else:
583
+ rules.remove(quote_identifiers_func)
584
+ return optimize(
585
+ expression,
586
+ dialect=dialect,
587
+ schema=self.catalog._schema,
588
+ infer_schema=True,
589
+ quote_identifiers=quote_identifiers,
590
+ rules=rules, # type: ignore
591
+ )
580
592
 
581
593
  def _execute(self, sql: str) -> None:
582
594
  self._cur.execute(sql)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlframe
3
- Version: 3.17.1
3
+ Version: 3.18.1
4
4
  Summary: Turning PySpark Into a Universal DataFrame API
5
5
  Home-page: https://github.com/eakmanrq/sqlframe
6
6
  Author: Ryan Eakman
@@ -1,10 +1,10 @@
1
1
  sqlframe/__init__.py,sha256=wfqm98eLoLid9oV_FzzpG5loKC6LxOhj2lXpfN7SARo,3138
2
- sqlframe/_version.py,sha256=c661E5W7jBk0KLcY4zPGbS19JVM6PufmNidbT4Hw5Ok,413
2
+ sqlframe/_version.py,sha256=JmEzWKZLlLojC8WbH3nhT4nosf_YSBJc7WQO-Nt017Q,413
3
3
  sqlframe/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  sqlframe/base/_typing.py,sha256=b2clI5HI1zEZKB_3Msx3FeAJQyft44ubUifJwQRVXyQ,1298
5
5
  sqlframe/base/catalog.py,sha256=SzFQalTWdhWzxUY-4ut1f9TfOECp_JmJEgNPfrRKCe0,38457
6
6
  sqlframe/base/column.py,sha256=oHVwkSWABO3ZlAbgBShsxSSlgbI06BOup5XJrRhgqJI,18097
7
- sqlframe/base/dataframe.py,sha256=KcB9HhnXuPojHOpksvYwmgIwcXUD6g9--EEvEBytDuY,79010
7
+ sqlframe/base/dataframe.py,sha256=mKXbIKYiKH5mh6qj0Dg7L_znmCL85q9kHlmHtCW4kJ4,79352
8
8
  sqlframe/base/decorators.py,sha256=ms-CvDOIW3T8IVB9VqDmLwAiaEsqXLYRXEqVQaxktiM,1890
9
9
  sqlframe/base/exceptions.py,sha256=9Uwvqn2eAkDpqm4BrRgbL61qM-GMCbJEMAW8otxO46s,370
10
10
  sqlframe/base/function_alternatives.py,sha256=NV31IaEhVYmfUSWetAEFISAvLzs2DxQ7bp-iMNgj0hQ,53786
@@ -13,7 +13,7 @@ sqlframe/base/group.py,sha256=fsyG5990_Pd7gFPjTFrH9IEoAquL_wEkVpIlBAIkZJU,4091
13
13
  sqlframe/base/normalize.py,sha256=nXAJ5CwxVf4DV0GsH-q1w0p8gmjSMlv96k_ez1eVul8,3880
14
14
  sqlframe/base/operations.py,sha256=xSPw74e59wYvNd6U1AlwziNCTG6Aftrbl4SybN9u9VE,3450
15
15
  sqlframe/base/readerwriter.py,sha256=w8926cqIrXF7NGHiINw5UHzP_3xpjsqbijTBTzycBRM,26605
16
- sqlframe/base/session.py,sha256=gvg_yZaivR0N6Kyo3tiUitoTc9NSYekGp0-x-fPhAqA,26967
16
+ sqlframe/base/session.py,sha256=aSp83JXEW_zEMfe1JxPFcjqq2yUThwYboCnk0LqhUko,27290
17
17
  sqlframe/base/table.py,sha256=rCeh1W5SWbtEVfkLAUiexzrZwNgmZeptLEmLcM1ABkE,6961
18
18
  sqlframe/base/transforms.py,sha256=y0j3SGDz3XCmNGrvassk1S-owllUWfkHyMgZlY6SFO4,467
19
19
  sqlframe/base/types.py,sha256=iBNk9bpFtb2NBIogYS8i7OlQZMRvpR6XxqzBebsjQDU,12280
@@ -129,8 +129,8 @@ sqlframe/standalone/udf.py,sha256=azmgtUjHNIPs0WMVNId05SHwiYn41MKVBhKXsQJ5dmY,27
129
129
  sqlframe/standalone/window.py,sha256=6GKPzuxeSapJakBaKBeT9VpED1ACdjggDv9JRILDyV0,35
130
130
  sqlframe/testing/__init__.py,sha256=VVCosQhitU74A3NnE52O4mNtGZONapuEXcc20QmSlnQ,132
131
131
  sqlframe/testing/utils.py,sha256=PFsGZpwNUE_4-g_f43_vstTqsK0AQ2lBneb5Eb6NkFo,13008
132
- sqlframe-3.17.1.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
133
- sqlframe-3.17.1.dist-info/METADATA,sha256=7YgdpN6-xqFqBAQlqR5V8IaeByzgFlcW9aQl1fG8Ey0,8970
134
- sqlframe-3.17.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
135
- sqlframe-3.17.1.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
136
- sqlframe-3.17.1.dist-info/RECORD,,
132
+ sqlframe-3.18.1.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
133
+ sqlframe-3.18.1.dist-info/METADATA,sha256=4WPETWw1JyvNuEWecY3n3KbkMcU1nDtgRkdzXKxKoBU,8970
134
+ sqlframe-3.18.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
135
+ sqlframe-3.18.1.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
136
+ sqlframe-3.18.1.dist-info/RECORD,,