chalkpy 2.94.6__py3-none-any.whl → 2.94.7__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.
- chalk/_version.py +1 -1
- chalk/df/LazyFramePlaceholder.py +9 -5
- chalk/gitignore/gitignore_parser.py +5 -1
- chalk/sql/_internal/integrations/redshift.py +4 -0
- {chalkpy-2.94.6.dist-info → chalkpy-2.94.7.dist-info}/METADATA +1 -1
- {chalkpy-2.94.6.dist-info → chalkpy-2.94.7.dist-info}/RECORD +9 -9
- {chalkpy-2.94.6.dist-info → chalkpy-2.94.7.dist-info}/WHEEL +0 -0
- {chalkpy-2.94.6.dist-info → chalkpy-2.94.7.dist-info}/entry_points.txt +0 -0
- {chalkpy-2.94.6.dist-info → chalkpy-2.94.7.dist-info}/top_level.txt +0 -0
chalk/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.94.
|
|
1
|
+
__version__ = "2.94.7"
|
chalk/df/LazyFramePlaceholder.py
CHANGED
|
@@ -9,6 +9,7 @@ engine.
|
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
11
|
import typing
|
|
12
|
+
import uuid
|
|
12
13
|
from dataclasses import dataclass
|
|
13
14
|
from pathlib import Path
|
|
14
15
|
from typing import TYPE_CHECKING, Any, Optional, TypeAlias
|
|
@@ -198,9 +199,9 @@ class LazyFramePlaceholder:
|
|
|
198
199
|
@classmethod
|
|
199
200
|
def scan(
|
|
200
201
|
cls,
|
|
201
|
-
name: str,
|
|
202
202
|
input_uris: typing.Sequence[str | Path],
|
|
203
203
|
*,
|
|
204
|
+
name: typing.Optional[str] = None,
|
|
204
205
|
schema: pyarrow.Schema | None = None,
|
|
205
206
|
) -> "LazyFramePlaceholder":
|
|
206
207
|
"""Scan files and return a DataFrame.
|
|
@@ -209,10 +210,10 @@ class LazyFramePlaceholder:
|
|
|
209
210
|
|
|
210
211
|
Parameters
|
|
211
212
|
----------
|
|
212
|
-
name
|
|
213
|
-
Name to assign to the table being scanned.
|
|
214
213
|
input_uris
|
|
215
214
|
List of file paths or URIs to scan. Supports local paths and file:// URIs.
|
|
215
|
+
name
|
|
216
|
+
Optional name to assign to the table being scanned.
|
|
216
217
|
schema
|
|
217
218
|
Schema of the data. Required for CSV files, optional for Parquet.
|
|
218
219
|
|
|
@@ -224,11 +225,11 @@ class LazyFramePlaceholder:
|
|
|
224
225
|
--------
|
|
225
226
|
>>> from chalkdf import DataFrame
|
|
226
227
|
>>> # Scan Parquet files
|
|
227
|
-
>>> df = DataFrame.scan(
|
|
228
|
+
>>> df = DataFrame.scan(["data/sales_2024.parquet"], name="sales_data")
|
|
228
229
|
>>> # Scan CSV with explicit schema
|
|
229
230
|
>>> import pyarrow as pa
|
|
230
231
|
>>> schema = pa.schema([("id", pa.int64()), ("name", pa.string())])
|
|
231
|
-
>>> df = DataFrame.scan(
|
|
232
|
+
>>> df = DataFrame.scan(["data/users.csv"], name="users", schema=schema)
|
|
232
233
|
"""
|
|
233
234
|
# Accept filesystem paths or URIs; construct file:// URIs manually for
|
|
234
235
|
# local paths to avoid percent-encoding partition tokens like '='.
|
|
@@ -238,6 +239,9 @@ class LazyFramePlaceholder:
|
|
|
238
239
|
"The LazyFramePlaceholder.scan() function must be called with a list of input_uris, not a single str URI"
|
|
239
240
|
)
|
|
240
241
|
|
|
242
|
+
if name is None:
|
|
243
|
+
name = str(uuid.uuid4())
|
|
244
|
+
|
|
241
245
|
normalized_input_uris: list[str] = []
|
|
242
246
|
for p in input_uris:
|
|
243
247
|
s = p if isinstance(p, str) else str(p)
|
|
@@ -114,6 +114,10 @@ def _rule_from_pattern(pattern: str, base_path: Optional[Path] = None, source: O
|
|
|
114
114
|
regex = _fnmatch_pathname_to_regex(pattern, directory_only)
|
|
115
115
|
if anchored:
|
|
116
116
|
regex = f"^{regex}"
|
|
117
|
+
else:
|
|
118
|
+
# For non-anchored patterns, match at path component boundaries
|
|
119
|
+
# (start of string or after a path separator)
|
|
120
|
+
regex = f"(^|/){regex}"
|
|
117
121
|
regex = f"(?ms){regex}"
|
|
118
122
|
return IgnoreRule(
|
|
119
123
|
pattern=orig_pattern,
|
|
@@ -215,6 +219,6 @@ def _fnmatch_pathname_to_regex(pattern: str, directory_only: bool):
|
|
|
215
219
|
if directory_only:
|
|
216
220
|
res.append(r"/.*$")
|
|
217
221
|
else:
|
|
218
|
-
res.append("(
|
|
222
|
+
res.append("(/.*)?$")
|
|
219
223
|
|
|
220
224
|
return "".join(res)
|
|
@@ -260,6 +260,8 @@ class RedshiftSourceImpl(BaseSQLSource):
|
|
|
260
260
|
temp_table_name = f"query_{str(uuid.uuid4()).replace('-', '_')}"
|
|
261
261
|
try:
|
|
262
262
|
_logger.debug(f"Executing query & creating temp table '{temp_table_name}'")
|
|
263
|
+
_public_logger.info(f"Executing Redshift query [{temp_query_id}]: {operation}")
|
|
264
|
+
_public_logger.debug(f"Query parameters [{temp_query_id}]: {params}")
|
|
263
265
|
cursor.execute(f"CREATE TEMP TABLE {temp_table_name} AS ({operation})", params)
|
|
264
266
|
except Exception as e:
|
|
265
267
|
_public_logger.error(f"Failed to create temp table for operation: {operation}", exc_info=e)
|
|
@@ -366,6 +368,8 @@ class RedshiftSourceImpl(BaseSQLSource):
|
|
|
366
368
|
temp_table_name = f"query_{str(uuid.uuid4()).replace('-', '_')}"
|
|
367
369
|
try:
|
|
368
370
|
_logger.debug(f"Executing query & creating temp table '{temp_table_name}'")
|
|
371
|
+
_public_logger.info(f"Executing Redshift query [{temp_query_id}]: {operation}")
|
|
372
|
+
_public_logger.debug(f"Query parameters [{temp_query_id}]: {params}")
|
|
369
373
|
cursor.execute(f"CREATE TEMP TABLE {temp_table_name} AS ({operation})", params)
|
|
370
374
|
except Exception as e:
|
|
371
375
|
_public_logger.error(f"Failed to create temp table for operation: {operation}", exc_info=e)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
chalk/__init__.py,sha256=vKsx9-cl5kImlVWGHVRYO6bweBm79NAzGs3l36u71wM,2657
|
|
2
|
-
chalk/_version.py,sha256=
|
|
2
|
+
chalk/_version.py,sha256=xQ_L49W7GbJ2yq2jzFvXWpSFI2jxXKN5KC5fxz1jHPg,23
|
|
3
3
|
chalk/cli.py,sha256=ckqqfOI-A2mT23-rnZzDMmblYj-2x1VBX8ebHlIEn9A,5873
|
|
4
4
|
chalk/importer.py,sha256=m4lMn1lSYj_euDq8CS7LYTBnek9JOcjGJf9-82dJHbA,64441
|
|
5
5
|
chalk/prompts.py,sha256=2H9UomLAamdfRTNUdKs9i3VTpiossuyRhntqsAXUhhg,16117
|
|
@@ -620,7 +620,7 @@ chalk/config/_validator.py,sha256=QC1y52m704_bV_TYjq0sdZJ-km8iSkDX1V4sHgw4RJk,13
|
|
|
620
620
|
chalk/config/auth_config.py,sha256=HAALkQrvDD0i7gaZK5iufS8vDDVbzLIpHLOpcJO1kmw,4498
|
|
621
621
|
chalk/config/project_config.py,sha256=YHB3upvtBJu-tWfNOchBRSc9xGebDbrIpCVmKbBzJ8Q,7217
|
|
622
622
|
chalk/df/ChalkDataFrameImpl.py,sha256=BRwnjQcie3gxaKhKau8HG17NWzS1zdr8SnNVurxF8QY,133
|
|
623
|
-
chalk/df/LazyFramePlaceholder.py,sha256
|
|
623
|
+
chalk/df/LazyFramePlaceholder.py,sha256=Y9MQtBRMs-n2_N8UIs6LL-1gUWz2jsccDhDaWp2Ej7M,39185
|
|
624
624
|
chalk/df/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
625
625
|
chalk/df/ast_parser.py,sha256=t-DwUxd2hN8LECRSBx85DIv9FtILgMiHyGyCTINfgQw,11199
|
|
626
626
|
chalk/features/__init__.py,sha256=5doD7bFwRthzwdmizbRaPVHiCABiNpiOiAJVFlwqNnA,6943
|
|
@@ -678,7 +678,7 @@ chalk/functions/holidays.py,sha256=7yhLjH4E1nDNGA0cXnvRQl5_h_W6rFZfIGYEBa-WiM8,3
|
|
|
678
678
|
chalk/functions/http.py,sha256=f3UpokWnjLyo0A_zZoSDgfGgRWmLu639FkREi6p82b4,6653
|
|
679
679
|
chalk/functions/proto.py,sha256=RpM4GIj0-hVTA8RcK_k_fQOz9hvidgFtAbtcmD5Y4K0,5749
|
|
680
680
|
chalk/gitignore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
681
|
-
chalk/gitignore/gitignore_parser.py,sha256=
|
|
681
|
+
chalk/gitignore/gitignore_parser.py,sha256=NDoSp3b21SJgY0bWoG6L9GtKbGQuAqT5zYhm8oSTlYw,7634
|
|
682
682
|
chalk/gitignore/helper.py,sha256=LrIfyvRXjoLU2R5cPtKTQHQPyCNQ0sFHcKArTFK6o3U,1799
|
|
683
683
|
chalk/integrations/__init__.py,sha256=9BrzahaLJvWxO3qapJhEf8GoAe2JWTSHSgZtTFuFL7M,92
|
|
684
684
|
chalk/integrations/named.py,sha256=5bQ5LOJJdJka9gnQeobkQaHdt9tUsJpE9wxKhMX9QAs,1851
|
|
@@ -752,7 +752,7 @@ chalk/sql/_internal/integrations/dynamodb.py,sha256=MHJryj6xJ9B72spofeTpCE86pC7Z
|
|
|
752
752
|
chalk/sql/_internal/integrations/mssql.py,sha256=EUv10ypZHZ2DcTnmdA4h1fehVTvbxB-ZWas2fpAhlyQ,8019
|
|
753
753
|
chalk/sql/_internal/integrations/mysql.py,sha256=RjIc0TaQceZrZ-q5AIGExbH5VHirbscZqXII1Ht7M0I,8696
|
|
754
754
|
chalk/sql/_internal/integrations/postgres.py,sha256=bwxwEeJYH5-A7S22YumukwX6aN6c_B_MOOnrmJuTZyI,29169
|
|
755
|
-
chalk/sql/_internal/integrations/redshift.py,sha256=
|
|
755
|
+
chalk/sql/_internal/integrations/redshift.py,sha256=0f_h5Lnigth3O5BG16a967JokHCZfl4i2kWbb134-6Q,22872
|
|
756
756
|
chalk/sql/_internal/integrations/redshift_compiler_overrides.py,sha256=eKFeaCamTVfoHhdiBv1_3A6CxvFrv86Ovsa-vBBqjEo,5343
|
|
757
757
|
chalk/sql/_internal/integrations/snowflake.py,sha256=Y8kKSA3W02yxi144KSOeKtlud4ArsjLKNPvTG6XkkXI,35241
|
|
758
758
|
chalk/sql/_internal/integrations/snowflake_compiler_overrides.py,sha256=GbD3rdFWMpbht8dE-h9kcSsxideYHvVTGOYIfrczJJ8,6712
|
|
@@ -811,8 +811,8 @@ chalk/utils/tracing.py,sha256=ye5z6UCEsrxXC3ofXUNCDdUCf8ydPahEO92qQTd0AIA,11383
|
|
|
811
811
|
chalk/utils/weak_set_by_identity.py,sha256=VmikA_laYwFeOphCwXJIuyOIkrdlQe0bSzaXq7onoQw,953
|
|
812
812
|
chalk/utils/pydanticutil/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
813
813
|
chalk/utils/pydanticutil/pydantic_compat.py,sha256=O575lLYJ5GvZC4HMzR9yATxf9XwjC6NrDUXbNwZidlE,3031
|
|
814
|
-
chalkpy-2.94.
|
|
815
|
-
chalkpy-2.94.
|
|
816
|
-
chalkpy-2.94.
|
|
817
|
-
chalkpy-2.94.
|
|
818
|
-
chalkpy-2.94.
|
|
814
|
+
chalkpy-2.94.7.dist-info/METADATA,sha256=Lci4Dm_q22AE06S4Vt-SpKxp7ohcDXy0LOU8zlDttpQ,27494
|
|
815
|
+
chalkpy-2.94.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
816
|
+
chalkpy-2.94.7.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
|
|
817
|
+
chalkpy-2.94.7.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
|
|
818
|
+
chalkpy-2.94.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|