sqlframe 3.39.0__py3-none-any.whl → 3.39.2__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 +16 -3
- sqlframe/base/functions.py +8 -4
- sqlframe/base/util.py +7 -3
- sqlframe/databricks/catalog.py +1 -5
- sqlframe/databricks/readwriter.py +1 -6
- sqlframe/duckdb/readwriter.py +1 -4
- sqlframe/spark/readwriter.py +0 -1
- {sqlframe-3.39.0.dist-info → sqlframe-3.39.2.dist-info}/METADATA +2 -2
- {sqlframe-3.39.0.dist-info → sqlframe-3.39.2.dist-info}/RECORD +12 -12
- {sqlframe-3.39.0.dist-info → sqlframe-3.39.2.dist-info}/LICENSE +0 -0
- {sqlframe-3.39.0.dist-info → sqlframe-3.39.2.dist-info}/WHEEL +0 -0
- {sqlframe-3.39.0.dist-info → sqlframe-3.39.2.dist-info}/top_level.txt +0 -0
sqlframe/_version.py
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# file generated by setuptools-scm
|
2
2
|
# don't change, don't track in version control
|
3
3
|
|
4
|
-
__all__ = [
|
4
|
+
__all__ = [
|
5
|
+
"__version__",
|
6
|
+
"__version_tuple__",
|
7
|
+
"version",
|
8
|
+
"version_tuple",
|
9
|
+
"__commit_id__",
|
10
|
+
"commit_id",
|
11
|
+
]
|
5
12
|
|
6
13
|
TYPE_CHECKING = False
|
7
14
|
if TYPE_CHECKING:
|
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
|
|
9
16
|
from typing import Union
|
10
17
|
|
11
18
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
19
|
+
COMMIT_ID = Union[str, None]
|
12
20
|
else:
|
13
21
|
VERSION_TUPLE = object
|
22
|
+
COMMIT_ID = object
|
14
23
|
|
15
24
|
version: str
|
16
25
|
__version__: str
|
17
26
|
__version_tuple__: VERSION_TUPLE
|
18
27
|
version_tuple: VERSION_TUPLE
|
28
|
+
commit_id: COMMIT_ID
|
29
|
+
__commit_id__: COMMIT_ID
|
19
30
|
|
20
|
-
__version__ = version = '3.39.
|
21
|
-
__version_tuple__ = version_tuple = (3, 39,
|
31
|
+
__version__ = version = '3.39.2'
|
32
|
+
__version_tuple__ = version_tuple = (3, 39, 2)
|
33
|
+
|
34
|
+
__commit_id__ = commit_id = 'g772b3a6bf'
|
sqlframe/base/functions.py
CHANGED
@@ -1984,7 +1984,7 @@ def initcap(col: ColumnOrName) -> Column:
|
|
1984
1984
|
|
1985
1985
|
@meta()
|
1986
1986
|
def soundex(col: ColumnOrName) -> Column:
|
1987
|
-
return Column.
|
1987
|
+
return Column.invoke_expression_over_column(col, expression.Soundex)
|
1988
1988
|
|
1989
1989
|
|
1990
1990
|
@meta(unsupported_engines=["postgres", "snowflake"])
|
@@ -2053,7 +2053,11 @@ def bit_length(col: ColumnOrName) -> Column:
|
|
2053
2053
|
|
2054
2054
|
@meta()
|
2055
2055
|
def translate(srcCol: ColumnOrName, matching: str, replace: str) -> Column:
|
2056
|
-
return Column.
|
2056
|
+
return Column.invoke_expression_over_column(
|
2057
|
+
srcCol,
|
2058
|
+
expression.Translate,
|
2059
|
+
**{"from": lit(matching).column_expression, "to": lit(replace).column_expression},
|
2060
|
+
)
|
2057
2061
|
|
2058
2062
|
|
2059
2063
|
@meta()
|
@@ -3380,7 +3384,7 @@ def get_active_spark_context() -> SparkContext:
|
|
3380
3384
|
return session.spark_session.sparkContext
|
3381
3385
|
|
3382
3386
|
|
3383
|
-
@meta(
|
3387
|
+
@meta()
|
3384
3388
|
def grouping(col: ColumnOrName) -> Column:
|
3385
3389
|
"""
|
3386
3390
|
Aggregate function: indicates whether a specified column in a GROUP BY list is aggregated
|
@@ -3413,7 +3417,7 @@ def grouping(col: ColumnOrName) -> Column:
|
|
3413
3417
|
| Bob| 0| 5|
|
3414
3418
|
+-----+--------------+--------+
|
3415
3419
|
"""
|
3416
|
-
return Column.
|
3420
|
+
return Column(expression.Grouping(expressions=[Column.ensure_col(col).column_expression]))
|
3417
3421
|
|
3418
3422
|
|
3419
3423
|
@meta(unsupported_engines="*")
|
sqlframe/base/util.py
CHANGED
@@ -113,9 +113,13 @@ def get_tables_from_expression_with_join(expression: exp.Select) -> t.List[exp.T
|
|
113
113
|
|
114
114
|
|
115
115
|
def to_csv(options: t.Dict[str, OptionalPrimitiveType], equality_char: str = "=") -> str:
|
116
|
-
|
117
|
-
|
118
|
-
|
116
|
+
results = []
|
117
|
+
for k, v in (options or {}).items():
|
118
|
+
if v is None:
|
119
|
+
continue
|
120
|
+
v = f"'{v}'" if isinstance(v, str) else v
|
121
|
+
results.append(f"{k}{equality_char}{v}")
|
122
|
+
return ", ".join(results)
|
119
123
|
|
120
124
|
|
121
125
|
def ensure_column_mapping(schema: t.Union[str, StructType]) -> t.Dict:
|
sqlframe/databricks/catalog.py
CHANGED
@@ -461,11 +461,7 @@ class DatabricksCatalog(
|
|
461
461
|
exp.Property(this=sg.to_identifier(name=k), value=exp.convert(value=v))
|
462
462
|
for k, v in (table_properties if isinstance(table_properties, dict) else {}).items()
|
463
463
|
)
|
464
|
-
|
465
|
-
format_options: dict[str, t.Union[bool, float, int, str, None]] = {
|
466
|
-
key: f"'{val}'" for key, val in options.items() if val is not None
|
467
|
-
}
|
468
|
-
format_options_str = to_csv(format_options, " ")
|
464
|
+
format_options_str = to_csv(options, " ") # type: ignore
|
469
465
|
|
470
466
|
output_expression_container = exp.Create(
|
471
467
|
this=exp.Schema(
|
@@ -128,8 +128,6 @@ class DatabricksDataFrameReader(
|
|
128
128
|
format_options["schema"] = f"{schema}"
|
129
129
|
if "inferSchema" in format_options:
|
130
130
|
format_options["inferColumnTypes"] = format_options.pop("inferSchema")
|
131
|
-
|
132
|
-
format_options = {key: f"'{val}'" for key, val in format_options.items()}
|
133
131
|
format_options_str = to_csv(format_options, " => ")
|
134
132
|
|
135
133
|
from_clause = f"read_files('{paths}', {format_options_str})"
|
@@ -338,10 +336,7 @@ class DatabricksDataFrameWriter(
|
|
338
336
|
format_options_str = ""
|
339
337
|
if format is not None:
|
340
338
|
properties.append(exp.FileFormatProperty(this=exp.Var(this=format.upper())))
|
341
|
-
|
342
|
-
key: f"'{val}'" for key, val in options.items() if val is not None
|
343
|
-
}
|
344
|
-
format_options_str = to_csv(format_options, " ")
|
339
|
+
format_options_str = to_csv(options, " ")
|
345
340
|
|
346
341
|
if path is not None and isinstance(path, str):
|
347
342
|
properties.append(exp.LocationProperty(this=exp.convert(path)))
|
sqlframe/duckdb/readwriter.py
CHANGED
@@ -86,10 +86,7 @@ class DuckDBDataFrameReader(
|
|
86
86
|
select_column_mapping["filename"] = "VARCHAR"
|
87
87
|
select_columns = [x.expression for x in self._to_casted_columns(select_column_mapping)]
|
88
88
|
if format == "csv":
|
89
|
-
|
90
|
-
[f"'{column}': '{dtype}'" for column, dtype in column_mapping.items()]
|
91
|
-
)
|
92
|
-
merged_options["columns"] = "{" + duckdb_columns + "}"
|
89
|
+
merged_options["columns"] = column_mapping # type: ignore
|
93
90
|
else:
|
94
91
|
select_columns = [exp.Star()]
|
95
92
|
if format == "delta":
|
sqlframe/spark/readwriter.py
CHANGED
@@ -110,7 +110,6 @@ class SparkDataFrameReader(
|
|
110
110
|
if schema:
|
111
111
|
format_options["schema"] = f"{schema}"
|
112
112
|
format_options.pop("inferSchema", None)
|
113
|
-
format_options = {key: f"'{val}'" for key, val in format_options.items()}
|
114
113
|
format_options_str = to_csv(format_options, " ")
|
115
114
|
|
116
115
|
tmp_view = f"CREATE OR REPLACE TEMPORARY VIEW {tmp_view_key} USING {format}" + (
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sqlframe
|
3
|
-
Version: 3.39.
|
3
|
+
Version: 3.39.2
|
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 <27.
|
20
|
+
Requires-Dist: sqlglot <27.9,>=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'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
sqlframe/__init__.py,sha256=SB80yLTITBXHI2GCDS6n6bN5ObHqgPjfpRPAUwxaots,3403
|
2
|
-
sqlframe/_version.py,sha256=
|
2
|
+
sqlframe/_version.py,sha256=2ZMyDPGKBrqT_KjBcZ7ni5_lsj0fVr5EDt184buBf6w,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=0diYONDlet8iZt49LC3vcmfXHAAZ2MovPL2pTXYHj2U,85
|
|
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=
|
12
|
+
sqlframe/base/functions.py,sha256=9hW5aYke5EFU4C7Epx-TlyG2ZxjYnFGskv4LwHiQ2dw,227752
|
13
13
|
sqlframe/base/group.py,sha256=fBm8EUve7W7xz11nybTXr09ih-yZxL_vvEiZVE1eb_0,12025
|
14
14
|
sqlframe/base/normalize.py,sha256=nXAJ5CwxVf4DV0GsH-q1w0p8gmjSMlv96k_ez1eVul8,3880
|
15
15
|
sqlframe/base/operations.py,sha256=g-YNcbvNKTOBbYm23GKfB3fmydlR7ZZDAuZUtXIHtzw,4438
|
@@ -19,7 +19,7 @@ sqlframe/base/table.py,sha256=rCeh1W5SWbtEVfkLAUiexzrZwNgmZeptLEmLcM1ABkE,6961
|
|
19
19
|
sqlframe/base/transforms.py,sha256=y0j3SGDz3XCmNGrvassk1S-owllUWfkHyMgZlY6SFO4,467
|
20
20
|
sqlframe/base/types.py,sha256=OktuJ5f7tEogOW0oupI0RBlHfzZMmKh7zGLke9cwllo,12305
|
21
21
|
sqlframe/base/udf.py,sha256=O6hMhBUy9NVv-mhJRtfFhXTIa_-Z8Y_FkmmuOHu0l90,1117
|
22
|
-
sqlframe/base/util.py,sha256=
|
22
|
+
sqlframe/base/util.py,sha256=D4HAhtu4DMz5mXyxlUHRP_GrsjLJACpBYlLriyGoT0g,19435
|
23
23
|
sqlframe/base/window.py,sha256=7NaKDTlhun-95LEghukBCjFBwq0RHrPaajWQNCsLxok,4818
|
24
24
|
sqlframe/base/mixins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
sqlframe/base/mixins/catalog_mixins.py,sha256=9fZGWToz9xMJSzUl1vsVtj6TH3TysP3fBCKJLnGUQzE,23353
|
@@ -40,13 +40,13 @@ sqlframe/bigquery/types.py,sha256=KwNyuXIo-2xVVd4bZED3YrQOobKCtemlxGrJL7DrTC8,34
|
|
40
40
|
sqlframe/bigquery/udf.py,sha256=ZZ1-P1zWZhQqmhBqwAxfNeKl31nDkkZgkuz7Dn28P_0,264
|
41
41
|
sqlframe/bigquery/window.py,sha256=6GKPzuxeSapJakBaKBeT9VpED1ACdjggDv9JRILDyV0,35
|
42
42
|
sqlframe/databricks/__init__.py,sha256=BkB_eO1UYwcf8j6x7bi4BWmDCMkfn0CUMwossWgwaG4,993
|
43
|
-
sqlframe/databricks/catalog.py,sha256=
|
43
|
+
sqlframe/databricks/catalog.py,sha256=QrleTG5_a8JOVUtVTBUu-c8fvxrS_J28QD85awqTBd4,18452
|
44
44
|
sqlframe/databricks/column.py,sha256=E1tUa62Y5HajkhgFuebU9zohrGyieudcHzTT8gfalio,40
|
45
45
|
sqlframe/databricks/dataframe.py,sha256=8kwT1kWU2TwGjR9zDrGdmkvabiBCivA_Mcg06r2XVX4,3111
|
46
46
|
sqlframe/databricks/functions.py,sha256=La8rjAwO0hD4FBO0QxW5CtZtFAPvOrVc6lG4OtPGgbc,336
|
47
47
|
sqlframe/databricks/functions.pyi,sha256=FzVBpzXCJzxIp73sIAo_R8Wx8uOJrix-W12HsgyeTcQ,23799
|
48
48
|
sqlframe/databricks/group.py,sha256=dU3g0DVLRlfOSCamKchQFXRd1WTFbdxoXkpEX8tPD6Y,399
|
49
|
-
sqlframe/databricks/readwriter.py,sha256=
|
49
|
+
sqlframe/databricks/readwriter.py,sha256=u2-0j_gXB4JikMxLBzUWhJZhJ5tYbGJpIGTqnWuDKqk,14521
|
50
50
|
sqlframe/databricks/session.py,sha256=i2CgrLIHJb53Cx1qu_rE1-cmmm19S-Sw1MhTISX1zYU,4013
|
51
51
|
sqlframe/databricks/table.py,sha256=Q0Vnrl5aUqnqFTQpTwfWMRyQ9AQnagtpnSnXmP6IKRs,678
|
52
52
|
sqlframe/databricks/types.py,sha256=KwNyuXIo-2xVVd4bZED3YrQOobKCtemlxGrJL7DrTC8,34
|
@@ -59,7 +59,7 @@ sqlframe/duckdb/dataframe.py,sha256=Z8_K69UQGZVeBfVGXVwIJP8OMuIvNBB3DPKTP3Lfu4w,
|
|
59
59
|
sqlframe/duckdb/functions.py,sha256=ix2efGGD4HLaY1rtCtEd3IrsicGEVGiBAeKOo5OD8rA,424
|
60
60
|
sqlframe/duckdb/functions.pyi,sha256=hDjpT-tGDO8LyElcno5YYRUnJg1dXXbGcRjJ69Zqk_U,12542
|
61
61
|
sqlframe/duckdb/group.py,sha256=IkhbW42Ng1U5YT3FkIdiB4zBqRkW4QyTb-1detY1e_4,383
|
62
|
-
sqlframe/duckdb/readwriter.py,sha256=
|
62
|
+
sqlframe/duckdb/readwriter.py,sha256=IA2nLGBfUVAUrSO3DyYL3LWQz-5pfbjQ1fROnnfw_r4,5022
|
63
63
|
sqlframe/duckdb/session.py,sha256=FBU78oA9Lnj5A8ikVswQEDIlJcA3wc0Thn6KVso5iqM,2793
|
64
64
|
sqlframe/duckdb/table.py,sha256=AmEKoH2TZo98loS5NbNaTuqv0eg76SY_OckVBMmQ6Co,410
|
65
65
|
sqlframe/duckdb/types.py,sha256=KwNyuXIo-2xVVd4bZED3YrQOobKCtemlxGrJL7DrTC8,34
|
@@ -110,7 +110,7 @@ sqlframe/spark/dataframe.py,sha256=WyXHWsH8Ldu2cWTNmsLy5hEFrjJvQh_Aqv3JJcbDy6k,1
|
|
110
110
|
sqlframe/spark/functions.py,sha256=MYCgHsjRQWylT-rezWRBuLV6BivcaVarbaQtP4T0toQ,331
|
111
111
|
sqlframe/spark/functions.pyi,sha256=GyOdUzv2Z7Qt99JAKEPKgV2t2Rn274OuqwAfcoAXlN0,24259
|
112
112
|
sqlframe/spark/group.py,sha256=MrvV_v-YkBc6T1zz882WrEqtWjlooWIyHBCmTQg3fCA,379
|
113
|
-
sqlframe/spark/readwriter.py,sha256=
|
113
|
+
sqlframe/spark/readwriter.py,sha256=mSrAnFXKyPyNb250Ho1c8CgxEoHovsgG209ys_x0aZs,6691
|
114
114
|
sqlframe/spark/session.py,sha256=irlsTky06pKRKAyPLwVzUtLGe4O8mALSgxIqLvqJNF8,5675
|
115
115
|
sqlframe/spark/table.py,sha256=puWV8h_CqA64zwpzq0ydY9LoygMAvprkODyxyzZeF9M,186
|
116
116
|
sqlframe/spark/types.py,sha256=KwNyuXIo-2xVVd4bZED3YrQOobKCtemlxGrJL7DrTC8,34
|
@@ -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.39.
|
134
|
-
sqlframe-3.39.
|
135
|
-
sqlframe-3.39.
|
136
|
-
sqlframe-3.39.
|
137
|
-
sqlframe-3.39.
|
133
|
+
sqlframe-3.39.2.dist-info/LICENSE,sha256=VZu79YgW780qxaFJMr0t5ZgbOYEh04xWoxaWOaqIGWk,1068
|
134
|
+
sqlframe-3.39.2.dist-info/METADATA,sha256=M0k0V_XPUzeL9-tCwZWKMMv9DVhVstFonKVOWRc7wRk,9039
|
135
|
+
sqlframe-3.39.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
136
|
+
sqlframe-3.39.2.dist-info/top_level.txt,sha256=T0_RpoygaZSF6heeWwIDQgaP0varUdSK1pzjeJZRjM8,9
|
137
|
+
sqlframe-3.39.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|