fakesnow 0.9.8__py3-none-any.whl → 0.9.9__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.
fakesnow/transforms.py CHANGED
@@ -309,7 +309,7 @@ def extract_comment_on_table(expression: exp.Expression) -> exp.Expression:
309
309
  if props := cast(exp.Properties, expression.args.get("properties")):
310
310
  other_props = []
311
311
  for p in props.expressions:
312
- if isinstance(p, exp.SchemaCommentProperty) and (isinstance(p.this, (exp.Literal, exp.Identifier))):
312
+ if isinstance(p, exp.SchemaCommentProperty) and (isinstance(p.this, (exp.Literal, exp.Var))):
313
313
  comment = p.this.this
314
314
  else:
315
315
  other_props.append(p)
@@ -360,10 +360,19 @@ def extract_text_length(expression: exp.Expression) -> exp.Expression:
360
360
 
361
361
  if isinstance(expression, (exp.Create, exp.AlterTable)):
362
362
  text_lengths = []
363
- for dt in expression.find_all(exp.DataType):
364
- if dt.this in (exp.DataType.Type.VARCHAR, exp.DataType.Type.TEXT):
365
- col_name = dt.parent and dt.parent.this and dt.parent.this.this
366
- if dt_size := dt.find(exp.DataTypeParam):
363
+
364
+ # exp.Select is for a ctas, exp.Schema is a plain definition
365
+ if cols := expression.find(exp.Select, exp.Schema):
366
+ expressions = cols.expressions
367
+ else:
368
+ # alter table
369
+ expressions = expression.args.get("actions") or []
370
+ for e in expressions:
371
+ if dts := [
372
+ dt for dt in e.find_all(exp.DataType) if dt.this in (exp.DataType.Type.VARCHAR, exp.DataType.Type.TEXT)
373
+ ]:
374
+ col_name = e.alias if isinstance(e, exp.Alias) else e.name
375
+ if len(dts) == 1 and (dt_size := dts[0].find(exp.DataTypeParam)):
367
376
  size = (
368
377
  isinstance(dt_size.this, exp.Literal)
369
378
  and isinstance(dt_size.this.this, str)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fakesnow
3
- Version: 0.9.8
3
+ Version: 0.9.9
4
4
  Summary: Fake Snowflake Connector for Python. Run, mock and test Snowflake DB locally.
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -213,7 +213,7 @@ License-File: LICENSE
213
213
  Requires-Dist: duckdb ~=0.10.0
214
214
  Requires-Dist: pyarrow
215
215
  Requires-Dist: snowflake-connector-python
216
- Requires-Dist: sqlglot ~=23.3.0
216
+ Requires-Dist: sqlglot ~=23.12.2
217
217
  Provides-Extra: dev
218
218
  Requires-Dist: build ~=1.0 ; extra == 'dev'
219
219
  Requires-Dist: pandas-stubs ; extra == 'dev'
@@ -9,10 +9,10 @@ fakesnow/global_database.py,sha256=WTVIP1VhNvdCeX7TQncX1TRpGQU5rBf5Pbxim40zeSU,1
9
9
  fakesnow/info_schema.py,sha256=CdIcGXHEQ_kmEAzdQKvA-PX41LA6wlK-4p1J45qgKYA,6266
10
10
  fakesnow/macros.py,sha256=pX1YJDnQOkFJSHYUjQ6ErEkYIKvFI6Ncz_au0vv1csA,265
11
11
  fakesnow/py.typed,sha256=B-DLSjYBi7pkKjwxCSdpVj2J02wgfJr-E7B1wOUyxYU,80
12
- fakesnow/transforms.py,sha256=s-RvjTWBJdFIzfxrz2Qcub19yfTludBJeJ8KSdOZJYA,49714
13
- fakesnow-0.9.8.dist-info/LICENSE,sha256=kW-7NWIyaRMQiDpryfSmF2DObDZHGR1cJZ39s6B1Svg,11344
14
- fakesnow-0.9.8.dist-info/METADATA,sha256=QjIA4H99CCnfzoo2qBhg5EJAq8wFp4kbwXWDuTqV1CQ,17831
15
- fakesnow-0.9.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
16
- fakesnow-0.9.8.dist-info/entry_points.txt,sha256=2riAUgu928ZIHawtO8EsfrMEJhi-EH-z_Vq7Q44xKPM,47
17
- fakesnow-0.9.8.dist-info/top_level.txt,sha256=500evXI1IFX9so82cizGIEMHAb_dJNPaZvd2H9dcKTA,24
18
- fakesnow-0.9.8.dist-info/RECORD,,
12
+ fakesnow/transforms.py,sha256=5-JWBE4d6NDTqDSXDZjZXk1gSeK0sjHOZVy5RJPiPQA,50059
13
+ fakesnow-0.9.9.dist-info/LICENSE,sha256=kW-7NWIyaRMQiDpryfSmF2DObDZHGR1cJZ39s6B1Svg,11344
14
+ fakesnow-0.9.9.dist-info/METADATA,sha256=08vNDl-q6ssZOlj4X3w8R559uXZtDlN09d6XvgVS4mQ,17832
15
+ fakesnow-0.9.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
16
+ fakesnow-0.9.9.dist-info/entry_points.txt,sha256=2riAUgu928ZIHawtO8EsfrMEJhi-EH-z_Vq7Q44xKPM,47
17
+ fakesnow-0.9.9.dist-info/top_level.txt,sha256=500evXI1IFX9so82cizGIEMHAb_dJNPaZvd2H9dcKTA,24
18
+ fakesnow-0.9.9.dist-info/RECORD,,