sqlframe 3.36.3__py3-none-any.whl → 3.38.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/column.py +8 -1
- sqlframe/base/functions.py +10 -10
- sqlframe/base/session.py +6 -0
- sqlframe/base/types.py +1 -1
- {sqlframe-3.36.3.dist-info → sqlframe-3.38.0.dist-info}/METADATA +4 -4
- {sqlframe-3.36.3.dist-info → sqlframe-3.38.0.dist-info}/RECORD +10 -10
- {sqlframe-3.36.3.dist-info → sqlframe-3.38.0.dist-info}/LICENSE +0 -0
- {sqlframe-3.36.3.dist-info → sqlframe-3.38.0.dist-info}/WHEEL +0 -0
- {sqlframe-3.36.3.dist-info → sqlframe-3.38.0.dist-info}/top_level.txt +0 -0
sqlframe/_version.py
CHANGED
sqlframe/base/column.py
CHANGED
@@ -222,6 +222,12 @@ class Column:
|
|
222
222
|
else:
|
223
223
|
value = value.astimezone(datetime.timezone.utc).isoformat(sep=" ")
|
224
224
|
return cls(exp.cast(exp.Literal.string(value), exp.DataType.Type.TIMESTAMPTZ))
|
225
|
+
elif isinstance(value, datetime.timedelta):
|
226
|
+
return cls(
|
227
|
+
exp.Interval(
|
228
|
+
this=exp.Literal.string(int(value.total_seconds())), unit=exp.Var(this="SECOND")
|
229
|
+
)
|
230
|
+
)
|
225
231
|
return cls(exp.convert(value))
|
226
232
|
|
227
233
|
@classmethod
|
@@ -413,8 +419,9 @@ class Column:
|
|
413
419
|
return self.invoke_expression_over_column(self, exp.StartsWith, expression=value.expression)
|
414
420
|
|
415
421
|
def endswith(self, value: t.Union[str, Column]) -> Column:
|
422
|
+
ends_with_func = get_func_from_session("endswith")
|
416
423
|
value = self._lit(value) if not isinstance(value, Column) else value
|
417
|
-
return
|
424
|
+
return ends_with_func(self, value)
|
418
425
|
|
419
426
|
def rlike(self, regexp: str) -> Column:
|
420
427
|
return self.invoke_expression_over_column(
|
sqlframe/base/functions.py
CHANGED
@@ -2110,24 +2110,24 @@ def array_size(col: ColumnOrName) -> Column:
|
|
2110
2110
|
return Column.invoke_expression_over_column(col, expression.ArraySize)
|
2111
2111
|
|
2112
2112
|
|
2113
|
-
@meta(unsupported_engines="
|
2113
|
+
@meta(unsupported_engines="snowflake")
|
2114
2114
|
def bit_and(col: ColumnOrName) -> Column:
|
2115
|
-
return Column.
|
2115
|
+
return Column.invoke_expression_over_column(col, expression.BitwiseAndAgg)
|
2116
2116
|
|
2117
2117
|
|
2118
|
-
@meta(unsupported_engines="
|
2118
|
+
@meta(unsupported_engines="snowflake")
|
2119
2119
|
def bit_or(col: ColumnOrName) -> Column:
|
2120
|
-
return Column.
|
2120
|
+
return Column.invoke_expression_over_column(col, expression.BitwiseOrAgg)
|
2121
2121
|
|
2122
2122
|
|
2123
|
-
@meta(unsupported_engines="
|
2123
|
+
@meta(unsupported_engines="snowflake")
|
2124
2124
|
def bit_xor(col: ColumnOrName) -> Column:
|
2125
|
-
return Column.
|
2125
|
+
return Column.invoke_expression_over_column(col, expression.BitwiseXorAgg)
|
2126
2126
|
|
2127
2127
|
|
2128
|
-
@meta(unsupported_engines="
|
2128
|
+
@meta(unsupported_engines=["postgres", "snowflake"])
|
2129
2129
|
def bit_count(col: ColumnOrName) -> Column:
|
2130
|
-
return Column.
|
2130
|
+
return Column.invoke_expression_over_column(col, expression.BitwiseCountAgg)
|
2131
2131
|
|
2132
2132
|
|
2133
2133
|
@meta(unsupported_engines="*")
|
@@ -3293,7 +3293,7 @@ def find_in_set(str: ColumnOrName, str_array: ColumnOrName) -> Column:
|
|
3293
3293
|
return Column.invoke_anonymous_function(str, "find_in_set", str_array)
|
3294
3294
|
|
3295
3295
|
|
3296
|
-
@meta(unsupported_engines=["bigquery", "postgres"
|
3296
|
+
@meta(unsupported_engines=["bigquery", "postgres"])
|
3297
3297
|
def first_value(col: ColumnOrName, ignoreNulls: t.Optional[t.Union[bool, Column]] = None) -> Column:
|
3298
3298
|
"""Returns the first value of `col` for a group of rows. It will return the first non-null
|
3299
3299
|
value it sees when `ignoreNulls` is set to true. If all values are null, then null is returned.
|
@@ -3959,7 +3959,7 @@ def json_object_keys(col: ColumnOrName) -> Column:
|
|
3959
3959
|
return Column.invoke_anonymous_function(col, "json_object_keys")
|
3960
3960
|
|
3961
3961
|
|
3962
|
-
@meta(unsupported_engines=
|
3962
|
+
@meta(unsupported_engines="postgres")
|
3963
3963
|
def last_value(col: ColumnOrName, ignoreNulls: t.Optional[t.Union[bool, Column]] = None) -> Column:
|
3964
3964
|
"""Returns the last value of `col` for a group of rows. It will return the last non-null
|
3965
3965
|
value it sees when `ignoreNulls` is set to true. If all values are null, then null is returned.
|
sqlframe/base/session.py
CHANGED
@@ -12,6 +12,7 @@ from collections import defaultdict
|
|
12
12
|
from functools import cached_property
|
13
13
|
|
14
14
|
import sqlglot
|
15
|
+
from dateutil.relativedelta import relativedelta
|
15
16
|
from sqlglot import Dialect, exp
|
16
17
|
from sqlglot.dialects.dialect import DialectType, NormalizationStrategy
|
17
18
|
from sqlglot.expressions import parse_identifier
|
@@ -613,6 +614,11 @@ class _BaseSession(t.Generic[CATALOG, READER, WRITER, DF, TABLE, CONN, UDF_REGIS
|
|
613
614
|
return [cls._to_value(x) for x in value]
|
614
615
|
elif isinstance(value, datetime.datetime):
|
615
616
|
return value.replace(tzinfo=None)
|
617
|
+
elif isinstance(value, relativedelta):
|
618
|
+
return datetime.timedelta(
|
619
|
+
days=value.days, hours=value.hours, minutes=value.minutes, seconds=value.seconds
|
620
|
+
)
|
621
|
+
|
616
622
|
return value
|
617
623
|
|
618
624
|
@classmethod
|
sqlframe/base/types.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sqlframe
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.38.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 <
|
20
|
+
Requires-Dist: sqlglot <27.4,>=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'
|
@@ -27,13 +27,13 @@ Requires-Dist: databricks-sql-connector[pyarrow] <5,>=3.6 ; extra == 'databricks
|
|
27
27
|
Provides-Extra: dev
|
28
28
|
Requires-Dist: duckdb <1.4,>=1.2 ; extra == 'dev'
|
29
29
|
Requires-Dist: findspark <3,>=2 ; extra == 'dev'
|
30
|
-
Requires-Dist: mypy <1.
|
30
|
+
Requires-Dist: mypy <1.18,>=1.10.0 ; extra == 'dev'
|
31
31
|
Requires-Dist: openai <2,>=1.30 ; extra == 'dev'
|
32
32
|
Requires-Dist: pandas-stubs <3,>=2 ; extra == 'dev'
|
33
33
|
Requires-Dist: pandas <3,>=2 ; extra == 'dev'
|
34
34
|
Requires-Dist: pre-commit <5,>=3.7 ; extra == 'dev'
|
35
35
|
Requires-Dist: psycopg <4,>=3.1 ; extra == 'dev'
|
36
|
-
Requires-Dist: pyarrow <
|
36
|
+
Requires-Dist: pyarrow <22,>=10 ; extra == 'dev'
|
37
37
|
Requires-Dist: pyspark <3.6,>=2 ; extra == 'dev'
|
38
38
|
Requires-Dist: pytest-forked ; extra == 'dev'
|
39
39
|
Requires-Dist: pytest-postgresql <8,>=6 ; extra == 'dev'
|
@@ -1,23 +1,23 @@
|
|
1
1
|
sqlframe/__init__.py,sha256=SB80yLTITBXHI2GCDS6n6bN5ObHqgPjfpRPAUwxaots,3403
|
2
|
-
sqlframe/_version.py,sha256=
|
2
|
+
sqlframe/_version.py,sha256=QFZM372YAR5g-moTkhEicbj8HSNBFoNWHFgQ704qMgo,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=-YulM2BMK8MoWbXi05AsJIPxd4AuiZDBCZuk4HoeMlE,38900
|
7
|
-
sqlframe/base/column.py,sha256=
|
7
|
+
sqlframe/base/column.py,sha256=f6rK6-hTiNx9WwJP7t6tqL3xEC2gwERPDlhWCS5iCBw,21417
|
8
8
|
sqlframe/base/dataframe.py,sha256=0diYONDlet8iZt49LC3vcmfXHAAZ2MovPL2pTXYHj2U,85974
|
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=aTu3nQhIAkZoxrI1IpjpaHEAMxBNms0AnhS0EMR-TwY,51727
|
12
|
-
sqlframe/base/functions.py,sha256=
|
12
|
+
sqlframe/base/functions.py,sha256=OxoeI2cEoQY79hdOnvpw0pRiaUHkU55MMpfx7_v5l70,226984
|
13
13
|
sqlframe/base/group.py,sha256=fBm8EUve7W7xz11nybTXr09ih-yZxL_vvEiZVE1eb_0,12025
|
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=ExaGjY_lxkMi2WDwJ8wTd2uf7a2PjOOk9bx1ViEaAqA,27507
|
18
18
|
sqlframe/base/table.py,sha256=rCeh1W5SWbtEVfkLAUiexzrZwNgmZeptLEmLcM1ABkE,6961
|
19
19
|
sqlframe/base/transforms.py,sha256=y0j3SGDz3XCmNGrvassk1S-owllUWfkHyMgZlY6SFO4,467
|
20
|
-
sqlframe/base/types.py,sha256=
|
20
|
+
sqlframe/base/types.py,sha256=OktuJ5f7tEogOW0oupI0RBlHfzZMmKh7zGLke9cwllo,12305
|
21
21
|
sqlframe/base/udf.py,sha256=O6hMhBUy9NVv-mhJRtfFhXTIa_-Z8Y_FkmmuOHu0l90,1117
|
22
22
|
sqlframe/base/util.py,sha256=gv_kRc3LxCuQy3t4dHFldV7elB8RU5PMqIN5-xSkWSo,19107
|
23
23
|
sqlframe/base/window.py,sha256=7NaKDTlhun-95LEghukBCjFBwq0RHrPaajWQNCsLxok,4818
|
@@ -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.38.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
|
134
|
+
sqlframe-3.38.0.dist-info/METADATA,sha256=9I9SbVhzN2eSfBMmQ1TN9QjFbWXiAKMra4AvhnqYENc,9039
|
135
|
+
sqlframe-3.38.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
136
|
+
sqlframe-3.38.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
|
137
|
+
sqlframe-3.38.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|