sqlframe 3.32.1__py3-none-any.whl → 3.33.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 +2 -2
- sqlframe/base/column.py +4 -0
- sqlframe/base/function_alternatives.py +0 -11
- sqlframe/base/functions.py +9 -38
- sqlframe/base/session.py +4 -1
- {sqlframe-3.32.1.dist-info → sqlframe-3.33.1.dist-info}/METADATA +4 -4
- {sqlframe-3.32.1.dist-info → sqlframe-3.33.1.dist-info}/RECORD +10 -10
- {sqlframe-3.32.1.dist-info → sqlframe-3.33.1.dist-info}/LICENSE +0 -0
- {sqlframe-3.32.1.dist-info → sqlframe-3.33.1.dist-info}/WHEEL +0 -0
- {sqlframe-3.32.1.dist-info → sqlframe-3.33.1.dist-info}/top_level.txt +0 -0
sqlframe/_version.py
CHANGED
sqlframe/base/column.py
CHANGED
@@ -517,3 +517,7 @@ class Column:
|
|
517
517
|
+---+
|
518
518
|
"""
|
519
519
|
return self.getItem(name)
|
520
|
+
|
521
|
+
def contains(self, value: t.Union[str, Column]) -> Column:
|
522
|
+
value = self._lit(value) if not isinstance(value, Column) else value
|
523
|
+
return self.invoke_expression_over_column(self, exp.Contains, expression=value.expression)
|
@@ -78,17 +78,6 @@ def to_timestamp_tz(col: ColumnOrName, format: t.Optional[str] = None) -> Column
|
|
78
78
|
return Column.ensure_col(col).cast("timestamptz", dialect="duckdb")
|
79
79
|
|
80
80
|
|
81
|
-
def to_timestamp_just_timestamp(col: ColumnOrName, format: t.Optional[str] = None) -> Column:
|
82
|
-
from sqlframe.base.session import _BaseSession
|
83
|
-
|
84
|
-
if format is not None:
|
85
|
-
return Column.invoke_expression_over_column(
|
86
|
-
col, expression.StrToTime, format=_BaseSession().format_time(format)
|
87
|
-
)
|
88
|
-
|
89
|
-
return Column.ensure_col(col).cast("datetime", dialect="bigquery")
|
90
|
-
|
91
|
-
|
92
81
|
def bitwise_not_from_bitnot(col: ColumnOrName) -> Column:
|
93
82
|
return Column.invoke_anonymous_function(col, "BITNOT")
|
94
83
|
|
sqlframe/base/functions.py
CHANGED
@@ -1356,7 +1356,6 @@ def to_date(col: ColumnOrName, format: t.Optional[str] = None) -> Column:
|
|
1356
1356
|
@meta()
|
1357
1357
|
def to_timestamp(col: ColumnOrName, format: t.Optional[str] = None) -> Column:
|
1358
1358
|
from sqlframe.base.function_alternatives import (
|
1359
|
-
to_timestamp_just_timestamp,
|
1360
1359
|
to_timestamp_tz,
|
1361
1360
|
to_timestamp_with_time_zone,
|
1362
1361
|
)
|
@@ -1366,9 +1365,6 @@ def to_timestamp(col: ColumnOrName, format: t.Optional[str] = None) -> Column:
|
|
1366
1365
|
if session._is_duckdb:
|
1367
1366
|
return to_timestamp_tz(col, format)
|
1368
1367
|
|
1369
|
-
if session._is_bigquery:
|
1370
|
-
return to_timestamp_just_timestamp(col, format)
|
1371
|
-
|
1372
1368
|
if session._is_postgres:
|
1373
1369
|
return to_timestamp_with_time_zone(col, format)
|
1374
1370
|
|
@@ -2805,9 +2801,11 @@ def try_avg(col: ColumnOrName) -> Column:
|
|
2805
2801
|
return Column.invoke_anonymous_function(col, "TRY_AVG")
|
2806
2802
|
|
2807
2803
|
|
2808
|
-
@meta(
|
2804
|
+
@meta()
|
2809
2805
|
def try_divide(left: ColumnOrName, right: ColumnOrName) -> Column:
|
2810
|
-
return Column.
|
2806
|
+
return Column.invoke_expression_over_column(
|
2807
|
+
left, expression.SafeDivide, expression=Column.ensure_col(right).column_expression
|
2808
|
+
)
|
2811
2809
|
|
2812
2810
|
|
2813
2811
|
@meta(unsupported_engines="*")
|
@@ -3068,7 +3066,7 @@ def character_length(str: ColumnOrName) -> Column:
|
|
3068
3066
|
return Column.invoke_expression_over_column(str, expression.Length)
|
3069
3067
|
|
3070
3068
|
|
3071
|
-
@meta(unsupported_engines=["
|
3069
|
+
@meta(unsupported_engines=["postgres"])
|
3072
3070
|
def contains(left: ColumnOrName, right: ColumnOrName) -> Column:
|
3073
3071
|
return Column.invoke_expression_over_column(
|
3074
3072
|
left, expression.Contains, expression=Column.ensure_col(right).column_expression
|
@@ -6594,27 +6592,16 @@ def unix_micros(col: ColumnOrName) -> Column:
|
|
6594
6592
|
"""
|
6595
6593
|
from sqlframe.base.function_alternatives import unix_micros_multiply_epoch
|
6596
6594
|
|
6595
|
+
to_timestamp = get_func_from_session("to_timestamp")
|
6596
|
+
|
6597
6597
|
if _get_session()._is_duckdb:
|
6598
6598
|
return Column.invoke_anonymous_function(col, "epoch_us")
|
6599
6599
|
|
6600
|
-
if _get_session()._is_bigquery:
|
6601
|
-
return Column(
|
6602
|
-
expression.Anonymous(
|
6603
|
-
this="UNIX_MICROS",
|
6604
|
-
expressions=[
|
6605
|
-
expression.Anonymous(
|
6606
|
-
this="TIMESTAMP",
|
6607
|
-
expressions=[
|
6608
|
-
Column.ensure_col(col).column_expression,
|
6609
|
-
],
|
6610
|
-
)
|
6611
|
-
],
|
6612
|
-
)
|
6613
|
-
)
|
6614
|
-
|
6615
6600
|
if _get_session()._is_postgres or _get_session()._is_snowflake:
|
6616
6601
|
return unix_micros_multiply_epoch(col)
|
6617
6602
|
|
6603
|
+
col = to_timestamp(col)
|
6604
|
+
|
6618
6605
|
return Column.invoke_anonymous_function(col, "unix_micros")
|
6619
6606
|
|
6620
6607
|
|
@@ -6666,22 +6653,6 @@ def unix_seconds(col: ColumnOrName) -> Column:
|
|
6666
6653
|
if _get_session()._is_postgres:
|
6667
6654
|
return unix_seconds_extract_epoch(col)
|
6668
6655
|
|
6669
|
-
if _get_session()._is_bigquery:
|
6670
|
-
return Column(
|
6671
|
-
expression.Anonymous(
|
6672
|
-
this="UNIX_SECONDS",
|
6673
|
-
expressions=[
|
6674
|
-
expression.Anonymous(
|
6675
|
-
this="TIMESTAMP",
|
6676
|
-
expressions=[
|
6677
|
-
Column.ensure_col(col).column_expression,
|
6678
|
-
expression.Literal.string("UTC"),
|
6679
|
-
],
|
6680
|
-
)
|
6681
|
-
],
|
6682
|
-
)
|
6683
|
-
)
|
6684
|
-
|
6685
6656
|
return Column.invoke_expression_over_column(col, expression.UnixSeconds)
|
6686
6657
|
|
6687
6658
|
|
sqlframe/base/session.py
CHANGED
@@ -304,7 +304,10 @@ 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
|
-
|
307
|
+
if value.tzinfo:
|
308
|
+
# Spark defaults `timestamp` to be a timestamp with timezone
|
309
|
+
return "timestamp"
|
310
|
+
return "timestampntz"
|
308
311
|
elif isinstance(value, datetime.date):
|
309
312
|
return "date"
|
310
313
|
elif isinstance(value, str):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sqlframe
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.33.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
|
@@ -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.20,>=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'
|
@@ -25,7 +25,7 @@ Requires-Dist: google-cloud-bigquery[pandas] <4,>=3 ; extra == 'bigquery'
|
|
25
25
|
Provides-Extra: databricks
|
26
26
|
Requires-Dist: databricks-sql-connector[pyarrow] <5,>=3.6 ; extra == 'databricks'
|
27
27
|
Provides-Extra: dev
|
28
|
-
Requires-Dist: duckdb <1.
|
28
|
+
Requires-Dist: duckdb <1.4,>=1.2 ; extra == 'dev'
|
29
29
|
Requires-Dist: findspark <3,>=2 ; extra == 'dev'
|
30
30
|
Requires-Dist: mypy <1.16,>=1.10.0 ; extra == 'dev'
|
31
31
|
Requires-Dist: openai <2,>=1.30 ; extra == 'dev'
|
@@ -48,7 +48,7 @@ Requires-Dist: mkdocs-material ==9.0.5 ; extra == 'docs'
|
|
48
48
|
Requires-Dist: mkdocs ==1.4.2 ; extra == 'docs'
|
49
49
|
Requires-Dist: pymdown-extensions ; extra == 'docs'
|
50
50
|
Provides-Extra: duckdb
|
51
|
-
Requires-Dist: duckdb <1.
|
51
|
+
Requires-Dist: duckdb <1.4,>=1.2 ; extra == 'duckdb'
|
52
52
|
Requires-Dist: pandas <3,>=2 ; extra == 'duckdb'
|
53
53
|
Provides-Extra: openai
|
54
54
|
Requires-Dist: openai <2,>=1.30 ; extra == 'openai'
|
@@ -1,20 +1,20 @@
|
|
1
1
|
sqlframe/__init__.py,sha256=SB80yLTITBXHI2GCDS6n6bN5ObHqgPjfpRPAUwxaots,3403
|
2
|
-
sqlframe/_version.py,sha256=
|
2
|
+
sqlframe/_version.py,sha256=9Dhg19xsbG33VnlXESdp75HcNQAc2ar-bSzzRVx9fps,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=zDG9YT-5M7H8tDISOkJ6uMBU7Q3enTmc6d7rzZ08q40,20172
|
8
8
|
sqlframe/base/dataframe.py,sha256=6L8xTdwwQCkUzpJ6K3QlCcz5zqk2QQmGzteI-1EJ23A,84374
|
9
9
|
sqlframe/base/decorators.py,sha256=IhE5xNQDkwJHacCvulq5WpUKyKmXm7dL2A3o5WuKGP4,2131
|
10
10
|
sqlframe/base/exceptions.py,sha256=9Uwvqn2eAkDpqm4BrRgbL61qM-GMCbJEMAW8otxO46s,370
|
11
|
-
sqlframe/base/function_alternatives.py,sha256=
|
12
|
-
sqlframe/base/functions.py,sha256=
|
11
|
+
sqlframe/base/function_alternatives.py,sha256=dEymHSOQgUzhoYtfY5acC9AxpMoGoHXX7v6yTadKzn8,53527
|
12
|
+
sqlframe/base/functions.py,sha256=3tV8RPgmzNs8Cz0SeUmvCCMxZGpgAGMbUnYBCPbArRU,226241
|
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=djXPmuW0cIQYuoE7hegfyvZuKC2D3ABZCjvw-fa1C24,27260
|
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
|
@@ -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.33.1.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
|
134
|
+
sqlframe-3.33.1.dist-info/METADATA,sha256=W40NdA9Zw8eWNZIQzwJEBZm0Mt-JHuezntIolna3GkE,8987
|
135
|
+
sqlframe-3.33.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
136
|
+
sqlframe-3.33.1.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
|
137
|
+
sqlframe-3.33.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|