sqlframe 3.9.3__py3-none-any.whl → 3.10.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.9.3'
16
- __version_tuple__ = version_tuple = (3, 9, 3)
15
+ __version__ = version = '3.10.1'
16
+ __version_tuple__ = version_tuple = (3, 10, 1)
@@ -1624,9 +1624,7 @@ class _BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
1624
1624
  raise NotImplementedError("Vertical show is not yet supported")
1625
1625
  if truncate:
1626
1626
  logger.warning("Truncate is ignored so full results will be displayed")
1627
- # Make sure that the limit we add doesn't affect the results
1628
- df = self._convert_leaf_to_cte()
1629
- result = df.limit(n).collect()
1627
+ result = self.limit(n).collect()
1630
1628
  table = PrettyTable()
1631
1629
  if row := seq_get(result, 0):
1632
1630
  table.field_names = row._unique_field_names
@@ -64,6 +64,39 @@ def first_always_ignore_nulls(col: ColumnOrName, ignorenulls: t.Optional[bool] =
64
64
  return first(col)
65
65
 
66
66
 
67
+ def to_timestamp_with_time_zone(col: ColumnOrName, format: t.Optional[str] = None) -> Column:
68
+ from sqlframe.base.session import _BaseSession
69
+
70
+ if format is not None:
71
+ return Column.invoke_expression_over_column(
72
+ col, expression.StrToTime, format=_BaseSession().format_time(format)
73
+ )
74
+
75
+ return Column.ensure_col(col).cast("timestamp with time zone", dialect="postgres")
76
+
77
+
78
+ def to_timestamp_tz(col: ColumnOrName, format: t.Optional[str] = None) -> Column:
79
+ from sqlframe.base.session import _BaseSession
80
+
81
+ if format is not None:
82
+ return Column.invoke_expression_over_column(
83
+ col, expression.StrToTime, format=_BaseSession().format_time(format)
84
+ )
85
+
86
+ return Column.ensure_col(col).cast("timestamptz", dialect="duckdb")
87
+
88
+
89
+ def to_timestamp_just_timestamp(col: ColumnOrName, format: t.Optional[str] = None) -> Column:
90
+ from sqlframe.base.session import _BaseSession
91
+
92
+ if format is not None:
93
+ return Column.invoke_expression_over_column(
94
+ col, expression.StrToTime, format=_BaseSession().format_time(format)
95
+ )
96
+
97
+ return Column.ensure_col(col).cast("datetime", dialect="bigquery")
98
+
99
+
67
100
  def bitwise_not_from_bitnot(col: ColumnOrName) -> Column:
68
101
  return Column.invoke_anonymous_function(col, "BITNOT")
69
102
 
@@ -900,7 +900,7 @@ def to_timestamp(col: ColumnOrName, format: t.Optional[str] = None) -> Column:
900
900
  col, expression.StrToTime, format=_BaseSession().format_time(format)
901
901
  )
902
902
 
903
- return Column.ensure_col(col).cast("timestamp")
903
+ return Column.ensure_col(col).cast("timestampltz")
904
904
 
905
905
 
906
906
  @meta()
