fakesnow 0.7.1__py3-none-any.whl → 0.8.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.
fakesnow/fakes.py CHANGED
@@ -322,13 +322,10 @@ class FakeSnowflakeCursor:
322
322
  return ResultMetadata(
323
323
  name=column_name, type_code=12, display_size=None, internal_size=None, precision=0, scale=9, is_nullable=True # noqa: E501
324
324
  )
325
- elif column_type == "JSON[]":
326
- return ResultMetadata(
327
- name=column_name, type_code=10, display_size=None, internal_size=None, precision=None, scale=None, is_nullable=True # noqa: E501
328
- )
329
325
  elif column_type == "JSON":
326
+ # TODO: correctly map OBJECT and ARRAY see https://github.com/tekumara/fakesnow/issues/26
330
327
  return ResultMetadata(
331
- name=column_name, type_code=9, display_size=None, internal_size=None, precision=None, scale=None, is_nullable=True # noqa: E501
328
+ name=column_name, type_code=5, display_size=None, internal_size=None, precision=None, scale=None, is_nullable=True # noqa: E501
332
329
  )
333
330
  else:
334
331
  # TODO handle more types
fakesnow/info_schema.py CHANGED
@@ -40,8 +40,7 @@ case when starts_with(data_type, 'DECIMAL') or data_type='BIGINT' then 'NUMBER'
40
40
  when data_type='DOUBLE' then 'FLOAT'
41
41
  when data_type='BLOB' then 'BINARY'
42
42
  when data_type='TIMESTAMP' then 'TIMESTAMP_NTZ'
43
- when data_type='JSON[]' then 'ARRAY'
44
- when data_type='JSON' then 'OBJECT'
43
+ when data_type='JSON' then 'VARIANT'
45
44
  else data_type end as data_type,
46
45
  ext_character_maximum_length as character_maximum_length, ext_character_octet_length as character_octet_length,
47
46
  case when data_type='BIGINT' then 38
fakesnow/transforms.py CHANGED
@@ -578,15 +578,14 @@ def semi_structured_types(expression: exp.Expression) -> exp.Expression:
578
578
  exp.Expression: The transformed expression.
579
579
  """
580
580
 
581
- if isinstance(expression, exp.DataType):
582
- if expression.this in [exp.DataType.Type.OBJECT, exp.DataType.Type.VARIANT]:
583
- new = expression.copy()
584
- new.args["this"] = exp.DataType.Type.JSON
585
- return new
586
- elif expression.this == exp.DataType.Type.ARRAY:
587
- new = expression.copy()
588
- new.set("expressions", [exp.DataType(this=exp.DataType.Type.JSON)])
589
- return new
581
+ if isinstance(expression, exp.DataType) and expression.this in [
582
+ exp.DataType.Type.ARRAY,
583
+ exp.DataType.Type.OBJECT,
584
+ exp.DataType.Type.VARIANT,
585
+ ]:
586
+ new = expression.copy()
587
+ new.args["this"] = exp.DataType.Type.JSON
588
+ return new
590
589
 
591
590
  return expression
592
591
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fakesnow
3
- Version: 0.7.1
3
+ Version: 0.8.0
4
4
  Summary: Fake Snowflake Connector for Python. Run Snowflake DB locally.
5
5
  License: MIT License
6
6
 
@@ -0,0 +1,13 @@
1
+ fakesnow/__init__.py,sha256=JXg0HSEHSAOSjEE1ZeA_ogNQ2iFXGEuoibQWk7Pz-WM,3133
2
+ fakesnow/checks.py,sha256=1qVLR0ZB3z3UPij3Hm8hqlkcNLH2QJnwe8OqkoFCwv8,2356
3
+ fakesnow/expr.py,sha256=CAxuYIUkwI339DQIBzvFF0F-m1tcVGKEPA5rDTzmH9A,892
4
+ fakesnow/fakes.py,sha256=qYYtgVNeRSDOMRZYrDo4lS3YB1vTmpAPiVQaeILUdAs,21352
5
+ fakesnow/fixtures.py,sha256=FfVGhfuIQea0_GQKW8H4ZH0DoxrU2ZnMVJj2eobVbnI,518
6
+ fakesnow/info_schema.py,sha256=maLS3k10ed_NUYVDeSaL9aXDuVGgQSX8mCYzTqMiW0U,4503
7
+ fakesnow/py.typed,sha256=B-DLSjYBi7pkKjwxCSdpVj2J02wgfJr-E7B1wOUyxYU,80
8
+ fakesnow/transforms.py,sha256=TIZa6uLbqTQ66j-xXzr7T475RTJLLyrTcVUvB5dgL1A,22894
9
+ fakesnow-0.8.0.dist-info/LICENSE,sha256=BL6v_VTnU7xdsocviIQJMFr3stX_-uRfTyByo3gRu4M,1071
10
+ fakesnow-0.8.0.dist-info/METADATA,sha256=pqyCHOXBSQ4O_I2QtxoGYEbiVfmesGj7V0nonJXt_LY,5418
11
+ fakesnow-0.8.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
12
+ fakesnow-0.8.0.dist-info/top_level.txt,sha256=x8S-sMmvfgNm2_1w0zlIF5YlDs2hR7eNQdVA6TgmPZE,14
13
+ fakesnow-0.8.0.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- fakesnow/__init__.py,sha256=JXg0HSEHSAOSjEE1ZeA_ogNQ2iFXGEuoibQWk7Pz-WM,3133
2
- fakesnow/checks.py,sha256=1qVLR0ZB3z3UPij3Hm8hqlkcNLH2QJnwe8OqkoFCwv8,2356
3
- fakesnow/expr.py,sha256=CAxuYIUkwI339DQIBzvFF0F-m1tcVGKEPA5rDTzmH9A,892
4
- fakesnow/fakes.py,sha256=SMyZ23KV4qHGkb-RVnWi-5m6IrHGJWETT5RtmRN8er0,21508
5
- fakesnow/fixtures.py,sha256=FfVGhfuIQea0_GQKW8H4ZH0DoxrU2ZnMVJj2eobVbnI,518
6
- fakesnow/info_schema.py,sha256=3lkpRI_ByXbA1PwZ3hh4PtB9aLAsRbkI4MM_hTaOce8,4544
7
- fakesnow/py.typed,sha256=B-DLSjYBi7pkKjwxCSdpVj2J02wgfJr-E7B1wOUyxYU,80
8
- fakesnow/transforms.py,sha256=koYkt55qGMJhi8gujqrBKO-nePcBMp4zrTk80Uw_JrE,23054
9
- fakesnow-0.7.1.dist-info/LICENSE,sha256=BL6v_VTnU7xdsocviIQJMFr3stX_-uRfTyByo3gRu4M,1071
10
- fakesnow-0.7.1.dist-info/METADATA,sha256=5vcf4KPwcNwl7xJ-5fBQmHCxHOatcaTZgFDDPFyUY6E,5418
11
- fakesnow-0.7.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
12
- fakesnow-0.7.1.dist-info/top_level.txt,sha256=x8S-sMmvfgNm2_1w0zlIF5YlDs2hR7eNQdVA6TgmPZE,14
13
- fakesnow-0.7.1.dist-info/RECORD,,