sqlframe 3.41.0__py3-none-any.whl → 3.42.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
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '3.41.0'
32
- __version_tuple__ = version_tuple = (3, 41, 0)
31
+ __version__ = version = '3.42.0'
32
+ __version_tuple__ = version_tuple = (3, 42, 0)
33
33
 
34
- __commit_id__ = commit_id = 'g961d3fda2'
34
+ __commit_id__ = commit_id = 'gadde0dd66'
@@ -1974,8 +1974,30 @@ def regexp_replace(
1974
1974
  )
1975
1975
 
1976
1976
 
1977
- @meta(unsupported_engines="duckdb")
1977
+ @meta()
1978
1978
  def initcap(col: ColumnOrName) -> Column:
1979
+ session = _get_session()
1980
+
1981
+ if session._is_duckdb:
1982
+ split_func = get_func_from_session("split")
1983
+ transform_func = get_func_from_session("transform")
1984
+ reduce_func = get_func_from_session("reduce")
1985
+ upper_func = get_func_from_session("upper")
1986
+ lower_func = get_func_from_session("lower")
1987
+ length_func = get_func_from_session("length")
1988
+ concat_func = get_func_from_session("concat")
1989
+ concat_ws_func = get_func_from_session("concat_ws")
1990
+ return reduce_func(
1991
+ transform_func(
1992
+ split_func(col, r"\s+"),
1993
+ lambda w: concat_func(
1994
+ upper_func(w.substr(1, 1)), lower_func(w.substr(2, length_func(w) - 1))
1995
+ ),
1996
+ ),
1997
+ None,
1998
+ merge=lambda x, y: concat_ws_func(" ", x, y),
1999
+ )
2000
+
1979
2001
  return Column.invoke_expression_over_column(col, expression.Initcap)
1980
2002
 
1981
2003
 
@@ -2686,7 +2708,7 @@ def from_csv(
2686
2708
  return Column.invoke_anonymous_function(col, "FROM_CSV", schema)
2687
2709
 
2688
2710
 
2689
- @meta(unsupported_engines=["bigquery", "duckdb", "postgres", "snowflake"])
2711
+ @meta(unsupported_engines=["bigquery", "postgres", "snowflake"])
2690
2712
  def aggregate(
2691
2713
  col: ColumnOrName,
2692
2714
  initialValue: ColumnOrName,
@@ -2694,21 +2716,20 @@ def aggregate(
2694
2716
  finish: t.Optional[t.Callable[[Column], Column]] = None,
2695
2717
  ) -> Column:
2696
2718
  merge_exp = _get_lambda_from_func(merge)
2719
+ kwargs = dict(
2720
+ initial=initialValue,
2721
+ merge=merge_exp,
2722
+ )
2723
+ session = _get_session()
2697
2724
  if finish is not None:
2698
2725
  finish_exp = _get_lambda_from_func(finish)
2699
- return Column.invoke_expression_over_column(
2700
- col,
2701
- expression.Reduce,
2702
- initial=initialValue,
2703
- merge=Column(merge_exp),
2704
- finish=Column(finish_exp),
2705
- )
2706
- return Column.invoke_expression_over_column(
2707
- col, expression.Reduce, initial=initialValue, merge=Column(merge_exp)
2708
- )
2726
+ kwargs["finish"] = Column(finish_exp)
2727
+ if session._is_duckdb:
2728
+ kwargs.pop("initial", None)
2729
+ return Column.invoke_expression_over_column(col, expression.Reduce, **kwargs)
2709
2730
 
2710
2731
 
2711
- @meta(unsupported_engines=["bigquery", "duckdb", "postgres", "snowflake"])
2732
+ @meta(unsupported_engines="postgres")
2712
2733
  def transform(
2713
2734
  col: ColumnOrName,
2714
2735
  f: t.Union[t.Callable[[Column], Column], t.Callable[[Column, Column], Column]],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlframe
3
- Version: 3.41.0
3
+ Version: 3.42.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
@@ -1,5 +1,5 @@
1
1
  sqlframe/__init__.py,sha256=SB80yLTITBXHI2GCDS6n6bN5ObHqgPjfpRPAUwxaots,3403
2
- sqlframe/_version.py,sha256=dgLbChf8wsQ5H9o1FXadKfn_qB0pcaOHICUJO8Rhj6U,714
2
+ sqlframe/_version.py,sha256=SsOOM9QJfro_JWrCpQSS5Pq52ergp6bxQ1nOQPkMZJs,714
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
@@ -9,7 +9,7 @@ sqlframe/base/dataframe.py,sha256=Kl3WycARIWBBIze0enmZDGkfOt65mZDQ2hx_6pxRsxI,87
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=vlPGxKlgU1oFmXD8WDClpZlDvvC4L4q5qJs4qrG9xjw,228101
12
+ sqlframe/base/functions.py,sha256=QaCeMMBLz69LE-73x4ksXN6NbZlsshYADg-F8yRXTPA,228816
13
13
  sqlframe/base/group.py,sha256=fBm8EUve7W7xz11nybTXr09ih-yZxL_vvEiZVE1eb_0,12025
14
14
  sqlframe/base/normalize.py,sha256=YPeopWr8ZRjevArYfrM-DZBkQp4t4UfAEwynoj4VvcU,11773
15
15
  sqlframe/base/operations.py,sha256=g-YNcbvNKTOBbYm23GKfB3fmydlR7ZZDAuZUtXIHtzw,4438
@@ -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.41.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
134
- sqlframe-3.41.0.dist-info/METADATA,sha256=O8Y62mZw3zncgCc6RWb8i4_zHyeNySrjl6AeQV_tflc,9070
135
- sqlframe-3.41.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
136
- sqlframe-3.41.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
137
- sqlframe-3.41.0.dist-info/RECORD,,
133
+ sqlframe-3.42.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
134
+ sqlframe-3.42.0.dist-info/METADATA,sha256=g3qTG2C4TsHFM1Q_pkybk7u_Sp4OY5nshpsSsQPKzTM,9070
135
+ sqlframe-3.42.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
136
+ sqlframe-3.42.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
137
+ sqlframe-3.42.0.dist-info/RECORD,,