sqlframe 3.31.3__py3-none-any.whl → 3.32.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 +2 -2
- sqlframe/base/dataframe.py +7 -0
- sqlframe/base/functions.py +11 -10
- sqlframe/base/session.py +0 -2
- sqlframe/base/util.py +1 -1
- {sqlframe-3.31.3.dist-info → sqlframe-3.32.0.dist-info}/METADATA +2 -2
- {sqlframe-3.31.3.dist-info → sqlframe-3.32.0.dist-info}/RECORD +10 -10
- {sqlframe-3.31.3.dist-info → sqlframe-3.32.0.dist-info}/LICENSE +0 -0
- {sqlframe-3.31.3.dist-info → sqlframe-3.32.0.dist-info}/WHEEL +0 -0
- {sqlframe-3.31.3.dist-info → sqlframe-3.32.0.dist-info}/top_level.txt +0 -0
sqlframe/_version.py
CHANGED
sqlframe/base/dataframe.py
CHANGED
@@ -260,6 +260,13 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
|
|
260
260
|
def __copy__(self):
|
261
261
|
return self.copy()
|
262
262
|
|
263
|
+
def __repr__(self) -> str:
|
264
|
+
fields = [f"{field.name}: {field.dataType}" for field in self.schema]
|
265
|
+
return "DataFrame[" + ", ".join(fields) + "]"
|
266
|
+
|
267
|
+
def _display_(self) -> str:
|
268
|
+
return self.__repr__()
|
269
|
+
|
263
270
|
@property
|
264
271
|
def _typed_columns(self) -> t.List[CatalogColumn]:
|
265
272
|
raise NotImplementedError
|
sqlframe/base/functions.py
CHANGED
@@ -494,21 +494,22 @@ def skewness(col: ColumnOrName) -> Column:
|
|
494
494
|
func_name = "SKEW"
|
495
495
|
|
496
496
|
if session._is_duckdb or session._is_snowflake:
|
497
|
+
col = Column.ensure_col(col)
|
497
498
|
when_func = get_func_from_session("when")
|
498
499
|
count_func = get_func_from_session("count")
|
499
|
-
|
500
|
+
count_col = count_func(col)
|
500
501
|
lit_func = get_func_from_session("lit")
|
501
502
|
sqrt_func = get_func_from_session("sqrt")
|
502
|
-
|
503
|
+
full_calc = (
|
504
|
+
Column.invoke_anonymous_function(col, func_name)
|
505
|
+
* (count_col - lit_func(2))
|
506
|
+
/ (sqrt_func(count_col * (count_col - lit_func(1))))
|
507
|
+
)
|
503
508
|
return (
|
504
|
-
when_func(
|
505
|
-
.when(
|
506
|
-
.when(
|
507
|
-
.otherwise(
|
508
|
-
Column.invoke_anonymous_function(col, func_name)
|
509
|
-
* (count_star - lit_func(2))
|
510
|
-
/ (sqrt_func(count_star * (count_star - lit_func(1))))
|
511
|
-
)
|
509
|
+
when_func(count_col == lit_func(0), lit_func(None))
|
510
|
+
.when(count_col == lit_func(1), lit_func(None))
|
511
|
+
.when(count_col == lit_func(2), lit_func(0.0))
|
512
|
+
.otherwise(full_calc)
|
512
513
|
)
|
513
514
|
|
514
515
|
return Column.invoke_anonymous_function(col, func_name)
|
sqlframe/base/session.py
CHANGED
@@ -304,8 +304,6 @@ class _BaseSession(t.Generic[CATALOG, READER, WRITER, DF, TABLE, CONN, UDF_REGIS
|
|
304
304
|
elif isinstance(value, float):
|
305
305
|
return "double"
|
306
306
|
elif isinstance(value, datetime.datetime):
|
307
|
-
if value.tzinfo:
|
308
|
-
return "timestamptz"
|
309
307
|
return "timestamp"
|
310
308
|
elif isinstance(value, datetime.date):
|
311
309
|
return "date"
|
sqlframe/base/util.py
CHANGED
@@ -313,7 +313,7 @@ def sqlglot_to_spark(sqlglot_dtype: exp.DataType) -> types.DataType:
|
|
313
313
|
exp.DataType.Type.TIMESTAMP: types.TimestampType,
|
314
314
|
exp.DataType.Type.TIMESTAMPTZ: types.TimestampType,
|
315
315
|
exp.DataType.Type.TIMESTAMPLTZ: types.TimestampType,
|
316
|
-
exp.DataType.Type.TIMESTAMPNTZ: types.
|
316
|
+
exp.DataType.Type.TIMESTAMPNTZ: types.TimestampNTZType,
|
317
317
|
exp.DataType.Type.DATE: types.DateType,
|
318
318
|
exp.DataType.Type.JSON: types.StringType,
|
319
319
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sqlframe
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.32.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.
|
20
|
+
Requires-Dist: sqlglot <26.18,>=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'
|
@@ -1,25 +1,25 @@
|
|
1
1
|
sqlframe/__init__.py,sha256=SB80yLTITBXHI2GCDS6n6bN5ObHqgPjfpRPAUwxaots,3403
|
2
|
-
sqlframe/_version.py,sha256=
|
2
|
+
sqlframe/_version.py,sha256=EatXYAvXc8eLZh8r-obXLCaLyBPqfgPtx9AXEI2rZ_E,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=sp3fJstA49FslE2CcgvVFHyi7Jxsxk8qHTd-Z0cAEWc,19932
|
8
|
-
sqlframe/base/dataframe.py,sha256=
|
8
|
+
sqlframe/base/dataframe.py,sha256=V_qRAPsdUji12PwWg7Ce8Cln9fsBoVY-3s4J4KwbINs,84538
|
9
9
|
sqlframe/base/decorators.py,sha256=IhE5xNQDkwJHacCvulq5WpUKyKmXm7dL2A3o5WuKGP4,2131
|
10
10
|
sqlframe/base/exceptions.py,sha256=9Uwvqn2eAkDpqm4BrRgbL61qM-GMCbJEMAW8otxO46s,370
|
11
11
|
sqlframe/base/function_alternatives.py,sha256=Bs1bwl25fN3Yy9rb4GnUWBGunQ1C_yelkb2yV9DSZIY,53918
|
12
|
-
sqlframe/base/functions.py,sha256=
|
12
|
+
sqlframe/base/functions.py,sha256=i93fc9t7HooXMo8p35VLHd3FeYazVZztVIWqGBmsMYA,227188
|
13
13
|
sqlframe/base/group.py,sha256=OY4w1WRsCqLgW-Pi7DjF63zbbxSLISCF3qjAbzI2CQ4,4283
|
14
14
|
sqlframe/base/normalize.py,sha256=nXAJ5CwxVf4DV0GsH-q1w0p8gmjSMlv96k_ez1eVul8,3880
|
15
15
|
sqlframe/base/operations.py,sha256=g-YNcbvNKTOBbYm23GKfB3fmydlR7ZZDAuZUtXIHtzw,4438
|
16
16
|
sqlframe/base/readerwriter.py,sha256=Nb2VJ_HBmLQp5mK8JhnFooZh2ydAaboCAFVPb-4MNX4,31241
|
17
|
-
sqlframe/base/session.py,sha256=
|
17
|
+
sqlframe/base/session.py,sha256=tSNlIlo7XeZUQFsZ3wnffqFLdxynY9i7oz60GUF-V14,27104
|
18
18
|
sqlframe/base/table.py,sha256=rCeh1W5SWbtEVfkLAUiexzrZwNgmZeptLEmLcM1ABkE,6961
|
19
19
|
sqlframe/base/transforms.py,sha256=y0j3SGDz3XCmNGrvassk1S-owllUWfkHyMgZlY6SFO4,467
|
20
20
|
sqlframe/base/types.py,sha256=iBNk9bpFtb2NBIogYS8i7OlQZMRvpR6XxqzBebsjQDU,12280
|
21
21
|
sqlframe/base/udf.py,sha256=O6hMhBUy9NVv-mhJRtfFhXTIa_-Z8Y_FkmmuOHu0l90,1117
|
22
|
-
sqlframe/base/util.py,sha256=
|
22
|
+
sqlframe/base/util.py,sha256=P8NcogrbNGAS69uWfsBx-50c-4QgVQxUqZC2IrWX_Ts,15522
|
23
23
|
sqlframe/base/window.py,sha256=7NaKDTlhun-95LEghukBCjFBwq0RHrPaajWQNCsLxok,4818
|
24
24
|
sqlframe/base/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
sqlframe/base/mixins/catalog_mixins.py,sha256=9fZGWToz9xMJSzUl1vsVtj6TH3TysP3fBCKJLnGUQzE,23353
|
@@ -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.
|
134
|
-
sqlframe-3.
|
135
|
-
sqlframe-3.
|
136
|
-
sqlframe-3.
|
137
|
-
sqlframe-3.
|
133
|
+
sqlframe-3.32.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
|
134
|
+
sqlframe-3.32.0.dist-info/METADATA,sha256=JXzQRL-VpYCTvuSF7QmUH0spMzGT2B5CoCIDDUNwq40,8987
|
135
|
+
sqlframe-3.32.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
136
|
+
sqlframe-3.32.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
|
137
|
+
sqlframe-3.32.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|