sqlframe 3.24.0__py3-none-any.whl → 3.25.0__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
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '3.24.0'
21
- __version_tuple__ = version_tuple = (3, 24, 0)
20
+ __version__ = version = '3.25.0'
21
+ __version_tuple__ = version_tuple = (3, 25, 0)
@@ -355,6 +355,10 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
355
355
  "This engine does not support schema inference likely since it does not have an active connection."
356
356
  ) from e
357
357
 
358
+ @property
359
+ def sparkSession(self) -> SESSION:
360
+ return self.session
361
+
358
362
  def _replace_cte_names_with_hashes(self, expression: exp.Select):
359
363
  replacement_mapping = {}
360
364
  for cte in expression.ctes:
@@ -2360,10 +2360,26 @@ def from_json(
2360
2360
  return Column.invoke_anonymous_function(col, "FROM_JSON", schema)
2361
2361
 
2362
2362
 
2363
- @meta(unsupported_engines=["bigquery", "duckdb", "postgres", "snowflake"])
2363
+ @meta(unsupported_engines=["bigquery", "postgres", "snowflake"])
2364
2364
  def to_json(col: ColumnOrName, options: t.Optional[t.Dict[str, str]] = None) -> Column:
2365
+ session = _get_session()
2366
+ if session._is_duckdb:
2367
+ # check if Spark options match DuckDB's default behavior
2368
+ is_spark_equivalent = (
2369
+ options
2370
+ and list(options.keys()) == ["ignoreNullFields"] # only one option specified
2371
+ and str(options.get("ignoreNullFields", "true")).lower() == "false"
2372
+ )
2373
+ if not is_spark_equivalent:
2374
+ logger.warning(
2375
+ "Options for `to_json()` ignored, since not supported in this dialect."
2376
+ + " Potential `null` values are included in the returned JSON string."
2377
+ + " This is different from Spark's default behavior."
2378
+ )
2379
+ options = None
2380
+
2365
2381
  if options is not None:
2366
- options_col = create_map([lit(x) for x in _flatten(options.items())])
2382
+ options_col = create_map([lit(str(x)) for x in _flatten(options.items())])
2367
2383
  return Column.invoke_expression_over_column(col, expression.JSONFormat, options=options_col)
2368
2384
  return Column.invoke_expression_over_column(col, expression.JSONFormat)
2369
2385
 
@@ -194,6 +194,7 @@ from sqlframe.base.functions import sumDistinct as sumDistinct
194
194
  from sqlframe.base.functions import tan as tan
195
195
  from sqlframe.base.functions import timestamp_seconds as timestamp_seconds
196
196
  from sqlframe.base.functions import to_date as to_date
197
+ from sqlframe.base.functions import to_json as to_json
197
198
  from sqlframe.base.functions import to_timestamp as to_timestamp
198
199
  from sqlframe.base.functions import to_unix_timestamp as to_unix_timestamp
199
200
  from sqlframe.base.functions import toDegrees as toDegrees
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlframe
3
- Version: 3.24.0
3
+ Version: 3.25.0
4
4
  Summary: Turning PySpark Into a Universal DataFrame API
5
5
  Home-page: https://github.com/eakmanrq/sqlframe
6
6
  Author: Ryan Eakman
@@ -17,7 +17,7 @@ Requires-Python: >=3.9
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: prettytable <4
20
- Requires-Dist: sqlglot <26.10,>=24.0.0
20
+ Requires-Dist: sqlglot <26.12,>=24.0.0
21
21
  Requires-Dist: typing-extensions
22
22
  Provides-Extra: bigquery
23
23
  Requires-Dist: google-cloud-bigquery-storage <3,>=2 ; extra == 'bigquery'
@@ -39,7 +39,7 @@ Requires-Dist: pytest-forked ; extra == 'dev'
39
39
  Requires-Dist: pytest-postgresql <8,>=6 ; extra == 'dev'
40
40
  Requires-Dist: pytest-xdist <3.7,>=3.6 ; extra == 'dev'
41
41
  Requires-Dist: pytest <8.4,>=8.2.0 ; extra == 'dev'
42
- Requires-Dist: ruff <0.10,>=0.4.4 ; extra == 'dev'
42
+ Requires-Dist: ruff <0.12,>=0.4.4 ; extra == 'dev'
43
43
  Requires-Dist: types-psycopg2 <3,>=2.9 ; extra == 'dev'
44
44
  Provides-Extra: docs
45
45
  Requires-Dist: mkdocs-include-markdown-plugin ==6.0.6 ; extra == 'docs'
@@ -1,15 +1,15 @@
1
1
  sqlframe/__init__.py,sha256=SB80yLTITBXHI2GCDS6n6bN5ObHqgPjfpRPAUwxaots,3403
2
- sqlframe/_version.py,sha256=oBaBfkGwPg8m5xrcN1koyrYjFksI66xSV9GrRFL_fYM,513
2
+ sqlframe/_version.py,sha256=lX2iL8aKS-SZi2TbIojy_xpiTXHlvGXPfxFC3OMcj2o,513
3
3
  sqlframe/py.typed,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
4
4
  sqlframe/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  sqlframe/base/_typing.py,sha256=b2clI5HI1zEZKB_3Msx3FeAJQyft44ubUifJwQRVXyQ,1298
6
6
  sqlframe/base/catalog.py,sha256=ZuU_qmt4yjSoTYgecSGnOhitOdh3rJbGCUjnUBp5mlc,38564
7
7
  sqlframe/base/column.py,sha256=AG9Z_6RNhVxLhLU29kRCgzMgDNSm-_GFg96xLqk1-bs,19838
8
- sqlframe/base/dataframe.py,sha256=IztCvK1MBajMrc70Ee6bgWyQ14y5iQPxGtN5WeemZe0,83946
8
+ sqlframe/base/dataframe.py,sha256=OgEUlDI5Y4rWrVngW5LttCUMC40WR-Pyr5af6aqbMNU,84028
9
9
  sqlframe/base/decorators.py,sha256=ms-CvDOIW3T8IVB9VqDmLwAiaEsqXLYRXEqVQaxktiM,1890
10
10
  sqlframe/base/exceptions.py,sha256=9Uwvqn2eAkDpqm4BrRgbL61qM-GMCbJEMAW8otxO46s,370
11
11
  sqlframe/base/function_alternatives.py,sha256=KFkEm0aIHzajvQmiPZnzTLh-Ud9wjeg4lJ4Rk0vk-YU,53674
12
- sqlframe/base/functions.py,sha256=gWUxngV4cgbPvKqK7_N-2rYGycRyoKJnZqPfFyqIgbE,223305
12
+ sqlframe/base/functions.py,sha256=W96Fg6hCXYgFfJOEt4HTam61ZUNkBp7cutv1ZEAX3H8,224000
13
13
  sqlframe/base/group.py,sha256=4R9sOZm4ZRlTfShq2j3_HQOiL_Tj1bYkouenYsgnlII,4115
14
14
  sqlframe/base/normalize.py,sha256=nXAJ5CwxVf4DV0GsH-q1w0p8gmjSMlv96k_ez1eVul8,3880
15
15
  sqlframe/base/operations.py,sha256=g-YNcbvNKTOBbYm23GKfB3fmydlR7ZZDAuZUtXIHtzw,4438
@@ -57,7 +57,7 @@ sqlframe/duckdb/catalog.py,sha256=89FCSJglMbOxonk3IXmlkMcdXCfMdePpGfqlbkkB_d0,51
57
57
  sqlframe/duckdb/column.py,sha256=E1tUa62Y5HajkhgFuebU9zohrGyieudcHzTT8gfalio,40
58
58
  sqlframe/duckdb/dataframe.py,sha256=Z8_K69UQGZVeBfVGXVwIJP8OMuIvNBB3DPKTP3Lfu4w,1908
59
59
  sqlframe/duckdb/functions.py,sha256=ix2efGGD4HLaY1rtCtEd3IrsicGEVGiBAeKOo5OD8rA,424
60
- sqlframe/duckdb/functions.pyi,sha256=P0ky6k-J7LdCDrQ0OjfRC3ARIYNHPmAmmaB_jBEO5L0,12383
60
+ sqlframe/duckdb/functions.pyi,sha256=Ih8XqqTV1VcsdBUPV4V9jx1d13QPggTb-BkQZcA4iCQ,12438
61
61
  sqlframe/duckdb/group.py,sha256=IkhbW42Ng1U5YT3FkIdiB4zBqRkW4QyTb-1detY1e_4,383
62
62
  sqlframe/duckdb/readwriter.py,sha256=-_Ama7evadIa3PYvynKDK6RcTMTDBHpHJzfANTine7g,4983
63
63
  sqlframe/duckdb/session.py,sha256=H1qjMYmhpwUHmf6jOPA6IhPIEIeX8rlvOl3MTIEijG0,2719
@@ -130,8 +130,8 @@ sqlframe/standalone/udf.py,sha256=azmgtUjHNIPs0WMVNId05SHwiYn41MKVBhKXsQJ5dmY,27
130
130
  sqlframe/standalone/window.py,sha256=6GKPzuxeSapJakBaKBeT9VpED1ACdjggDv9JRILDyV0,35
131
131
  sqlframe/testing/__init__.py,sha256=VVCosQhitU74A3NnE52O4mNtGZONapuEXcc20QmSlnQ,132
132
132
  sqlframe/testing/utils.py,sha256=PFsGZpwNUE_4-g_f43_vstTqsK0AQ2lBneb5Eb6NkFo,13008
133
- sqlframe-3.24.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
134
- sqlframe-3.24.0.dist-info/METADATA,sha256=j0VhoDveh4Jv1Hem4K4TXKyiF9RC2L7oYHEZ7fmL4M4,8971
135
- sqlframe-3.24.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
136
- sqlframe-3.24.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
137
- sqlframe-3.24.0.dist-info/RECORD,,
133
+ sqlframe-3.25.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
134
+ sqlframe-3.25.0.dist-info/METADATA,sha256=qXwyR7B-HVkPnO4ZGah338Mu-mK7F-9bliiB_5mRAGE,8971
135
+ sqlframe-3.25.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
136
+ sqlframe-3.25.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
137
+ sqlframe-3.25.0.dist-info/RECORD,,