sqlframe 3.28.1__py3-none-any.whl → 3.29.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 CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '3.28.1'
21
- __version_tuple__ = version_tuple = (3, 28, 1)
20
+ __version__ = version = '3.29.0'
21
+ __version_tuple__ = version_tuple = (3, 29, 0)
@@ -80,8 +80,6 @@ JOIN_HINTS = {
80
80
  }
81
81
 
82
82
  JOIN_TYPE_MAPPING = {
83
- "inner": "inner",
84
- "cross": "cross",
85
83
  "outer": "full_outer",
86
84
  "full": "full_outer",
87
85
  "fullouter": "full_outer",
@@ -91,10 +89,8 @@ JOIN_TYPE_MAPPING = {
91
89
  "rightouter": "right_outer",
92
90
  "semi": "left_semi",
93
91
  "leftsemi": "left_semi",
94
- "left_semi": "left_semi",
95
92
  "anti": "left_anti",
96
93
  "leftanti": "left_anti",
97
- "left_anti": "left_anti",
98
94
  }
99
95
 
100
96
  DF = t.TypeVar("DF", bound="BaseDataFrame")
@@ -1028,7 +1024,7 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
1028
1024
  @operation(Operation.FROM)
1029
1025
  def join(
1030
1026
  self,
1031
- other_df: Self,
1027
+ other: Self,
1032
1028
  on: t.Optional[t.Union[str, t.List[str], Column, t.List[Column]]] = None,
1033
1029
  how: str = "inner",
1034
1030
  **kwargs,
@@ -1044,7 +1040,7 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
1044
1040
  logger.warning("Got cross join with an 'on' value. This will result in an inner join.")
1045
1041
  how = "inner"
1046
1042
 
1047
- other_df = other_df._convert_leaf_to_cte()
1043
+ other_df = other._convert_leaf_to_cte()
1048
1044
  join_expression = self._add_ctes_to_expression(self.expression, other_df.expression.ctes)
1049
1045
  # We will determine actual "join on" expression later so we don't provide it at first
1050
1046
  join_type = JOIN_TYPE_MAPPING.get(how, how).replace("_", " ")
@@ -1599,6 +1595,8 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
1599
1595
 
1600
1596
  @operation(Operation.LIMIT)
1601
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))
1602
1600
  return self.copy(expression=self.expression.limit(num))
1603
1601
 
1604
1602
  def toDF(self, *cols: str) -> Self:
@@ -1854,11 +1852,11 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
1854
1852
  def head(self, n: int) -> t.List[Row]: ...
1855
1853
 
1856
1854
  def head(self, n: t.Optional[int] = None) -> t.Union[t.Optional[Row], t.List[Row]]:
1857
- n = n or 1
1858
- df = self.limit(n)
1859
- if n == 1:
1860
- return df.collect()[0]
1861
- return df.collect()
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
1862
1860
 
1863
1861
  def first(self) -> t.Optional[Row]:
1864
1862
  return self.head()
@@ -1939,6 +1937,11 @@ class BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
1939
1937
  def createGlobalTempView(self, name: str) -> None:
1940
1938
  raise NotImplementedError("Global temp views are not yet supported")
1941
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
+
1942
1945
  """
1943
1946
  Stat Functions
1944
1947
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlframe
3
- Version: 3.28.1
3
+ Version: 3.29.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
@@ -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 (many more in development):
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 are also two engines in development. These engines lack test coverage and robust documentation, but are available for early testing:
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
- * [Databricks](https://sqlframe.readthedocs.io/en/stable/databricks)
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,8 +111,6 @@ 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
115
116
  ```
@@ -1,11 +1,11 @@
1
1
  sqlframe/__init__.py,sha256=SB80yLTITBXHI2GCDS6n6bN5ObHqgPjfpRPAUwxaots,3403
2
- sqlframe/_version.py,sha256=A-DozXRgJ1GLBl_eHEhQbTd1M98mV_YRq5bK5pd8Y5s,513
2
+ sqlframe/_version.py,sha256=OsI8JHahRj2deRNv0lP32D0W4kMOH1vXOQfyhRqxRos,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=YaXf2rixLRz8CIqyH__XZNz6zhtW3cLwJcHMezUv_BU,84138
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.28.1.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
134
- sqlframe-3.28.1.dist-info/METADATA,sha256=Uj6Y7-cFVwC36CpmSaZLn3Ual76hfPkqr2jjF7TqFLg,8971
135
- sqlframe-3.28.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
136
- sqlframe-3.28.1.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
137
- sqlframe-3.28.1.dist-info/RECORD,,
133
+ sqlframe-3.29.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
134
+ sqlframe-3.29.0.dist-info/METADATA,sha256=0bSBzyT55lAQRUMQcz92sGhoaFOrc9h2EPIRyKPHRbo,8918
135
+ sqlframe-3.29.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
136
+ sqlframe-3.29.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
137
+ sqlframe-3.29.0.dist-info/RECORD,,