sqlframe 3.28.2__py3-none-any.whl → 3.29.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/dataframe.py +12 -5
- {sqlframe-3.28.2.dist-info → sqlframe-3.29.1.dist-info}/METADATA +10 -7
- {sqlframe-3.28.2.dist-info → sqlframe-3.29.1.dist-info}/RECORD +7 -7
- {sqlframe-3.28.2.dist-info → sqlframe-3.29.1.dist-info}/LICENSE +0 -0
- {sqlframe-3.28.2.dist-info → sqlframe-3.29.1.dist-info}/WHEEL +0 -0
- {sqlframe-3.28.2.dist-info → sqlframe-3.29.1.dist-info}/top_level.txt +0 -0
sqlframe/_version.py
CHANGED
sqlframe/base/dataframe.py
CHANGED
@@ -1595,6 +1595,8 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
|
|
1595
1595
|
|
1596
1596
|
@operation(Operation.LIMIT)
|
1597
1597
|
def limit(self, num: int) -> Self:
|
1598
|
+
if limit_exp := self.expression.args.get("limit"):
|
1599
|
+
num = min(num, int(limit_exp.expression.this))
|
1598
1600
|
return self.copy(expression=self.expression.limit(num))
|
1599
1601
|
|
1600
1602
|
def toDF(self, *cols: str) -> Self:
|
@@ -1850,11 +1852,11 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
|
|
1850
1852
|
def head(self, n: int) -> t.List[Row]: ...
|
1851
1853
|
|
1852
1854
|
def head(self, n: t.Optional[int] = None) -> t.Union[t.Optional[Row], t.List[Row]]:
|
1853
|
-
|
1854
|
-
|
1855
|
-
if n
|
1856
|
-
return
|
1857
|
-
return
|
1855
|
+
df = self.limit(n or 1)
|
1856
|
+
collected = df.collect()
|
1857
|
+
if n is None:
|
1858
|
+
return seq_get(collected, 0)
|
1859
|
+
return collected
|
1858
1860
|
|
1859
1861
|
def first(self) -> t.Optional[Row]:
|
1860
1862
|
return self.head()
|
@@ -1935,6 +1937,11 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
|
|
1935
1937
|
def createGlobalTempView(self, name: str) -> None:
|
1936
1938
|
raise NotImplementedError("Global temp views are not yet supported")
|
1937
1939
|
|
1940
|
+
def isEmpty(self) -> bool:
|
1941
|
+
from sqlframe.base import functions as F
|
1942
|
+
|
1943
|
+
return not bool(self.select(F.lit(True)).head())
|
1944
|
+
|
1938
1945
|
"""
|
1939
1946
|
Stat Functions
|
1940
1947
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sqlframe
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.29.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.15,>=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'
|
@@ -69,18 +69,19 @@ Requires-Dist: pyspark <3.6,>=2 ; extra == 'spark'
|
|
69
69
|
|
70
70
|
SQLFrame implements the PySpark DataFrame API in order to enable running transformation pipelines directly on database engines - no Spark clusters or dependencies required.
|
71
71
|
|
72
|
-
SQLFrame currently supports the following engines
|
72
|
+
SQLFrame currently supports the following engines:
|
73
73
|
|
74
74
|
* [BigQuery](https://sqlframe.readthedocs.io/en/stable/bigquery/)
|
75
|
+
* [Databricks](https://sqlframe.readthedocs.io/en/stable/databricks)
|
75
76
|
* [DuckDB](https://sqlframe.readthedocs.io/en/stable/duckdb)
|
76
77
|
* [Postgres](https://sqlframe.readthedocs.io/en/stable/postgres)
|
77
78
|
* [Snowflake](https://sqlframe.readthedocs.io/en/stable/snowflake)
|
78
79
|
* [Spark](https://sqlframe.readthedocs.io/en/stable/spark)
|
79
80
|
|
80
|
-
There
|
81
|
+
There is also one engine in development. This engine lacks test coverage and robust documentation, but is available for testing:
|
81
82
|
|
82
83
|
* [Redshift](https://sqlframe.readthedocs.io/en/stable/redshift)
|
83
|
-
|
84
|
+
|
84
85
|
|
85
86
|
SQLFrame also has a "Standalone" session that be used to generate SQL without any connection to a database engine.
|
86
87
|
|
@@ -98,6 +99,8 @@ SQLFrame is great for:
|
|
98
99
|
```bash
|
99
100
|
# BigQuery
|
100
101
|
pip install "sqlframe[bigquery]"
|
102
|
+
# Databricks
|
103
|
+
pip install "sqlframe[databricks]"
|
101
104
|
# DuckDB
|
102
105
|
pip install "sqlframe[duckdb]"
|
103
106
|
# Postgres
|
@@ -108,10 +111,10 @@ pip install "sqlframe[snowflake]"
|
|
108
111
|
pip install "sqlframe[spark]"
|
109
112
|
# Redshift (in development)
|
110
113
|
pip install "sqlframe[redshift]"
|
111
|
-
# Databricks (in development)
|
112
|
-
pip install "sqlframe[databricks]"
|
113
114
|
# Standalone
|
114
115
|
pip install sqlframe
|
116
|
+
# Or from conda-forge
|
117
|
+
conda install -c conda-forge sqlframe
|
115
118
|
```
|
116
119
|
|
117
120
|
See specific engine documentation for additional setup instructions.
|
@@ -1,11 +1,11 @@
|
|
1
1
|
sqlframe/__init__.py,sha256=SB80yLTITBXHI2GCDS6n6bN5ObHqgPjfpRPAUwxaots,3403
|
2
|
-
sqlframe/_version.py,sha256=
|
2
|
+
sqlframe/_version.py,sha256=GhEeAzqz63f8BRgFh1f-TAAn74ElZQIuJ1Tt4hNpws4,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=
|
8
|
+
sqlframe/base/dataframe.py,sha256=D2N2Kvh_tiF60fYODUikq0xRCJYY4WB2aHbEcq5NIUo,84310
|
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
|
@@ -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.29.1.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
|
134
|
+
sqlframe-3.29.1.dist-info/METADATA,sha256=hUTGMe5XJuut9wRLCNRQlHeO6q37d1LjSk5yilKUFMI,8978
|
135
|
+
sqlframe-3.29.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
136
|
+
sqlframe-3.29.1.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
|
137
|
+
sqlframe-3.29.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|