sqlframe 3.25.0__py3-none-any.whl → 3.26.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.25.0'
21
- __version_tuple__ = version_tuple = (3, 25, 0)
20
+ __version__ = version = '3.26.0'
21
+ __version_tuple__ = version_tuple = (3, 26, 0)
@@ -551,6 +551,17 @@ def sha1_force_sha1_and_to_hex(col: ColumnOrName) -> Column:
551
551
  )
552
552
 
553
553
 
554
+ def sha2_sha265(col: ColumnOrName) -> Column:
555
+ col_func = get_func_from_session("col")
556
+
557
+ return Column(
558
+ expression.Anonymous(
559
+ this="SHA256",
560
+ expressions=[col_func(col).column_expression],
561
+ )
562
+ )
563
+
564
+
554
565
  def hash_from_farm_fingerprint(*cols: ColumnOrName) -> Column:
555
566
  if len(cols) > 1:
556
567
  raise ValueError("This dialect only supports a single column for calculating hash")
@@ -1492,7 +1492,7 @@ def md5(col: ColumnOrName) -> Column:
1492
1492
  return Column.invoke_expression_over_column(col, expression.MD5)
1493
1493
 
1494
1494
 
1495
- @meta(unsupported_engines=["duckdb", "postgres"])
1495
+ @meta(unsupported_engines=["postgres"])
1496
1496
  def sha1(col: ColumnOrName) -> Column:
1497
1497
  from sqlframe.base.function_alternatives import sha1_force_sha1_and_to_hex
1498
1498
 
@@ -1504,8 +1504,18 @@ def sha1(col: ColumnOrName) -> Column:
1504
1504
  return Column.invoke_expression_over_column(col, expression.SHA)
1505
1505
 
1506
1506
 
1507
- @meta(unsupported_engines=["bigquery", "duckdb", "postgres"])
1507
+ @meta(unsupported_engines=["bigquery", "postgres"])
1508
1508
  def sha2(col: ColumnOrName, numBits: int) -> Column:
1509
+ from sqlframe.base.function_alternatives import sha2_sha265
1510
+
1511
+ session = _get_session()
1512
+
1513
+ if session._is_duckdb:
1514
+ if numBits in [256, 0]:
1515
+ return sha2_sha265(col)
1516
+ else:
1517
+ raise ValueError("This dialect only supports SHA-265 (numBits=256 or numBits=0)")
1518
+
1509
1519
  return Column.invoke_expression_over_column(col, expression.SHA2, length=lit(numBits))
1510
1520
 
1511
1521
 
