sqlframe 2.3.0__py3-none-any.whl → 2.4.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
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '2.3.0'
16
- __version_tuple__ = version_tuple = (2, 3, 0)
15
+ __version__ = version = '2.4.0'
16
+ __version_tuple__ = version_tuple = (2, 4, 0)
sqlframe/base/column.py CHANGED
@@ -339,7 +339,9 @@ class Column:
339
339
  return Column(new_expression)
340
340
 
341
341
  def cast(
342
- self, dataType: t.Union[str, DataType], dialect: t.Optional[t.Union[str, Dialect]] = None
342
+ self,
343
+ dataType: t.Union[str, DataType, exp.DataType, exp.DataType.Type],
344
+ dialect: t.Optional[t.Union[str, Dialect]] = None,
343
345
  ) -> Column:
344
346
  from sqlframe.base.session import _BaseSession
345
347
 
@@ -1593,7 +1593,7 @@ def try_to_timestamp_pgtemp(col: ColumnOrName, format: t.Optional[ColumnOrName]
1593
1593
  def typeof_pg_typeof(col: ColumnOrName) -> Column:
1594
1594
  return (
1595
1595
  Column.invoke_anonymous_function(col, "pg_typeof")
1596
- .cast("regtype", dialect="postgres")
1596
+ .cast(expression.DataType.build("regtype", dialect="postgres"))
1597
1597
  .cast("text")
1598
1598
  )
1599
1599
 
@@ -1603,6 +1603,29 @@ def typeof_from_variant(col: ColumnOrName) -> Column:
1603
1603
  return Column.invoke_anonymous_function(col, "TYPEOF")
1604
1604
 
1605
1605
 
1606
+ def regexp_replace_global_option(
1607
+ str: ColumnOrName, pattern: str, replacement: str, position: t.Optional[int] = None
1608
+ ) -> Column:
1609
+ lit = get_func_from_session("lit")
1610
+
1611
+ if position is not None:
1612
+ return Column.invoke_expression_over_column(
1613
+ str,
1614
+ expression.RegexpReplace,
1615
+ expression=lit(pattern),
1616
+ replacement=lit(replacement),
1617
+ position=lit(position),
1618
+ modifiers=lit("g"),
1619
+ )
1620
+ return Column.invoke_expression_over_column(
1621
+ str,
1622
+ expression.RegexpReplace,
1623
+ expression=lit(pattern),
1624
+ replacement=lit(replacement),
1625
+ modifiers=lit("g"),
1626
+ )
1627
+
1628
+
1606
1629
  def _is_string_using_typeof_varchar(col: ColumnOrName) -> Column:
1607
1630
  typeof = get_func_from_session("typeof")
1608
1631
  lit = get_func_from_session("lit")
@@ -52,4 +52,5 @@ from sqlframe.base.function_alternatives import ( # noqa
52
52
  array_append_list_append as array_append,
53
53
  endswith_with_underscore as endswith,
54
54
  last_day_with_cast as last_day,
55
+ regexp_replace_global_option as regexp_replace,
55
56
  )
@@ -28,6 +28,7 @@ from sqlframe.base.function_alternatives import ( # noqa
28
28
  sequence_from_generate_series as sequence,
29
29
  try_element_at_zero_based as try_element_at,
30
30
  to_unix_timestamp_include_default_format as to_unix_timestamp,
31
+ regexp_replace_global_option as regexp_replace,
31
32
  )
32
33
  from sqlframe.base.functions import (
33
34
  abs as abs,
@@ -156,7 +157,6 @@ from sqlframe.base.functions import (
156
157
  rank as rank,
157
158
  regexp_extract as regexp_extract,
158
159
  regexp_like as regexp_like,
159
- regexp_replace as regexp_replace,
160
160
  repeat as repeat,
161
161
  reverse as reverse,
162
162
  right as right,
@@ -69,4 +69,5 @@ from sqlframe.base.function_alternatives import ( # noqa
69
69
  _is_string_using_typeof_char_varying as _is_string,
70
70
  endswith_using_like as endswith,
71
71
  last_day_with_cast as last_day,
72
+ regexp_replace_global_option as regexp_replace,
72
73
  )
@@ -47,6 +47,7 @@ from sqlframe.base.function_alternatives import ( # noqa
47
47
  right_cast_len as right,
48
48
  position_cast_start as position,
49
49
  try_element_at_zero_based as try_element_at,
50
+ regexp_replace_global_option as regexp_replace,
50
51
  )
51
52
  from sqlframe.base.functions import (
52
53
  abs as abs,
@@ -148,7 +149,6 @@ from sqlframe.base.functions import (
148
149
  radians as radians,
149
150
  rank as rank,
150
151
  regexp_like as regexp_like,
151
- regexp_replace as regexp_replace,
152
152
  repeat as repeat,
153
153
  reverse as reverse,
154
154
  rlike as rlike,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlframe
3
- Version: 2.3.0
3
+ Version: 2.4.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
@@ -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.11.1)
21
- Requires-Dist: sqlglot (<25.16,>=24.0.0)
21
+ Requires-Dist: sqlglot (<25.17,>=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'
@@ -1,13 +1,13 @@
1
1
  sqlframe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- sqlframe/_version.py,sha256=ChsIHG8bRc-eXUbXOgv4Fm4DstSKLq9FpsTAsaMeR08,411
2
+ sqlframe/_version.py,sha256=NXpAHvzuYHxlLDJV0489874frLu4dA2joFw1iHLLrOg,411
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
- sqlframe/base/column.py,sha256=csci74Cdi7S7xpyAUfX6QVvlPDe4uR-S8Ejb50uCIfI,17698
6
+ sqlframe/base/column.py,sha256=C2xj6OHMsJbEgjbI-m5HuIvqHYt2DbbUtCjssKpplNk,17748
7
7
  sqlframe/base/dataframe.py,sha256=CHoSK7g9ceuX_4c8yL3nbq1nb15dGt2g_W0UBlBA-Nc,71132
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=VpBE1-p4_WifKoqeLJbZQFZ5MWJhNAEYCiQ2eE3hAOk,50015
10
+ sqlframe/base/function_alternatives.py,sha256=IxNBqplehkAEkpzA625Dif-9Xyi4Hrho81A9U262rV0,50714
11
11
  sqlframe/base/functions.py,sha256=2dDfPepAuQvLcxwaZbj9qJeEeiqOaYJDI3vPoZXoM1Q,189959
12
12
  sqlframe/base/group.py,sha256=TES9CleVmH3x-0X-tqmuUKfCKSWjH5vg1aU3R6dDmFc,4059
13
13
  sqlframe/base/normalize.py,sha256=nXAJ5CwxVf4DV0GsH-q1w0p8gmjSMlv96k_ez1eVul8,3880
@@ -39,8 +39,8 @@ sqlframe/duckdb/__init__.py,sha256=t85TA3ufZtL1weQNFmEs8itCSwbJFtw03-p0GT4XGf8,6
39
39
  sqlframe/duckdb/catalog.py,sha256=YYYVmetLUaJOdObKw4AJ7L0P-msshkta4xHlcZQ9zEA,4795
40
40
  sqlframe/duckdb/column.py,sha256=wkEPcp3xVsH5nC3kpacXqNkRv9htPtBgt-0uFRxIRNs,56
41
41
  sqlframe/duckdb/dataframe.py,sha256=QYFFj6a2uYpJUGB-s0MEX2z7HgjfPbL6ZKI4BFjVI6o,1394
42
- sqlframe/duckdb/functions.py,sha256=ZCmiHegr7484nNmTycxI9f5pDIDhIV3m5zTFK4hMD4Q,1868
43
- sqlframe/duckdb/functions.pyi,sha256=nU-6a2cfLDkuMCdYrNRLfa6-i8Aa0CxQQ1nLT6roIdI,5813
42
+ sqlframe/duckdb/functions.py,sha256=Ee8o6YFtRdEiq0jNLXxgu5lcbc7Tsg0-lK6oRyxdcjo,1920
43
+ sqlframe/duckdb/functions.pyi,sha256=Qn6j4zwwuBsh6q9341dR3Z5kpeRsgvM4u6Bb6FekKrI,5827
44
44
  sqlframe/duckdb/group.py,sha256=IkhbW42Ng1U5YT3FkIdiB4zBqRkW4QyTb-1detY1e_4,383
45
45
  sqlframe/duckdb/readwriter.py,sha256=0qZcARQoWYlx9P2m0uS2vuMj_tG_ka4NhHzg7qdaR3I,4597
46
46
  sqlframe/duckdb/session.py,sha256=dj8kOTklBHKTyFGc3UwbgFlloPnfIDUf1Sh4uaO1hSg,2340
@@ -51,8 +51,8 @@ sqlframe/postgres/__init__.py,sha256=Sz_MtgV_oh_QhfZTC7iKM07ICUmNcJEDV0kEkSW9ZKU
51
51
  sqlframe/postgres/catalog.py,sha256=9XVXXDW04mY_KmeB52NsCny8n0evqdDCBxhGH1Xce6s,8956
52
52
  sqlframe/postgres/column.py,sha256=E1tUa62Y5HajkhgFuebU9zohrGyieudcHzTT8gfalio,40
53
53
  sqlframe/postgres/dataframe.py,sha256=f-w6UHxZtmeZ5oMbaqJaZ8FrYeOhzyveNlZOK57ke0k,1289
54
- sqlframe/postgres/functions.py,sha256=ZWfb2sX3ZplT-tBsrsaXDc9lPzXoE-8ZflzP_FUfwDs,2584
55
- sqlframe/postgres/functions.pyi,sha256=um-qE2g9iPs0-53vJ46lArbfvDqAbFIwrxLJgcrPM_8,5536
54
+ sqlframe/postgres/functions.py,sha256=iujyPmI6frOCD7pymgBby89DezPHm8dmt75sebhzRaw,2636
55
+ sqlframe/postgres/functions.pyi,sha256=9s7W5QPZXPKqxY6XpkxLCHmC5sp1PkJg1LywgpWTz-k,5550
56
56
  sqlframe/postgres/group.py,sha256=KUXeSFKWTSH9yCRJAhW85OvjZaG6Zr4In9LR_ie3yGU,391
57
57
  sqlframe/postgres/readwriter.py,sha256=L1e3yKXzFVNR_W5s1DHaWol7G8x7l4jcZ5sLGualyMk,870
58
58
  sqlframe/postgres/session.py,sha256=LkM35-ADkIh2OSNT6HRVfJ8jLOoFlrdgkSSVhFGMYRc,2495
@@ -107,8 +107,8 @@ sqlframe/standalone/udf.py,sha256=azmgtUjHNIPs0WMVNId05SHwiYn41MKVBhKXsQJ5dmY,27
107
107
  sqlframe/standalone/window.py,sha256=6GKPzuxeSapJakBaKBeT9VpED1ACdjggDv9JRILDyV0,35
108
108
  sqlframe/testing/__init__.py,sha256=VVCosQhitU74A3NnE52O4mNtGZONapuEXcc20QmSlnQ,132
109
109
  sqlframe/testing/utils.py,sha256=9DDYVuocO7tygee3RaajuJNZ24sJwf_LY556kKg7kTw,13011
110
- sqlframe-2.3.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
111
- sqlframe-2.3.0.dist-info/METADATA,sha256=LfFNeDCnR9HwIB3tA5VSBk00O9I1z_XcD75_UgVYICk,7812
112
- sqlframe-2.3.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
113
- sqlframe-2.3.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
114
- sqlframe-2.3.0.dist-info/RECORD,,
110
+ sqlframe-2.4.0.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
111
+ sqlframe-2.4.0.dist-info/METADATA,sha256=dfjbBh14A6aUdyiaO4H-rqMVNyChQ7TgncCAwPjjcrQ,7812
112
+ sqlframe-2.4.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
113
+ sqlframe-2.4.0.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
114
+ sqlframe-2.4.0.dist-info/RECORD,,