sqlframe 3.1.1__tar.gz → 3.3.0__tar.gz
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-3.1.1 → sqlframe-3.3.0}/PKG-INFO +1 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/standalone.md +1 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/setup.py +5 -5
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/_version.py +2 -2
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/dataframe.py +5 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/functions.py +2 -2
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/group.py +1 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/session.py +5 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/util.py +1 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/readwriter.py +5 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/session.py +8 -2
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/catalog.py +3 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe.egg-info/PKG-INFO +1 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe.egg-info/SOURCES.txt +114 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe.egg-info/requires.txt +5 -5
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/common_fixtures.py +55 -6
- sqlframe-3.3.0/tests/fixtures/employee_delta/.part-00000-e5965c7b-e58f-4d3c-ad56-002876814e3a-c000.snappy.parquet.crc +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/.part-00002-3fed7f18-370f-4b16-b232-504d6194eb52-c000.snappy.parquet.crc +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/.part-00004-143c5da1-d5ab-4706-8e84-0d2a324c6894-c000.snappy.parquet.crc +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/.part-00006-64f07e25-c30e-4075-acc6-b3c69c4ce80b-c000.snappy.parquet.crc +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/.part-00008-89ccad8d-df73-4ad5-8850-82ef3884db60-c000.snappy.parquet.crc +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/.part-00010-812b3382-8c7f-4c4e-9bcd-09ce8664f6e0-c000.snappy.parquet.crc +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/_delta_log/.00000000000000000000.json.crc +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/_delta_log/00000000000000000000.json +8 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/part-00000-e5965c7b-e58f-4d3c-ad56-002876814e3a-c000.snappy.parquet +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/part-00002-3fed7f18-370f-4b16-b232-504d6194eb52-c000.snappy.parquet +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/part-00004-143c5da1-d5ab-4706-8e84-0d2a324c6894-c000.snappy.parquet +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/part-00006-64f07e25-c30e-4075-acc6-b3c69c4ce80b-c000.snappy.parquet +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/part-00008-89ccad8d-df73-4ad5-8850-82ef3884db60-c000.snappy.parquet +0 -0
- sqlframe-3.3.0/tests/fixtures/employee_delta/part-00010-812b3382-8c7f-4c4e-9bcd-09ce8664f6e0-c000.snappy.parquet +0 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds1.sql +23 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds10.sql +65 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds11.sql +80 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds12.sql +27 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds13.sql +41 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds14.sql +134 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds15.sql +27 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds16.sql +24 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds17.sql +47 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds18.sql +49 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds19.sql +30 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds2.sql +79 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds20.sql +27 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds21.sql +30 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds22.sql +18 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds23.sql +84 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds24.sql +52 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds25.sql +40 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds26.sql +23 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds27.sql +60 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds28.sql +51 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds29.sql +41 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds3.sql +18 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds30.sql +49 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds31.sql +70 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds32.sql +16 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds33.sql +66 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds34.sql +40 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds35.sql +60 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds36.sql +58 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds37.sql +22 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds38.sql +28 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds39.sql +58 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds4.sql +119 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds40.sql +25 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds41.sql +66 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds42.sql +19 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds43.sql +49 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds44.sql +47 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds45.sql +41 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds46.sql +46 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds47.sql +71 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds48.sql +39 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds49.sql +101 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds5.sql +112 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds50.sql +67 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds51.sql +52 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds52.sql +19 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds53.sql +47 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds54.sql +57 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds55.sql +16 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds56.sql +73 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds57.sql +64 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds58.sql +70 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds59.sql +85 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds6.sql +25 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds60.sql +67 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds61.sql +46 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds62.sql +45 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds63.sql +47 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds64.sql +124 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds65.sql +37 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds66.sql +217 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds67.sql +44 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds68.sql +44 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds69.sql +51 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds7.sql +23 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds70.sql +36 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds71.sql +46 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds72.sql +38 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds73.sql +39 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds74.sql +64 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds75.sql +75 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds76.sql +55 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds77.sql +95 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds78.sql +76 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds79.sql +38 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds8.sql +427 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds80.sql +86 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds81.sql +55 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds82.sql +22 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds83.sql +70 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds84.sql +18 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds85.sql +57 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds86.sql +22 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds87.sql +30 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds88.sql +138 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds89.sql +19 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds9.sql +67 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds90.sql +26 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds91.sql +30 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds92.sql +17 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds93.sql +19 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds94.sql +24 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds95.sql +31 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds96.sql +14 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds97.sql +34 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds98.sql +26 -0
- sqlframe-3.3.0/tests/fixtures/tpcds/tpcds99.sql +44 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/duck/test_duckdb_reader.py +16 -0
- sqlframe-3.3.0/tests/integration/engines/duck/test_tpcds.py +32 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/spark/test_spark_catalog.py +13 -4
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/test_int_functions.py +11 -7
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/fixtures.py +4 -1
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_functions.py +8 -4
- {sqlframe-3.1.1 → sqlframe-3.3.0}/.github/CODEOWNERS +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/.github/workflows/main.workflow.yaml +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/.github/workflows/publish.workflow.yaml +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/.gitignore +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/.pre-commit-config.yaml +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/.readthedocs.yaml +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/LICENSE +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/Makefile +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/README.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/add_chatgpt_support.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/add_chatgpt_support/adding_ai_to_meal.jpeg +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/add_chatgpt_support/hype_train.gif +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/add_chatgpt_support/marvin_paranoid_robot.gif +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/add_chatgpt_support/nonsense_sql.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/add_chatgpt_support/openai_full_rewrite.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/add_chatgpt_support/openai_replacing_cte_names.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/add_chatgpt_support/sqlglot_optimized_code.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/add_chatgpt_support/sunny_shake_head_no.gif +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/but_wait_theres_more.gif +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/cake.gif +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/images/you_get_pyspark_api.gif +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/blogs/sqlframe_universal_dataframe_api.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/bigquery.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/configuration.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/docs/bigquery.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/docs/duckdb.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/docs/images/SF.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/docs/images/favicon.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/docs/images/favicon_old.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/docs/images/sqlframe_diagram.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/docs/images/sqlframe_logo.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/docs/postgres.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/duckdb.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/images/SF.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/images/favicon.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/images/favicon_old.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/images/sqlframe_diagram.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/images/sqlframe_logo.png +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/index.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/postgres.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/requirements.txt +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/snowflake.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/spark.md +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/docs/stylesheets/extra.css +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/mkdocs.yml +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/pytest.ini +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/renovate.json +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/setup.cfg +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/LICENSE +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/_typing.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/decorators.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/exceptions.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/function_alternatives.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/mixins/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/mixins/catalog_mixins.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/mixins/dataframe_mixins.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/mixins/readwriter_mixins.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/normalize.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/operations.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/readerwriter.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/transforms.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/base/window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/functions.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/functions.pyi +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/group.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/readwriter.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/bigquery/window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/functions.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/functions.pyi +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/group.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/duckdb/window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/functions.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/functions.pyi +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/group.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/readwriter.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/postgres/window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/functions.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/group.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/readwriter.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/redshift/window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/functions.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/functions.pyi +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/group.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/readwriter.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/snowflake/window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/functions.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/functions.pyi +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/group.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/readwriter.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/spark/window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/functions.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/group.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/readwriter.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/standalone/window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/testing/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe/testing/utils.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe.egg-info/dependency_links.txt +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/sqlframe.egg-info/top_level.txt +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/conftest.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/fixtures/employee.csv +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/fixtures/employee.json +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/fixtures/employee.parquet +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/fixtures/employee_extra_line.csv +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/bigquery/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/bigquery/test_bigquery_catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/bigquery/test_bigquery_dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/bigquery/test_bigquery_session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/duck/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/duck/test_duckdb_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/duck/test_duckdb_catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/duck/test_duckdb_dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/duck/test_duckdb_session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/duck/test_duckdb_udf.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/postgres/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/postgres/test_postgres_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/postgres/test_postgres_catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/postgres/test_postgres_dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/postgres/test_postgres_session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/redshift/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/redshift/test_redshift_catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/redshift/test_redshift_session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/snowflake/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/snowflake/test_snowflake_catalog.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/snowflake/test_snowflake_dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/snowflake/test_snowflake_session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/spark/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/spark/test_spark_dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/test_engine_column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/test_engine_dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/test_engine_reader.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/test_engine_session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/test_engine_writer.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/engines/test_int_testing.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/test_int_dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/test_int_dataframe_stats.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/test_int_grouped_data.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/integration/test_int_session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/bigquery/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/bigquery/test_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/conftest.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/duck/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/duck/test_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/postgres/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/postgres/test_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/redshift/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/redshift/test_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/snowflake/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/snowflake/test_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/spark/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/spark/test_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/__init__.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/fixtures.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_column.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_dataframe.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_dataframe_writer.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_session.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_session_case_sensitivity.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_types.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/standalone/test_window.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/test_activate.py +0 -0
- {sqlframe-3.1.1 → sqlframe-3.3.0}/tests/unit/test_util.py +0 -0
|
@@ -84,7 +84,7 @@ from sqlframe.standalone import StandaloneSession
|
|
|
84
84
|
session = StandaloneSession()
|
|
85
85
|
|
|
86
86
|
session.catalog.add_table("test_table", column_mapping={"a": "int", "b": "int", "c": "int"})
|
|
87
|
-
df = session.read.table("
|
|
87
|
+
df = session.read.table("test_table")
|
|
88
88
|
df.sql()
|
|
89
89
|
```
|
|
90
90
|
|
|
@@ -20,7 +20,7 @@ setup(
|
|
|
20
20
|
python_requires=">=3.8",
|
|
21
21
|
install_requires=[
|
|
22
22
|
"prettytable<3.11.1",
|
|
23
|
-
"sqlglot>=24.0.0,<25.
|
|
23
|
+
"sqlglot>=24.0.0,<25.22",
|
|
24
24
|
"typing_extensions>=4.8,<5",
|
|
25
25
|
],
|
|
26
26
|
extras_require={
|
|
@@ -29,10 +29,10 @@ setup(
|
|
|
29
29
|
"google-cloud-bigquery-storage>=2,<3",
|
|
30
30
|
],
|
|
31
31
|
"dev": [
|
|
32
|
-
"duckdb>=0.9,<1.
|
|
32
|
+
"duckdb>=0.9,<1.2",
|
|
33
33
|
"findspark>=2,<3",
|
|
34
34
|
"mypy>=1.10.0,<1.12",
|
|
35
|
-
"openai>=1.30,<1.
|
|
35
|
+
"openai>=1.30,<1.46",
|
|
36
36
|
"pandas>=2,<3",
|
|
37
37
|
"pandas-stubs>=2,<3",
|
|
38
38
|
"psycopg>=3.1,<4",
|
|
@@ -54,11 +54,11 @@ setup(
|
|
|
54
54
|
"pymdown-extensions",
|
|
55
55
|
],
|
|
56
56
|
"duckdb": [
|
|
57
|
-
"duckdb>=0.9,<1.
|
|
57
|
+
"duckdb>=0.9,<1.2",
|
|
58
58
|
"pandas>=2,<3",
|
|
59
59
|
],
|
|
60
60
|
"openai": [
|
|
61
|
-
"openai>=1.30,<1.
|
|
61
|
+
"openai>=1.30,<1.46",
|
|
62
62
|
],
|
|
63
63
|
"pandas": [
|
|
64
64
|
"pandas>=2,<3",
|
|
@@ -1627,7 +1627,11 @@ class _BaseDataFrame(t.Generic[SESSION, WRITER, NA, STAT, GROUP_DATA]):
|
|
|
1627
1627
|
|
|
1628
1628
|
def createOrReplaceTempView(self, name: str) -> None:
|
|
1629
1629
|
name = normalize_string(name, from_dialect="input")
|
|
1630
|
-
|
|
1630
|
+
df = self.copy()._convert_leaf_to_cte()
|
|
1631
|
+
self.session.temp_views[name] = df
|
|
1632
|
+
self.session.catalog.add_table(
|
|
1633
|
+
name, [x.alias_or_name for x in self._get_outer_select_columns(df.expression)]
|
|
1634
|
+
)
|
|
1631
1635
|
|
|
1632
1636
|
def count(self) -> int:
|
|
1633
1637
|
if not self.session._has_connection:
|
|
@@ -2052,7 +2052,7 @@ def cardinality(col: ColumnOrName) -> Column:
|
|
|
2052
2052
|
|
|
2053
2053
|
@meta()
|
|
2054
2054
|
def char(col: ColumnOrName) -> Column:
|
|
2055
|
-
return Column
|
|
2055
|
+
return Column(expression.Chr(expressions=Column.ensure_col(col).expression))
|
|
2056
2056
|
|
|
2057
2057
|
|
|
2058
2058
|
@meta(unsupported_engines="*")
|
|
@@ -2703,7 +2703,7 @@ def inline(col: ColumnOrName) -> Column:
|
|
|
2703
2703
|
| 3| 4|
|
|
2704
2704
|
+---+---+
|
|
2705
2705
|
"""
|
|
2706
|
-
return Column.
|
|
2706
|
+
return Column.invoke_expression_over_column(col, expression.Inline)
|
|
2707
2707
|
|
|
2708
2708
|
|
|
2709
2709
|
@meta(unsupported_engines="*")
|
|
@@ -68,7 +68,7 @@ class _BaseGroupedData(t.Generic[DF]):
|
|
|
68
68
|
)
|
|
69
69
|
group_by_cols.extend(grouping_set) # type: ignore
|
|
70
70
|
group_by_cols = list(dict.fromkeys(group_by_cols))
|
|
71
|
-
group_by = exp.Group(grouping_sets=all_grouping_sets)
|
|
71
|
+
group_by = exp.Group(grouping_sets=[exp.GroupingSets(expressions=all_grouping_sets)])
|
|
72
72
|
expression.set("group", group_by)
|
|
73
73
|
for col in cols:
|
|
74
74
|
# Spark supports having an empty grouping_id which means all of the columns but other dialects
|
|
@@ -391,7 +391,11 @@ class _BaseSession(t.Generic[CATALOG, READER, WRITER, DF, CONN, UDF_REGISTRATION
|
|
|
391
391
|
)
|
|
392
392
|
if qualify:
|
|
393
393
|
expression = qualify_func(
|
|
394
|
-
expression,
|
|
394
|
+
expression,
|
|
395
|
+
dialect=dialect,
|
|
396
|
+
quote_identifiers=False,
|
|
397
|
+
identify=False,
|
|
398
|
+
schema=self.catalog._schema,
|
|
395
399
|
)
|
|
396
400
|
if self.temp_views:
|
|
397
401
|
replacement_mapping = {}
|
|
@@ -306,7 +306,6 @@ def quote_preserving_alias_or_name(col: t.Union[exp.Column, exp.Alias]) -> str:
|
|
|
306
306
|
def sqlglot_to_spark(sqlglot_dtype: exp.DataType) -> types.DataType:
|
|
307
307
|
from sqlframe.base import types
|
|
308
308
|
|
|
309
|
-
sqlglot_to_spark
|
|
310
309
|
primitive_mapping = {
|
|
311
310
|
exp.DataType.Type.VARCHAR: types.VarcharType,
|
|
312
311
|
exp.DataType.Type.CHAR: types.CharType,
|
|
@@ -325,6 +324,7 @@ def sqlglot_to_spark(sqlglot_dtype: exp.DataType) -> types.DataType:
|
|
|
325
324
|
exp.DataType.Type.TIMESTAMPLTZ: types.TimestampType,
|
|
326
325
|
exp.DataType.Type.TIMESTAMPNTZ: types.TimestampType,
|
|
327
326
|
exp.DataType.Type.DATE: types.DateType,
|
|
327
|
+
exp.DataType.Type.JSON: types.StringType,
|
|
328
328
|
}
|
|
329
329
|
if sqlglot_dtype.this in primitive_mapping:
|
|
330
330
|
pyspark_class = primitive_mapping[sqlglot_dtype.this]
|
|
@@ -85,12 +85,16 @@ class DuckDBDataFrameReader(_BaseDataFrameReader["DuckDBSession", "DuckDBDataFra
|
|
|
85
85
|
options["columns"] = "{" + duckdb_columns + "}"
|
|
86
86
|
else:
|
|
87
87
|
select_columns = [exp.Star()]
|
|
88
|
-
if format:
|
|
88
|
+
if format == "delta":
|
|
89
|
+
from_clause = f"delta_scan('{path}')"
|
|
90
|
+
elif format:
|
|
89
91
|
paths = ",".join([f"'{path}'" for path in ensure_list(path)])
|
|
90
92
|
from_clause = f"read_{format}([{paths}], {to_csv(options)})"
|
|
91
93
|
else:
|
|
92
94
|
from_clause = f"'{path}'"
|
|
93
95
|
df = self.session.sql(exp.select(*select_columns).from_(from_clause), qualify=False)
|
|
96
|
+
if select_columns == [exp.Star()]:
|
|
97
|
+
return self.load(path=path, format=format, schema=df.schema, **options)
|
|
94
98
|
self.session._last_loaded_file = path # type: ignore
|
|
95
99
|
return df
|
|
96
100
|
|
|
@@ -54,8 +54,14 @@ class DuckDBSession(
|
|
|
54
54
|
|
|
55
55
|
@classmethod
|
|
56
56
|
def _try_get_map(cls, value: t.Any) -> t.Optional[t.Dict[str, t.Any]]:
|
|
57
|
-
if value and isinstance(value, dict)
|
|
58
|
-
|
|
57
|
+
if value and isinstance(value, dict):
|
|
58
|
+
# DuckDB < 1.1.0 support
|
|
59
|
+
if "key" in value and "value" in value:
|
|
60
|
+
return dict(zip(value["key"], value["value"]))
|
|
61
|
+
# DuckDB >= 1.1.0 support
|
|
62
|
+
# If a key is not a string then it must not represent a column and therefore must be a map
|
|
63
|
+
if len([k for k in value if not isinstance(k, str)]) > 0:
|
|
64
|
+
return value
|
|
59
65
|
return None
|
|
60
66
|
|
|
61
67
|
def _execute(self, sql: str) -> None:
|
|
@@ -569,7 +569,9 @@ class SparkCatalog(
|
|
|
569
569
|
return [
|
|
570
570
|
Table(
|
|
571
571
|
name=normalize_string(x.name, from_dialect="execution", to_dialect="output"),
|
|
572
|
-
catalog=normalize_string(x.catalog, from_dialect="execution", to_dialect="output")
|
|
572
|
+
catalog=normalize_string(x.catalog, from_dialect="execution", to_dialect="output")
|
|
573
|
+
if x.catalog
|
|
574
|
+
else None,
|
|
573
575
|
namespace=[
|
|
574
576
|
normalize_string(y, from_dialect="execution", to_dialect="output")
|
|
575
577
|
for y in x.namespace
|
|
@@ -171,6 +171,119 @@ tests/fixtures/employee.csv
|
|
|
171
171
|
tests/fixtures/employee.json
|
|
172
172
|
tests/fixtures/employee.parquet
|
|
173
173
|
tests/fixtures/employee_extra_line.csv
|
|
174
|
+
tests/fixtures/employee_delta/.part-00000-e5965c7b-e58f-4d3c-ad56-002876814e3a-c000.snappy.parquet.crc
|
|
175
|
+
tests/fixtures/employee_delta/.part-00002-3fed7f18-370f-4b16-b232-504d6194eb52-c000.snappy.parquet.crc
|
|
176
|
+
tests/fixtures/employee_delta/.part-00004-143c5da1-d5ab-4706-8e84-0d2a324c6894-c000.snappy.parquet.crc
|
|
177
|
+
tests/fixtures/employee_delta/.part-00006-64f07e25-c30e-4075-acc6-b3c69c4ce80b-c000.snappy.parquet.crc
|
|
178
|
+
tests/fixtures/employee_delta/.part-00008-89ccad8d-df73-4ad5-8850-82ef3884db60-c000.snappy.parquet.crc
|
|
179
|
+
tests/fixtures/employee_delta/.part-00010-812b3382-8c7f-4c4e-9bcd-09ce8664f6e0-c000.snappy.parquet.crc
|
|
180
|
+
tests/fixtures/employee_delta/part-00000-e5965c7b-e58f-4d3c-ad56-002876814e3a-c000.snappy.parquet
|
|
181
|
+
tests/fixtures/employee_delta/part-00002-3fed7f18-370f-4b16-b232-504d6194eb52-c000.snappy.parquet
|
|
182
|
+
tests/fixtures/employee_delta/part-00004-143c5da1-d5ab-4706-8e84-0d2a324c6894-c000.snappy.parquet
|
|
183
|
+
tests/fixtures/employee_delta/part-00006-64f07e25-c30e-4075-acc6-b3c69c4ce80b-c000.snappy.parquet
|
|
184
|
+
tests/fixtures/employee_delta/part-00008-89ccad8d-df73-4ad5-8850-82ef3884db60-c000.snappy.parquet
|
|
185
|
+
tests/fixtures/employee_delta/part-00010-812b3382-8c7f-4c4e-9bcd-09ce8664f6e0-c000.snappy.parquet
|
|
186
|
+
tests/fixtures/employee_delta/_delta_log/.00000000000000000000.json.crc
|
|
187
|
+
tests/fixtures/employee_delta/_delta_log/00000000000000000000.json
|
|
188
|
+
tests/fixtures/tpcds/tpcds1.sql
|
|
189
|
+
tests/fixtures/tpcds/tpcds10.sql
|
|
190
|
+
tests/fixtures/tpcds/tpcds11.sql
|
|
191
|
+
tests/fixtures/tpcds/tpcds12.sql
|
|
192
|
+
tests/fixtures/tpcds/tpcds13.sql
|
|
193
|
+
tests/fixtures/tpcds/tpcds14.sql
|
|
194
|
+
tests/fixtures/tpcds/tpcds15.sql
|
|
195
|
+
tests/fixtures/tpcds/tpcds16.sql
|
|
196
|
+
tests/fixtures/tpcds/tpcds17.sql
|
|
197
|
+
tests/fixtures/tpcds/tpcds18.sql
|
|
198
|
+
tests/fixtures/tpcds/tpcds19.sql
|
|
199
|
+
tests/fixtures/tpcds/tpcds2.sql
|
|
200
|
+
tests/fixtures/tpcds/tpcds20.sql
|
|
201
|
+
tests/fixtures/tpcds/tpcds21.sql
|
|
202
|
+
tests/fixtures/tpcds/tpcds22.sql
|
|
203
|
+
tests/fixtures/tpcds/tpcds23.sql
|
|
204
|
+
tests/fixtures/tpcds/tpcds24.sql
|
|
205
|
+
tests/fixtures/tpcds/tpcds25.sql
|
|
206
|
+
tests/fixtures/tpcds/tpcds26.sql
|
|
207
|
+
tests/fixtures/tpcds/tpcds27.sql
|
|
208
|
+
tests/fixtures/tpcds/tpcds28.sql
|
|
209
|
+
tests/fixtures/tpcds/tpcds29.sql
|
|
210
|
+
tests/fixtures/tpcds/tpcds3.sql
|
|
211
|
+
tests/fixtures/tpcds/tpcds30.sql
|
|
212
|
+
tests/fixtures/tpcds/tpcds31.sql
|
|
213
|
+
tests/fixtures/tpcds/tpcds32.sql
|
|
214
|
+
tests/fixtures/tpcds/tpcds33.sql
|
|
215
|
+
tests/fixtures/tpcds/tpcds34.sql
|
|
216
|
+
tests/fixtures/tpcds/tpcds35.sql
|
|
217
|
+
tests/fixtures/tpcds/tpcds36.sql
|
|
218
|
+
tests/fixtures/tpcds/tpcds37.sql
|
|
219
|
+
tests/fixtures/tpcds/tpcds38.sql
|
|
220
|
+
tests/fixtures/tpcds/tpcds39.sql
|
|
221
|
+
tests/fixtures/tpcds/tpcds4.sql
|
|
222
|
+
tests/fixtures/tpcds/tpcds40.sql
|
|
223
|
+
tests/fixtures/tpcds/tpcds41.sql
|
|
224
|
+
tests/fixtures/tpcds/tpcds42.sql
|
|
225
|
+
tests/fixtures/tpcds/tpcds43.sql
|
|
226
|
+
tests/fixtures/tpcds/tpcds44.sql
|
|
227
|
+
tests/fixtures/tpcds/tpcds45.sql
|
|
228
|
+
tests/fixtures/tpcds/tpcds46.sql
|
|
229
|
+
tests/fixtures/tpcds/tpcds47.sql
|
|
230
|
+
tests/fixtures/tpcds/tpcds48.sql
|
|
231
|
+
tests/fixtures/tpcds/tpcds49.sql
|
|
232
|
+
tests/fixtures/tpcds/tpcds5.sql
|
|
233
|
+
tests/fixtures/tpcds/tpcds50.sql
|
|
234
|
+
tests/fixtures/tpcds/tpcds51.sql
|
|
235
|
+
tests/fixtures/tpcds/tpcds52.sql
|
|
236
|
+
tests/fixtures/tpcds/tpcds53.sql
|
|
237
|
+
tests/fixtures/tpcds/tpcds54.sql
|
|
238
|
+
tests/fixtures/tpcds/tpcds55.sql
|
|
239
|
+
tests/fixtures/tpcds/tpcds56.sql
|
|
240
|
+
tests/fixtures/tpcds/tpcds57.sql
|
|
241
|
+
tests/fixtures/tpcds/tpcds58.sql
|
|
242
|
+
tests/fixtures/tpcds/tpcds59.sql
|
|
243
|
+
tests/fixtures/tpcds/tpcds6.sql
|
|
244
|
+
tests/fixtures/tpcds/tpcds60.sql
|
|
245
|
+
tests/fixtures/tpcds/tpcds61.sql
|
|
246
|
+
tests/fixtures/tpcds/tpcds62.sql
|
|
247
|
+
tests/fixtures/tpcds/tpcds63.sql
|
|
248
|
+
tests/fixtures/tpcds/tpcds64.sql
|
|
249
|
+
tests/fixtures/tpcds/tpcds65.sql
|
|
250
|
+
tests/fixtures/tpcds/tpcds66.sql
|
|
251
|
+
tests/fixtures/tpcds/tpcds67.sql
|
|
252
|
+
tests/fixtures/tpcds/tpcds68.sql
|
|
253
|
+
tests/fixtures/tpcds/tpcds69.sql
|
|
254
|
+
tests/fixtures/tpcds/tpcds7.sql
|
|
255
|
+
tests/fixtures/tpcds/tpcds70.sql
|
|
256
|
+
tests/fixtures/tpcds/tpcds71.sql
|
|
257
|
+
tests/fixtures/tpcds/tpcds72.sql
|
|
258
|
+
tests/fixtures/tpcds/tpcds73.sql
|
|
259
|
+
tests/fixtures/tpcds/tpcds74.sql
|
|
260
|
+
tests/fixtures/tpcds/tpcds75.sql
|
|
261
|
+
tests/fixtures/tpcds/tpcds76.sql
|
|
262
|
+
tests/fixtures/tpcds/tpcds77.sql
|
|
263
|
+
tests/fixtures/tpcds/tpcds78.sql
|
|
264
|
+
tests/fixtures/tpcds/tpcds79.sql
|
|
265
|
+
tests/fixtures/tpcds/tpcds8.sql
|
|
266
|
+
tests/fixtures/tpcds/tpcds80.sql
|
|
267
|
+
tests/fixtures/tpcds/tpcds81.sql
|
|
268
|
+
tests/fixtures/tpcds/tpcds82.sql
|
|
269
|
+
tests/fixtures/tpcds/tpcds83.sql
|
|
270
|
+
tests/fixtures/tpcds/tpcds84.sql
|
|
271
|
+
tests/fixtures/tpcds/tpcds85.sql
|
|
272
|
+
tests/fixtures/tpcds/tpcds86.sql
|
|
273
|
+
tests/fixtures/tpcds/tpcds87.sql
|
|
274
|
+
tests/fixtures/tpcds/tpcds88.sql
|
|
275
|
+
tests/fixtures/tpcds/tpcds89.sql
|
|
276
|
+
tests/fixtures/tpcds/tpcds9.sql
|
|
277
|
+
tests/fixtures/tpcds/tpcds90.sql
|
|
278
|
+
tests/fixtures/tpcds/tpcds91.sql
|
|
279
|
+
tests/fixtures/tpcds/tpcds92.sql
|
|
280
|
+
tests/fixtures/tpcds/tpcds93.sql
|
|
281
|
+
tests/fixtures/tpcds/tpcds94.sql
|
|
282
|
+
tests/fixtures/tpcds/tpcds95.sql
|
|
283
|
+
tests/fixtures/tpcds/tpcds96.sql
|
|
284
|
+
tests/fixtures/tpcds/tpcds97.sql
|
|
285
|
+
tests/fixtures/tpcds/tpcds98.sql
|
|
286
|
+
tests/fixtures/tpcds/tpcds99.sql
|
|
174
287
|
tests/integration/__init__.py
|
|
175
288
|
tests/integration/fixtures.py
|
|
176
289
|
tests/integration/test_int_dataframe.py
|
|
@@ -196,6 +309,7 @@ tests/integration/engines/duck/test_duckdb_dataframe.py
|
|
|
196
309
|
tests/integration/engines/duck/test_duckdb_reader.py
|
|
197
310
|
tests/integration/engines/duck/test_duckdb_session.py
|
|
198
311
|
tests/integration/engines/duck/test_duckdb_udf.py
|
|
312
|
+
tests/integration/engines/duck/test_tpcds.py
|
|
199
313
|
tests/integration/engines/postgres/__init__.py
|
|
200
314
|
tests/integration/engines/postgres/test_postgres_activate.py
|
|
201
315
|
tests/integration/engines/postgres/test_postgres_catalog.py
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
prettytable<3.11.1
|
|
2
|
-
sqlglot<25.
|
|
2
|
+
sqlglot<25.22,>=24.0.0
|
|
3
3
|
typing_extensions<5,>=4.8
|
|
4
4
|
|
|
5
5
|
[bigquery]
|
|
@@ -7,10 +7,10 @@ google-cloud-bigquery-storage<3,>=2
|
|
|
7
7
|
google-cloud-bigquery[pandas]<4,>=3
|
|
8
8
|
|
|
9
9
|
[dev]
|
|
10
|
-
duckdb<1.
|
|
10
|
+
duckdb<1.2,>=0.9
|
|
11
11
|
findspark<3,>=2
|
|
12
12
|
mypy<1.12,>=1.10.0
|
|
13
|
-
openai<1.
|
|
13
|
+
openai<1.46,>=1.30
|
|
14
14
|
pandas-stubs<3,>=2
|
|
15
15
|
pandas<3,>=2
|
|
16
16
|
psycopg<4,>=3.1
|
|
@@ -36,11 +36,11 @@ mkdocs==1.4.2
|
|
|
36
36
|
pymdown-extensions
|
|
37
37
|
|
|
38
38
|
[duckdb]
|
|
39
|
-
duckdb<1.
|
|
39
|
+
duckdb<1.2,>=0.9
|
|
40
40
|
pandas<3,>=2
|
|
41
41
|
|
|
42
42
|
[openai]
|
|
43
|
-
openai<1.
|
|
43
|
+
openai<1.46,>=1.30
|
|
44
44
|
|
|
45
45
|
[pandas]
|
|
46
46
|
pandas<3,>=2
|
|
@@ -2,12 +2,15 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import typing as t
|
|
5
|
+
from pathlib import Path
|
|
5
6
|
|
|
7
|
+
import duckdb
|
|
6
8
|
import pytest
|
|
7
9
|
from pyspark import SparkConf
|
|
8
10
|
from pyspark.sql import SparkSession as PySparkSession
|
|
9
11
|
from pytest_postgresql.janitor import DatabaseJanitor
|
|
10
12
|
|
|
13
|
+
from sqlframe.base.session import _BaseSession
|
|
11
14
|
from sqlframe.bigquery.session import BigQuerySession
|
|
12
15
|
from sqlframe.duckdb.session import DuckDBSession
|
|
13
16
|
from sqlframe.postgres.session import PostgresSession
|
|
@@ -28,8 +31,57 @@ if t.TYPE_CHECKING:
|
|
|
28
31
|
from tests.types import EmployeeData
|
|
29
32
|
|
|
30
33
|
|
|
34
|
+
def load_tpcds(paths: t.List[Path], session: t.Union[_BaseSession, PySparkSession]):
|
|
35
|
+
for path in paths:
|
|
36
|
+
table_name = path.name
|
|
37
|
+
session.read.parquet(str(path / "*.parquet")).createOrReplaceTempView(table_name)
|
|
38
|
+
|
|
39
|
+
|
|
31
40
|
@pytest.fixture(scope="session")
|
|
32
|
-
def
|
|
41
|
+
def gen_tpcds(tmp_path_factory) -> t.List[Path]:
|
|
42
|
+
path_root = tmp_path_factory.mktemp("tpcds")
|
|
43
|
+
results = []
|
|
44
|
+
tables = [
|
|
45
|
+
"web_site",
|
|
46
|
+
"web_sales",
|
|
47
|
+
"web_returns",
|
|
48
|
+
"web_page",
|
|
49
|
+
"warehouse",
|
|
50
|
+
"time_dim",
|
|
51
|
+
"store_sales",
|
|
52
|
+
"store_returns",
|
|
53
|
+
"store",
|
|
54
|
+
"ship_mode",
|
|
55
|
+
"reason",
|
|
56
|
+
"promotion",
|
|
57
|
+
"item",
|
|
58
|
+
"inventory",
|
|
59
|
+
"income_band",
|
|
60
|
+
"household_demographics",
|
|
61
|
+
"date_dim",
|
|
62
|
+
"customer_demographics",
|
|
63
|
+
"customer_address",
|
|
64
|
+
"customer",
|
|
65
|
+
"catalog_sales",
|
|
66
|
+
"catalog_returns",
|
|
67
|
+
"catalog_page",
|
|
68
|
+
"call_center",
|
|
69
|
+
]
|
|
70
|
+
con = duckdb.connect()
|
|
71
|
+
con.sql("CALL dsdgen(sf=0.01)")
|
|
72
|
+
for table in tables:
|
|
73
|
+
path = path_root / table
|
|
74
|
+
path.mkdir(parents=True)
|
|
75
|
+
con.sql(
|
|
76
|
+
f"COPY (SELECT * FROM {table}) TO '{path}' (FORMAT PARQUET, PER_THREAD_OUTPUT TRUE)"
|
|
77
|
+
)
|
|
78
|
+
results.append(path)
|
|
79
|
+
con.close()
|
|
80
|
+
return results
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@pytest.fixture(scope="session")
|
|
84
|
+
def pyspark_session(tmp_path_factory, gen_tpcds: t.List[Path]) -> PySparkSession:
|
|
33
85
|
data_dir = tmp_path_factory.mktemp("spark_connection")
|
|
34
86
|
derby_dir = tmp_path_factory.mktemp("derby")
|
|
35
87
|
spark = (
|
|
@@ -49,6 +101,7 @@ def pyspark_session(tmp_path_factory) -> PySparkSession:
|
|
|
49
101
|
spark.sql("CREATE TABLE db1.table1 (id INTEGER, name STRING)")
|
|
50
102
|
spark.catalog.registerFunction("add", lambda x, y: x + y)
|
|
51
103
|
spark.catalog.setCurrentDatabase("db1")
|
|
104
|
+
load_tpcds(gen_tpcds, spark)
|
|
52
105
|
return spark
|
|
53
106
|
|
|
54
107
|
|
|
@@ -64,11 +117,7 @@ def spark_session(pyspark_session: PySparkSession) -> SparkSession:
|
|
|
64
117
|
|
|
65
118
|
@pytest.fixture(scope="function")
|
|
66
119
|
def duckdb_session() -> DuckDBSession:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# https://github.com/duckdb/duckdb/issues/11404
|
|
70
|
-
connection = connect()
|
|
71
|
-
connection.sql("set TimeZone = 'UTC'")
|
|
120
|
+
connection = duckdb.connect(config={"TimeZone": "UTC"})
|
|
72
121
|
return DuckDBSession(conn=connection)
|
|
73
122
|
|
|
74
123
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{"commitInfo":{"timestamp":1725137989496,"operation":"WRITE","operationParameters":{"mode":"ErrorIfExists","partitionBy":"[]"},"isolationLevel":"Serializable","isBlindAppend":true,"operationMetrics":{"numFiles":"6","numOutputRows":"5","numOutputBytes":"7800"},"engineInfo":"Apache-Spark/3.5.2 Delta-Lake/3.2.0","txnId":"17633aa0-b065-49d6-9893-022103f7364e"}}
|
|
2
|
+
{"metaData":{"id":"73709a6c-bb75-4ac7-a78e-635400886d74","format":{"provider":"parquet","options":{}},"schemaString":"{\"type\":\"struct\",\"fields\":[{\"name\":\"employee_id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"fname\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"lname\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"age\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"store_id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}]}","partitionColumns":[],"configuration":{},"createdTime":1725137987547}}
|
|
3
|
+
{"protocol":{"minReaderVersion":1,"minWriterVersion":2}}
|
|
4
|
+
{"add":{"path":"part-00002-3fed7f18-370f-4b16-b232-504d6194eb52-c000.snappy.parquet","partitionValues":{},"size":1437,"modificationTime":1725137989427,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":1,\"fname\":\"Jack\",\"lname\":\"Shephard\",\"age\":37,\"store_id\":1},\"maxValues\":{\"employee_id\":1,\"fname\":\"Jack\",\"lname\":\"Shephard\",\"age\":37,\"store_id\":1},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
|
|
5
|
+
{"add":{"path":"part-00004-143c5da1-d5ab-4706-8e84-0d2a324c6894-c000.snappy.parquet","partitionValues":{},"size":1417,"modificationTime":1725137989428,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":2,\"fname\":\"John\",\"lname\":\"Locke\",\"age\":65,\"store_id\":1},\"maxValues\":{\"employee_id\":2,\"fname\":\"John\",\"lname\":\"Locke\",\"age\":65,\"store_id\":1},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
|
|
6
|
+
{"add":{"path":"part-00006-64f07e25-c30e-4075-acc6-b3c69c4ce80b-c000.snappy.parquet","partitionValues":{},"size":1424,"modificationTime":1725137989428,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":3,\"fname\":\"Kate\",\"lname\":\"Austen\",\"age\":37,\"store_id\":2},\"maxValues\":{\"employee_id\":3,\"fname\":\"Kate\",\"lname\":\"Austen\",\"age\":37,\"store_id\":2},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
|
|
7
|
+
{"add":{"path":"part-00008-89ccad8d-df73-4ad5-8850-82ef3884db60-c000.snappy.parquet","partitionValues":{},"size":1459,"modificationTime":1725137989427,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":4,\"fname\":\"Claire\",\"lname\":\"Littleton\",\"age\":27,\"store_id\":2},\"maxValues\":{\"employee_id\":4,\"fname\":\"Claire\",\"lname\":\"Littleton\",\"age\":27,\"store_id\":2},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
|
|
8
|
+
{"add":{"path":"part-00010-812b3382-8c7f-4c4e-9bcd-09ce8664f6e0-c000.snappy.parquet","partitionValues":{},"size":1417,"modificationTime":1725137989428,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"employee_id\":5,\"fname\":\"Hugo\",\"lname\":\"Reyes\",\"age\":29,\"store_id\":100},\"maxValues\":{\"employee_id\":5,\"fname\":\"Hugo\",\"lname\":\"Reyes\",\"age\":29,\"store_id\":100},\"nullCount\":{\"employee_id\":0,\"fname\":0,\"lname\":0,\"age\":0,\"store_id\":0}}"}}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
WITH customer_total_return AS
|
|
2
|
+
(SELECT sr_customer_sk AS ctr_customer_sk,
|
|
3
|
+
sr_store_sk AS ctr_store_sk,
|
|
4
|
+
sum(sr_return_amt) AS ctr_total_return
|
|
5
|
+
FROM store_returns,
|
|
6
|
+
date_dim
|
|
7
|
+
WHERE sr_returned_date_sk = d_date_sk
|
|
8
|
+
AND d_year = 2000
|
|
9
|
+
GROUP BY sr_customer_sk,
|
|
10
|
+
sr_store_sk)
|
|
11
|
+
SELECT c_customer_id
|
|
12
|
+
FROM customer_total_return ctr1,
|
|
13
|
+
store,
|
|
14
|
+
customer
|
|
15
|
+
WHERE ctr1.ctr_total_return >
|
|
16
|
+
(SELECT avg(ctr_total_return)*1.2
|
|
17
|
+
FROM customer_total_return ctr2
|
|
18
|
+
WHERE ctr1.ctr_store_sk = ctr2.ctr_store_sk)
|
|
19
|
+
AND s_store_sk = ctr1.ctr_store_sk
|
|
20
|
+
AND s_state = 'TN'
|
|
21
|
+
AND ctr1.ctr_customer_sk = c_customer_sk
|
|
22
|
+
ORDER BY c_customer_id
|
|
23
|
+
LIMIT 100;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
SELECT cd_gender,
|
|
2
|
+
cd_marital_status,
|
|
3
|
+
cd_education_status,
|
|
4
|
+
count(*) cnt1,
|
|
5
|
+
cd_purchase_estimate,
|
|
6
|
+
count(*) cnt2,
|
|
7
|
+
cd_credit_rating,
|
|
8
|
+
count(*) cnt3,
|
|
9
|
+
cd_dep_count,
|
|
10
|
+
count(*) cnt4,
|
|
11
|
+
cd_dep_employed_count,
|
|
12
|
+
count(*) cnt5,
|
|
13
|
+
cd_dep_college_count,
|
|
14
|
+
count(*) cnt6
|
|
15
|
+
FROM customer c,
|
|
16
|
+
customer_address ca,
|
|
17
|
+
customer_demographics
|
|
18
|
+
WHERE c.c_current_addr_sk = ca.ca_address_sk
|
|
19
|
+
AND ca_county IN ('Rush County',
|
|
20
|
+
'Toole County',
|
|
21
|
+
'Jefferson County',
|
|
22
|
+
'Dona Ana County',
|
|
23
|
+
'La Porte County')
|
|
24
|
+
AND cd_demo_sk = c.c_current_cdemo_sk
|
|
25
|
+
AND EXISTS
|
|
26
|
+
(SELECT *
|
|
27
|
+
FROM store_sales,
|
|
28
|
+
date_dim
|
|
29
|
+
WHERE c.c_customer_sk = ss_customer_sk
|
|
30
|
+
AND ss_sold_date_sk = d_date_sk
|
|
31
|
+
AND d_year = 2002
|
|
32
|
+
AND d_moy BETWEEN 1 AND 1+3)
|
|
33
|
+
AND (EXISTS
|
|
34
|
+
(SELECT *
|
|
35
|
+
FROM web_sales,
|
|
36
|
+
date_dim
|
|
37
|
+
WHERE c.c_customer_sk = ws_bill_customer_sk
|
|
38
|
+
AND ws_sold_date_sk = d_date_sk
|
|
39
|
+
AND d_year = 2002
|
|
40
|
+
AND d_moy BETWEEN 1 AND 1+3)
|
|
41
|
+
OR EXISTS
|
|
42
|
+
(SELECT *
|
|
43
|
+
FROM catalog_sales,
|
|
44
|
+
date_dim
|
|
45
|
+
WHERE c.c_customer_sk = cs_ship_customer_sk
|
|
46
|
+
AND cs_sold_date_sk = d_date_sk
|
|
47
|
+
AND d_year = 2002
|
|
48
|
+
AND d_moy BETWEEN 1 AND 1+3))
|
|
49
|
+
GROUP BY cd_gender,
|
|
50
|
+
cd_marital_status,
|
|
51
|
+
cd_education_status,
|
|
52
|
+
cd_purchase_estimate,
|
|
53
|
+
cd_credit_rating,
|
|
54
|
+
cd_dep_count,
|
|
55
|
+
cd_dep_employed_count,
|
|
56
|
+
cd_dep_college_count
|
|
57
|
+
ORDER BY cd_gender,
|
|
58
|
+
cd_marital_status,
|
|
59
|
+
cd_education_status,
|
|
60
|
+
cd_purchase_estimate,
|
|
61
|
+
cd_credit_rating,
|
|
62
|
+
cd_dep_count,
|
|
63
|
+
cd_dep_employed_count,
|
|
64
|
+
cd_dep_college_count
|
|
65
|
+
LIMIT 100;
|