@@ -2355,7 +2365,7 @@ def from_json(
2355
2365
  schema = schema.simpleString()
2356
2366
  schema = schema if isinstance(schema, Column) else lit(schema)
2357
2367
  if options is not None:
2358
- options_col = create_map([lit(x) for x in _flatten(options.items())])
2368
+ options_col = create_map([lit(str(x)) for x in _flatten(options.items())])
2359
2369
  return Column.invoke_anonymous_function(col, "FROM_JSON", schema, options_col)
2360
2370
  return Column.invoke_anonymous_function(col, "FROM_JSON", schema)
2361
2371
 
@@ -2389,7 +2399,7 @@ def schema_of_json(col: ColumnOrName, options: t.Optional[t.Dict[str, str]] = No
2389
2399
  if isinstance(col, str):
2390
2400
  col = lit(col)
2391
2401
  if options is not None:
2392
- options_col = create_map([lit(x) for x in _flatten(options.items())])
2402
+ options_col = create_map([lit(str(x)) for x in _flatten(options.items())])
2393
2403
  return Column.invoke_anonymous_function(col, "SCHEMA_OF_JSON", options_col)
2394
2404
  return Column.invoke_anonymous_function(col, "SCHEMA_OF_JSON")
2395
2405
 
@@ -2399,7 +2409,7 @@ def schema_of_csv(col: ColumnOrName, options: t.Optional[t.Dict[str, str]] = Non
2399
2409
  if isinstance(col, str):
2400
2410
  col = lit(col)
2401
2411
  if options is not None:
2402
- options_col = create_map([lit(x) for x in _flatten(options.items())])
2412
+ options_col = create_map([lit(str(x)) for x in _flatten(options.items())])
2403
2413
  return Column.invoke_anonymous_function(col, "SCHEMA_OF_CSV", options_col)
2404
2414
  return Column.invoke_anonymous_function(col, "SCHEMA_OF_CSV")
2405
2415
 
@@ -2407,7 +2417,7 @@ def schema_of_csv(col: ColumnOrName, options: t.Optional[t.Dict[str, str]] = Non
2407
2417
  @meta(unsupported_engines=["bigquery", "duckdb", "postgres", "snowflake"])
2408
2418
  def to_csv(col: ColumnOrName, options: t.Optional[t.Dict[str, str]] = None) -> Column:
2409
2419
  if options is not None:
2410
- options_col = create_map([lit(x) for x in _flatten(options.items())])
2420
+ options_col = create_map([lit(str(x)) for x in _flatten(options.items())])
2411
2421
  return Column.invoke_anonymous_function(col, "TO_CSV", options_col)
2412
2422
  return Column.invoke_anonymous_function(col, "TO_CSV")
2413
2423
 
@@ -166,6 +166,7 @@ from sqlframe.base.functions import rpad as rpad
166
166
  from sqlframe.base.functions import rtrim as rtrim
167
167
  from sqlframe.base.functions import second as second
168
168
  from sqlframe.base.functions import sequence as sequence
169
+ from sqlframe.base.functions import sha1 as sha1
169
170
  from sqlframe.base.functions import shiftLeft as shiftLeft
170
171
  from sqlframe.base.functions import shiftleft as shiftleft
171
172
  from sqlframe.base.functions import shiftRight as shiftRight
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlframe
3
- Version: 3.25.0
3
+ Version: 3.26.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=lX2iL8aKS-SZi2TbIojy_xpiTXHlvGXPfxFC3OMcj2o,513
2
+ sqlframe/_version.py,sha256=O47f8PhfWsbiZ4mjHJkrL81FZEFxis7lNo0FJknkGus,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
@@ -8,8 +8,8 @@ sqlframe/base/column.py,sha256=AG9Z_6RNhVxLhLU29kRCgzMgDNSm-_GFg96xLqk1-bs,19838
8
8
  sqlframe/base/dataframe.py,sha256=OgEUlDI5Y4rWrVngW5LttCUMC40WR-Pyr5af6aqbMNU,84028
9
9
  sqlframe/base/decorators.py,sha256=ms-CvDOIW3T8IVB9VqDmLwAiaEsqXLYRXEqVQaxktiM,1890
10
10
  sqlframe/base/exceptions.py,sha256=9Uwvqn2eAkDpqm4BrRgbL61qM-GMCbJEMAW8otxO46s,370
11
- sqlframe/base/function_alternatives.py,sha256=KFkEm0aIHzajvQmiPZnzTLh-Ud9wjeg4lJ4Rk0vk-YU,53674
12
- sqlframe/base/functions.py,sha256=W96Fg6hCXYgFfJOEt4HTam61ZUNkBp7cutv1ZEAX3H8,224000
11
+ sqlframe/base/function_alternatives.py,sha256=Bs1bwl25fN3Yy9rb4GnUWBGunQ1C_yelkb2yV9DSZIY,53918
12
+ sqlframe/base/functions.py,sha256=mSwASQe1WGyMzcwYudioJCR-bvOoqasuqNDFQ2GCC6g,224299
13
13
  sqlframe/base/group.py,sha256=4R9sOZm4ZRlTfShq2j3_HQOiL_Tj1bYkouenYsgnlII,4115
14
14
  sqlframe/base/normalize.py,sha256=nXAJ5CwxVf4DV0GsH-q1w0p8gmjSMlv96k_ez1eVul8,3880
15
15
  sqlframe/base/operations.py,sha256=g-YNcbvNKTOBbYm23GKfB3fmydlR7ZZDAuZUtXIHtzw,4438
@@ -57,7 +57,7 @@ sqlframe/duckdb/catalog.py,sha256=89FCSJglMbOxonk3IXmlkMcdXCfMdePpGfqlbkkB_d0,51
57
57
  sqlframe/duckdb/column.py,sha256=E1tUa62Y5HajkhgFuebU9zohrGyieudcHzTT8gfalio,40
58
58
  sqlframe/duckdb/dataframe.py,sha256=Z8_K69UQGZVeBfVGXVwIJP8OMuIvNBB3DPKTP3Lfu4w,1908
59
59
  sqlframe/duckdb/functions.py,sha256=ix2efGGD4HLaY1rtCtEd3IrsicGEVGiBAeKOo5OD8rA,424
60
- sqlframe/duckdb/functions.pyi,sha256=Ih8XqqTV1VcsdBUPV4V9jx1d13QPggTb-BkQZcA4iCQ,12438
60
+ sqlframe/duckdb/functions.pyi,sha256=dileIrfRspqWPBFUlXn3R8YLBQqhq0XnH6_6Rp8x1PA,12487
61
61
  sqlframe/duckdb/group.py,sha256=IkhbW42Ng1U5YT3FkIdiB4zBqRkW4QyTb-1detY1e_4,383
62
62
  sqlframe/duckdb/readwriter.py,sha256=-_Ama7evadIa3PYvynKDK6RcTMTDBHpHJzfANTine7g,4983
63
63
  sqlframe/duckdb/session.py,sha256=H1qjMYmhpwUHmf6jOPA6IhPIEIeX8rlvOl3MTIEijG0,2719
@@ -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.25.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
134
- sqlframe-3.25.0.dist-info/METADATA,sha256=qXwyR7B-HVkPnO4ZGah338Mu-mK7F-9bliiB_5mRAGE,8971
135
- sqlframe-3.25.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
136
- sqlframe-3.25.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
137
- sqlframe-3.25.0.dist-info/RECORD,,
133
+ sqlframe-3.26.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
134
+ sqlframe-3.26.0.dist-info/METADATA,sha256=v5x-leHKJrTGK_cyWjXlJRBwLr0VrX1av511o4tKI-E,8971
135
+ sqlframe-3.26.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
136
+ sqlframe-3.26.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
137
+ sqlframe-3.26.0.dist-info/RECORD,,