sqlframe/base/session.py CHANGED
@@ -570,6 +570,8 @@ class _BaseSession(t.Generic[CATALOG, READER, WRITER, DF, CONN, UDF_REGISTRATION
570
570
  return cls._to_row(list(value.keys()), list(value.values()))
571
571
  elif isinstance(value, (list, set, tuple)) and value:
572
572
  return [cls._to_value(x) for x in value]
573
+ elif isinstance(value, datetime.datetime):
574
+ return value.replace(tzinfo=None)
573
575
  return value
574
576
 
575
577
  @classmethod
@@ -73,6 +73,7 @@ from sqlframe.base.function_alternatives import ( # noqa
73
73
  _is_string_using_typeof_string as _is_string,
74
74
  array_append_using_array_cat as array_append,
75
75
  endswith_with_underscore as endswith,
76
+ to_timestamp_just_timestamp as to_timestamp,
76
77
  )
77
78
 
78
79
 
@@ -53,4 +53,5 @@ from sqlframe.base.function_alternatives import ( # noqa
53
53
  endswith_with_underscore as endswith,
54
54
  last_day_with_cast as last_day,
55
55
  regexp_replace_global_option as regexp_replace,
56
+ to_timestamp_tz as to_timestamp,
56
57
  )
@@ -29,6 +29,7 @@ from sqlframe.base.function_alternatives import ( # noqa
29
29
  try_element_at_zero_based as try_element_at,
30
30
  to_unix_timestamp_include_default_format as to_unix_timestamp,
31
31
  regexp_replace_global_option as regexp_replace,
32
+ to_timestamp_tz as to_timestamp,
32
33
  )
33
34
  from sqlframe.base.functions import (
34
35
  abs as abs,
@@ -70,4 +70,5 @@ from sqlframe.base.function_alternatives import ( # noqa
70
70
  endswith_using_like as endswith,
71
71
  last_day_with_cast as last_day,
72
72
  regexp_replace_global_option as regexp_replace,
73
+ to_timestamp_with_time_zone as to_timestamp,
73
74
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlframe
3
- Version: 3.9.3
3
+ Version: 3.10.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
@@ -18,7 +18,7 @@ Requires-Python: >=3.8
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
20
  Requires-Dist: prettytable (<3.12.1)
21
- Requires-Dist: sqlglot (<25.33,>=24.0.0)
21
+ Requires-Dist: sqlglot (<26.1,>=24.0.0)
22
22
  Requires-Dist: typing-extensions (<5,>=4.8)
23
23
  Provides-Extra: bigquery
24
24
  Requires-Dist: google-cloud-bigquery-storage (<3,>=2) ; extra == 'bigquery'
@@ -29,12 +29,13 @@ Provides-Extra: dev
29
29
  Requires-Dist: duckdb (<1.2,>=0.9) ; extra == 'dev'
30
30
  Requires-Dist: findspark (<3,>=2) ; extra == 'dev'
31
31
  Requires-Dist: mypy (<1.14,>=1.10.0) ; extra == 'dev'
32
- Requires-Dist: openai (<1.56,>=1.30) ; extra == 'dev'
32
+ Requires-Dist: openai (<1.59,>=1.30) ; extra == 'dev'
33
33
  Requires-Dist: pandas-stubs (<3,>=2) ; extra == 'dev'
34
34
  Requires-Dist: pandas (<3,>=2) ; extra == 'dev'
35
35
  Requires-Dist: psycopg (<4,>=3.1) ; extra == 'dev'
36
36
  Requires-Dist: pyarrow (<19,>=10) ; extra == 'dev'
37
37
  Requires-Dist: pyspark (<3.6,>=2) ; extra == 'dev'
38
+ Requires-Dist: pytest-forked ; extra == 'dev'
38
39
  Requires-Dist: pytest-postgresql (<7,>=6) ; extra == 'dev'
39
40
  Requires-Dist: pytest-xdist (<3.7,>=3.6) ; extra == 'dev'
40
41
  Requires-Dist: pytest (<8.4,>=8.2.0) ; extra == 'dev'
@@ -52,7 +53,7 @@ Provides-Extra: duckdb
52
53
  Requires-Dist: duckdb (<1.2,>=0.9) ; extra == 'duckdb'
53
54
  Requires-Dist: pandas (<3,>=2) ; extra == 'duckdb'
54
55
  Provides-Extra: openai
55
- Requires-Dist: openai (<1.56,>=1.30) ; extra == 'openai'
56
+ Requires-Dist: openai (<1.59,>=1.30) ; extra == 'openai'
56
57
  Provides-Extra: pandas
57
58
  Requires-Dist: pandas (<3,>=2) ; extra == 'pandas'
58
59
  Provides-Extra: postgres
@@ -1,19 +1,19 @@
1
1
  sqlframe/__init__.py,sha256=wfqm98eLoLid9oV_FzzpG5loKC6LxOhj2lXpfN7SARo,3138
2
- sqlframe/_version.py,sha256=ePIdX1C-mMoAemzEjqIHTX7SWT0yo97HOcaf1C5t0aQ,411
2
+ sqlframe/_version.py,sha256=_XTXYp6t8f7ZTjhDK_u5JjZme8OvOrQKxw63u_2HvzU,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=06fhVZ2nCn2QLxnfjdK-oYKeTFJC_smgSxu7u2UYlVg,17878
7
- sqlframe/base/dataframe.py,sha256=ICW9eJElRsVIRutuu2aVJmP9k1n4oi6MfcLR0IrsBIs,74454
7
+ sqlframe/base/dataframe.py,sha256=QvQ7-f46Waz5Td2CZ-LWHAbF_MI_cllgKM4UKkybd6s,74346
8
8
  sqlframe/base/decorators.py,sha256=Jy4bf8MhZ-AJ6CWTj59bBJRqamtLbPC0USUMFrY6g0w,449
9
9
  sqlframe/base/exceptions.py,sha256=9Uwvqn2eAkDpqm4BrRgbL61qM-GMCbJEMAW8otxO46s,370
10
- sqlframe/base/function_alternatives.py,sha256=8nSUXoBuEA6jH-hJJraxudYlVQlRDxrt1ePlXT7KFTE,50964
11
- sqlframe/base/functions.py,sha256=uiY9S-fUPEBKDdsisRG4bXpgGrRwj9Y5rsdKyqkSB-4,190182
10
+ sqlframe/base/function_alternatives.py,sha256=m7vH5I88H29hNIWyASl40JIaxxTsMHG8vVXD9DvdmVc,52142
11
+ sqlframe/base/functions.py,sha256=TyKLyn31bM7zo9qr9HMLNwO-zQVTQR4n9LpmHcBTlNg,190185
12
12
  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=-AhNuEzcV7ZExoP1oY3blaKip-joQyJeQVvfBTs_2g4,3456
15
15
  sqlframe/base/readerwriter.py,sha256=9cgOZuB3phZbQufY98JRDBVWRww3hsULc6Or1HK2Onk,26554
16
- sqlframe/base/session.py,sha256=6vQ2bJa357J1bycx1vMxkIUdcA2YbMIYq956bpytztI,25256
16
+ sqlframe/base/session.py,sha256=nfyReCrEbX1YOzhaxJKeCg4Y9Trf9ONXGcrNSJUYudc,25353
17
17
  sqlframe/base/transforms.py,sha256=y0j3SGDz3XCmNGrvassk1S-owllUWfkHyMgZlY6SFO4,467
18
18
  sqlframe/base/types.py,sha256=iBNk9bpFtb2NBIogYS8i7OlQZMRvpR6XxqzBebsjQDU,12280
19
19
  sqlframe/base/udf.py,sha256=O6hMhBUy9NVv-mhJRtfFhXTIa_-Z8Y_FkmmuOHu0l90,1117
@@ -27,7 +27,7 @@ sqlframe/bigquery/__init__.py,sha256=kbaomhYAANPdxeDQhajv8IHfMg_ENKivtYK-rPwaV08
27
27
  sqlframe/bigquery/catalog.py,sha256=8d36IzT5GPWd1FdxJ9vEljOdbIDepHnFOBjwP0bX6FE,11625
28
28
  sqlframe/bigquery/column.py,sha256=E1tUa62Y5HajkhgFuebU9zohrGyieudcHzTT8gfalio,40
29
29
  sqlframe/bigquery/dataframe.py,sha256=Y2uy4FEYw0KxIHgnaA9uMwdIzxJzTlD_NSzIe7P7kxA,2405
30
- sqlframe/bigquery/functions.py,sha256=CxXiBzSLRf9h-9lAM8xSz1CFcVk2tVXU1eFPJ4d_L00,11140
30
+ sqlframe/bigquery/functions.py,sha256=i3pvfBdpaYuox9Kk0QoT_v_RV1XZSfqnX6D7ra1HmSE,11189
31
31
  sqlframe/bigquery/functions.pyi,sha256=GJnEmsTV2PyEzVlowJxpAvOT_6JYY2pVwJ_cZ3lxvz0,13636
32
32
  sqlframe/bigquery/group.py,sha256=UVBNBRTo8OqS-_cS5YwvTeJYgYxeG-d6R3kfyHmlFqw,391
33
33
  sqlframe/bigquery/readwriter.py,sha256=WAD3ZMwkkjOpvPPoZXfaLLNM6tRTeUvdEj-hQZAzXeo,870
@@ -51,8 +51,8 @@ sqlframe/duckdb/__init__.py,sha256=KAw_uZEhFMwi3D9Wj6AgHAKqLNk-EAx2uDIYu56oL44,8
51
51
  sqlframe/duckdb/catalog.py,sha256=YYYVmetLUaJOdObKw4AJ7L0P-msshkta4xHlcZQ9zEA,4795
52
52
  sqlframe/duckdb/column.py,sha256=E1tUa62Y5HajkhgFuebU9zohrGyieudcHzTT8gfalio,40
53
53
  sqlframe/duckdb/dataframe.py,sha256=HZg_uMAz4RsubZJT4-MslUQS_0-InF0_P5Yq5HyJ3wE,1708
54
- sqlframe/duckdb/functions.py,sha256=Ee8o6YFtRdEiq0jNLXxgu5lcbc7Tsg0-lK6oRyxdcjo,1920
55
- sqlframe/duckdb/functions.pyi,sha256=bWfQl7Cm1eecI39LJAyyRcC4z7epDJ-h9JOozPsEc34,5879
54
+ sqlframe/duckdb/functions.py,sha256=auBbRCgnzL74wv_aIsCnRbIAS3pAn4M_QLAaFE_-4tY,1957
55
+ sqlframe/duckdb/functions.pyi,sha256=RH7m6rgiCrXwsmV5SrKeP4KC7V8wVPnuW3_rdeWJLOY,5916
56
56
  sqlframe/duckdb/group.py,sha256=IkhbW42Ng1U5YT3FkIdiB4zBqRkW4QyTb-1detY1e_4,383
57
57
  sqlframe/duckdb/readwriter.py,sha256=6nGnz2SE-tpuPDQXPI23SQQXRre_raUG5cou3s3NrpA,4859
58
58
  sqlframe/duckdb/session.py,sha256=b5IrKbTkYUVNQGSG2EJPNV9MTdJw4onN-9aMrskjxck,2721
@@ -63,7 +63,7 @@ sqlframe/postgres/__init__.py,sha256=NN9WI0-GehvpPdJmTB2VSDVpA5PAtxa3ZkF4BRcTEy4
63
63
  sqlframe/postgres/catalog.py,sha256=9XVXXDW04mY_KmeB52NsCny8n0evqdDCBxhGH1Xce6s,8956
64
64
  sqlframe/postgres/column.py,sha256=E1tUa62Y5HajkhgFuebU9zohrGyieudcHzTT8gfalio,40
65
65
  sqlframe/postgres/dataframe.py,sha256=f-w6UHxZtmeZ5oMbaqJaZ8FrYeOhzyveNlZOK57ke0k,1289
66
- sqlframe/postgres/functions.py,sha256=iujyPmI6frOCD7pymgBby89DezPHm8dmt75sebhzRaw,2636
66
+ sqlframe/postgres/functions.py,sha256=InfSS79gvytVSH8l_qgz1QHY2eod17aWVhtDYxfJjDs,2685
67
67
  sqlframe/postgres/functions.pyi,sha256=9s7W5QPZXPKqxY6XpkxLCHmC5sp1PkJg1LywgpWTz-k,5550
68
68
  sqlframe/postgres/group.py,sha256=KUXeSFKWTSH9yCRJAhW85OvjZaG6Zr4In9LR_ie3yGU,391
69
69
  sqlframe/postgres/readwriter.py,sha256=L1e3yKXzFVNR_W5s1DHaWol7G8x7l4jcZ5sLGualyMk,870
@@ -119,8 +119,8 @@ sqlframe/standalone/udf.py,sha256=azmgtUjHNIPs0WMVNId05SHwiYn41MKVBhKXsQJ5dmY,27
119
119
  sqlframe/standalone/window.py,sha256=6GKPzuxeSapJakBaKBeT9VpED1ACdjggDv9JRILDyV0,35
120
120
  sqlframe/testing/__init__.py,sha256=VVCosQhitU74A3NnE52O4mNtGZONapuEXcc20QmSlnQ,132
121
121
  sqlframe/testing/utils.py,sha256=9DDYVuocO7tygee3RaajuJNZ24sJwf_LY556kKg7kTw,13011
122
- sqlframe-3.9.3.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
123
- sqlframe-3.9.3.dist-info/METADATA,sha256=X-RrDW7IFhHvBCYK7rFLvRCcMPOIBCmlNpwFbOxJmLU,9142
124
- sqlframe-3.9.3.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
125
- sqlframe-3.9.3.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
126
- sqlframe-3.9.3.dist-info/RECORD,,
122
+ sqlframe-3.10.1.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
123
+ sqlframe-3.10.1.dist-info/METADATA,sha256=Oi3DGiOjdux8eryDwFLj55GhEHIKNUo6pydag6t_rck,9188
124
+ sqlframe-3.10.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
125
+ sqlframe-3.10.1.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
126
+ sqlframe-3.10.1.dist-info/RECORD,,