diff --git a/.github/workflows/cd-sql-engine-tests.yaml b/.github/workflows/cd-sql-engine-tests.yaml index 60617bb928..345538feec 100644 --- a/.github/workflows/cd-sql-engine-tests.yaml +++ b/.github/workflows/cd-sql-engine-tests.yaml @@ -107,6 +107,39 @@ jobs: MF_SQL_ENGINE_URL: ${{ secrets.MF_BIGQUERY_URL }} MF_SQL_ENGINE_PASSWORD: ${{ secrets.MF_BIGQUERY_PWD }} + databricks-tests: + environment: DW_INTEGRATION_TESTS + name: Databricks Tests + if: ${{ github.event.action != 'labeled' || github.event.label.name == 'run_mf_sql_engine_tests' }} + runs-on: ubuntu-latest + steps: + - name: Check-out the repo + uses: actions/checkout@v2 + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: "3.8" + + - uses: actions/cache@v2 + with: + path: | + ${{ env.pythonLocation }} + ~/.cache/pypoetry + key: ${{ env.pythonLocation }}-${{ hashFiles('metricflow/poetry.lock') }} + + - name: Install Poetry + run: pip install poetry==1.1.15 && poetry config virtualenvs.create false + + - name: Install Deps + run: cd metricflow && poetry install + + - name: Run MetricFlow unit tests with Databricks configs + run: pytest metricflow/test/ + env: + MF_SQL_ENGINE_URL: ${{ secrets.MF_DATABRICKS_URL }} + MF_SQL_ENGINE_PASSWORD: ${{ secrets.MF_DATABRICKS_PWD }} + postgres-tests: name: PostgreSQL Tests if: ${{ github.event.action != 'labeled' || github.event.label.name == 'run_mf_sql_engine_tests' }} diff --git a/.gitignore b/.gitignore index 013d0cc515..19eab7f09f 100644 --- a/.gitignore +++ b/.gitignore @@ -108,7 +108,7 @@ celerybeat.pid .env .venv env/ -venv/ +*venv ENV/ env.bak/ venv.bak/ diff --git a/metricflow/cli/main.py b/metricflow/cli/main.py index c6b6344de2..6a1433860c 100644 --- a/metricflow/cli/main.py +++ b/metricflow/cli/main.py @@ -33,6 +33,7 @@ start_end_time_options, generate_duckdb_demo_keys, MF_POSTGRESQL_KEYS, + MF_DATABRICKS_KEYS, ) from metricflow.configuration.config_builder import YamlTemplateBuilder from metricflow.dataflow.sql_table import SqlTable @@ -144,6 +145,7 @@ def setup(cfg: CLIContext, restart: bool) -> None: SqlDialect.REDSHIFT.value: MF_REDSHIFT_KEYS, SqlDialect.POSTGRESQL.value: MF_POSTGRESQL_KEYS, SqlDialect.DUCKDB.value: generate_duckdb_demo_keys(config_dir=cfg.config.dir_path), + SqlDialect.DATABRICKS.value: MF_DATABRICKS_KEYS, } click.echo("Please enter your data warehouse dialect.") diff --git a/metricflow/cli/utils.py b/metricflow/cli/utils.py index 16017d2df4..c58cd67dd8 100644 --- a/metricflow/cli/utils.py +++ b/metricflow/cli/utils.py @@ -25,6 +25,8 @@ CONFIG_DWH_WAREHOUSE, CONFIG_EMAIL, CONFIG_MODEL_PATH, + CONFIG_DWH_HTTP_PATH, + CONFIG_DWH_ACCESS_TOKEN, ) from metricflow.sql_clients.common_client import SqlDialect @@ -51,7 +53,7 @@ ConfigKey(key=CONFIG_DWH_DIALECT, value=SqlDialect.BIGQUERY.value), ) -# Redshift config keys +# Postgres config keys MF_POSTGRESQL_KEYS = ( ConfigKey(key=CONFIG_DWH_DB), ConfigKey(key=CONFIG_DWH_PASSWORD, comment="Password associated with the provided user"), @@ -80,6 +82,14 @@ ConfigKey(key=CONFIG_DWH_DIALECT, value=SqlDialect.SNOWFLAKE.value), ) +# Databricks config keys +MF_DATABRICKS_KEYS = ( + ConfigKey(key=CONFIG_DWH_HTTP_PATH), + ConfigKey(key=CONFIG_DWH_HOST), + ConfigKey(key=CONFIG_DWH_ACCESS_TOKEN), + ConfigKey(key=CONFIG_DWH_DIALECT, value=SqlDialect.DATABRICKS.value), +) + def generate_duckdb_demo_keys(config_dir: str) -> Tuple[ConfigKey, ...]: """Generate configuration keys for DuckDB with a file in the config_dir.""" diff --git a/metricflow/configuration/constants.py b/metricflow/configuration/constants.py index 796d9b26fe..41daf988fd 100644 --- a/metricflow/configuration/constants.py +++ b/metricflow/configuration/constants.py @@ -13,3 +13,5 @@ CONFIG_DWH_PROJECT_ID = "dwh_project_id" CONFIG_EMAIL = "email" CONFIG_MODEL_PATH = "model_path" +CONFIG_DWH_HTTP_PATH = "dwh_http_path" +CONFIG_DWH_ACCESS_TOKEN = "dwh_access_token" diff --git a/metricflow/protocols/sql_client.py b/metricflow/protocols/sql_client.py index 7cc8adc745..8acc3a55ba 100644 --- a/metricflow/protocols/sql_client.py +++ b/metricflow/protocols/sql_client.py @@ -18,6 +18,7 @@ class SupportedSqlEngine(Enum): REDSHIFT = "Redshift" POSTGRES = "Postgres" SNOWFLAKE = "Snowflake" + DATABRICKS = "Databricks" class SqlClient(Protocol): @@ -143,6 +144,11 @@ def cancel_submitted_queries(self) -> None: # noqa: D """Cancel queries submitted through this client (that may be still running) with best-effort.""" raise NotImplementedError + @abstractmethod + def render_execution_param_key(self, execution_param_key: str) -> str: + """Wrap execution parameter key with syntax accepted by engine.""" + raise NotImplementedError + class SqlEngineAttributes(Protocol): """Base interface for SQL engine-specific attributes and features diff --git a/metricflow/sql_clients/base_sql_client_implementation.py b/metricflow/sql_clients/base_sql_client_implementation.py index b5ff95ff8e..a73b4b3512 100644 --- a/metricflow/sql_clients/base_sql_client_implementation.py +++ b/metricflow/sql_clients/base_sql_client_implementation.py @@ -203,3 +203,7 @@ def drop_table(self, sql_table: SqlTable) -> None: # noqa: D def close(self) -> None: # noqa: D pass + + def render_execution_param_key(self, execution_param_key: str) -> str: + """Wrap execution parameter key with syntax accepted by engine.""" + return f":{execution_param_key}" diff --git a/metricflow/sql_clients/common_client.py b/metricflow/sql_clients/common_client.py index b3fc140cf1..e92ce485f9 100644 --- a/metricflow/sql_clients/common_client.py +++ b/metricflow/sql_clients/common_client.py @@ -12,6 +12,7 @@ class SqlDialect(ExtendedEnum): MYSQL = "mysql" SNOWFLAKE = "snowflake" BIGQUERY = "bigquery" + DATABRICKS = "databricks" T = TypeVar("T") diff --git a/metricflow/sql_clients/databricks.py b/metricflow/sql_clients/databricks.py new file mode 100644 index 0000000000..d35d427e45 --- /dev/null +++ b/metricflow/sql_clients/databricks.py @@ -0,0 +1,176 @@ +from __future__ import annotations +from typing import Optional, List, ClassVar, Dict +import pandas as pd +import logging +import time +import sqlalchemy +from databricks import sql +from metricflow.sql_clients.common_client import SqlDialect +from metricflow.sql_clients.base_sql_client_implementation import BaseSqlClientImplementation +from metricflow.protocols.sql_client import SqlEngineAttributes, SupportedSqlEngine +from metricflow.sql.sql_bind_parameters import SqlBindParameters +from metricflow.dataflow.sql_table import SqlTable +from metricflow.sql.render.sql_plan_renderer import DefaultSqlQueryPlanRenderer, SqlQueryPlanRenderer + +logger = logging.getLogger(__name__) + +HTTP_PATH_KEY = "httppath=" +PANDAS_TO_SQL_DTYPES = { + "object": "string", + "float64": "double", + "bool": "boolean", + "int64": "int", + "datetime64[ns]": "timestamp", +} + + +class DatabricksEngineAttributes(SqlEngineAttributes): + """SQL engine attributes for Databricks.""" + + sql_engine_type: ClassVar[SupportedSqlEngine] = SupportedSqlEngine.DATABRICKS + + # SQL Engine capabilities + date_trunc_supported: ClassVar[bool] = True + full_outer_joins_supported: ClassVar[bool] = True + indexes_supported: ClassVar[bool] = True + multi_threading_supported: ClassVar[bool] = True + timestamp_type_supported: ClassVar[bool] = True + timestamp_to_string_comparison_supported: ClassVar[bool] = True + # So far the only clear way to cancel a query is through the Databricks UI. + cancel_submitted_queries_supported: ClassVar[bool] = False + + # SQL Dialect replacement strings + double_data_type_name: ClassVar[str] = "DOUBLE" + timestamp_type_name: ClassVar[Optional[str]] = "TIMESTAMP" + + # MetricFlow attributes + sql_query_plan_renderer: ClassVar[SqlQueryPlanRenderer] = DefaultSqlQueryPlanRenderer() + + +class DatabricksSqlClient(BaseSqlClientImplementation): + """Client used to connect to Databricks engine.""" + + def __init__(self, host: str, http_path: str, access_token: str) -> None: # noqa: D + self.host = host + self.http_path = http_path + self.access_token = access_token + + @staticmethod + def from_connection_details(url: str, password: Optional[str]) -> DatabricksSqlClient: # noqa: D + """Parse MF_SQL_ENGINE_URL & MF_SQL_ENGINE_PASSWORD into useful connection params. + + Using just these 2 env variables ensures uniformity across engines. + """ + try: + split_url = url.split(";") + parsed_url = sqlalchemy.engine.url.make_url(split_url[0]) + http_path = "" + for piece in split_url[1:]: + if HTTP_PATH_KEY in piece.lower(): + __, http_path = piece.split("=") + break + dialect = SqlDialect.DATABRICKS.value + if not http_path or parsed_url.drivername != dialect or not parsed_url.host: + raise ValueError + except ValueError: + # If any errors in parsing URL, show user what expected URL looks like. + raise ValueError( + "Unexpected format for MF_SQL_ENGINE_URL. Expected: `databricks://:443;HttpPath=" + ) + + if not password: + raise ValueError(f"Password not supplied for {url}") + + return DatabricksSqlClient(host=parsed_url.host, http_path=http_path, access_token=password) + + def get_connection(self) -> sql.client.Connection: + """Get connection to Databricks cluster/warehouse.""" + return sql.connect(server_hostname=self.host, http_path=self.http_path, access_token=self.access_token) + + @property + def sql_engine_attributes(self) -> SqlEngineAttributes: + """Databricks engine attributes.""" + return DatabricksEngineAttributes() + + @staticmethod + def params_or_none(bind_params: SqlBindParameters) -> Optional[Dict[str, str]]: + """If there are no parameters, use None to prevent collision with `%` wildcard.""" + return None if bind_params == SqlBindParameters() else bind_params.param_dict + + def _engine_specific_query_implementation(self, stmt: str, bind_params: SqlBindParameters) -> pd.DataFrame: + with self.get_connection() as connection: + with connection.cursor() as cursor: + cursor.execute(operation=stmt, parameters=self.params_or_none(bind_params)) + logger.info("Fetching query results as PyArrow Table.") + pyarrow_df = cursor.fetchall_arrow() + + logger.info("Beginning conversion of PyArrow Table to pandas DataFrame.") + pandas_df = pyarrow_df.to_pandas() + logger.info("Completed conversion of PyArrow Table to pandas DataFrame.") + return pandas_df + + def _engine_specific_execute_implementation(self, stmt: str, bind_params: SqlBindParameters) -> None: + """Execute statement, returning nothing.""" + with self.get_connection() as connection: + with connection.cursor() as cursor: + logger.info(f"Executing SQL statment: {stmt}") + cursor.execute(operation=stmt, parameters=self.params_or_none(bind_params)) + + def _engine_specific_dry_run_implementation(self, stmt: str, bind_params: SqlBindParameters) -> None: + """Check that query will run successfully without actually running the query, error if not.""" + stmt = f"EXPLAIN {stmt}" + + with self.get_connection() as connection: + with connection.cursor() as cursor: + logger.info(f"Executing SQL statment: {stmt}") + cursor.execute(operation=stmt, parameters=self.params_or_none(bind_params)) + + # If the plan contains errors, they won't be raised. Parse plan string to find & raise errors. + result = str(cursor.fetchall_arrow()["plan"][0]) + if "org.apache.spark.sql.AnalysisException" in result: + error = result.split("== Physical Plan ==")[1].split(";")[0] + raise sql.exc.ServerOperationError(error) + + def create_table_from_dataframe( # noqa: D + self, sql_table: SqlTable, df: pd.DataFrame, chunk_size: Optional[int] = None + ) -> None: + logger.info(f"Creating table '{sql_table.sql}' from a DataFrame with {df.shape[0]} row(s)") + start_time = time.time() + with self.get_connection() as connection: + with connection.cursor() as cursor: + # Create table + columns = df.columns + columns_to_insert = [] + for i in range(len(df.columns)): + # Format as "column_name column_type" + columns_to_insert.append(f"{columns[i]} {PANDAS_TO_SQL_DTYPES[str(df[columns[i]].dtype)]}") + cursor.execute(f"CREATE TABLE IF NOT EXISTS {sql_table.sql} ({', '.join(columns_to_insert)})") + + # Insert rows + values = [] + for row in df.itertuples(index=False, name=None): + cells = [] + for cell in row: + if type(cell) in [str, pd.Timestamp]: + # Wrap cell in quotes & escape existing single quotes + escaped_cell = str(cell).replace("'", "\\'") + cells.append(f"'{escaped_cell}'") + else: + cells.append(str(cell)) + values.append(f"({', '.join(cells)})") + cursor.execute(f"INSERT INTO {sql_table.sql} VALUES {', '.join(values)}") + + logger.info(f"Created table '{sql_table.sql}' from a DataFrame in {time.time() - start_time:.2f}s") + + def list_tables(self, schema_name: str) -> List[str]: # noqa: D + with self.get_connection() as connection: + with connection.cursor() as cursor: + cursor.tables(schema_name=schema_name) + return [table.TABLE_NAME for table in cursor.fetchall()] + + def cancel_submitted_queries(self) -> None: # noqa: D + pass + + def render_execution_param_key(self, execution_param_key: str) -> str: + """Wrap execution parameter key with syntax accepted by engine.""" + return f"%({execution_param_key})s" diff --git a/metricflow/sql_clients/postgres.py b/metricflow/sql_clients/postgres.py index 11a9374bf2..180456073b 100644 --- a/metricflow/sql_clients/postgres.py +++ b/metricflow/sql_clients/postgres.py @@ -83,7 +83,7 @@ def __init__( # noqa: D @property def sql_engine_attributes(self) -> SqlEngineAttributes: - """Collection of attributes and features specific to the Snowflake SQL engine""" + """Collection of attributes and features specific to the Postgres SQL engine""" return PostgresEngineAttributes() def cancel_submitted_queries(self) -> None: # noqa: D diff --git a/metricflow/sql_clients/sql_utils.py b/metricflow/sql_clients/sql_utils.py index bfc3a690b8..8b04aca8aa 100644 --- a/metricflow/sql_clients/sql_utils.py +++ b/metricflow/sql_clients/sql_utils.py @@ -15,6 +15,8 @@ CONFIG_DWH_PROJECT_ID, CONFIG_DWH_USER, CONFIG_DWH_WAREHOUSE, + CONFIG_DWH_ACCESS_TOKEN, + CONFIG_DWH_HTTP_PATH, ) from metricflow.configuration.yaml_handler import YamlFileHandler from metricflow.protocols.sql_client import SqlClient @@ -24,6 +26,7 @@ from metricflow.sql_clients.postgres import PostgresSqlClient from metricflow.sql_clients.redshift import RedshiftSqlClient from metricflow.sql_clients.snowflake import SnowflakeSqlClient +from metricflow.sql_clients.databricks import DatabricksSqlClient def make_df( # type: ignore [misc] @@ -56,8 +59,9 @@ def make_df( # type: ignore [misc] ) -def make_sql_client(url: str, password: str) -> SqlClient: # noqa: D - dialect_protocol = make_url(url).drivername.split("+") +def make_sql_client(url: str, password: str) -> SqlClient: + """Build SQL client based on env configs. Used only in tests.""" + dialect_protocol = make_url(url.split(";")[0]).drivername.split("+") dialect = SqlDialect(dialect_protocol[0]) if len(dialect_protocol) > 2: raise ValueError(f"Invalid # of +'s in {url}") @@ -72,6 +76,8 @@ def make_sql_client(url: str, password: str) -> SqlClient: # noqa: D return PostgresSqlClient.from_connection_details(url, password) elif dialect == SqlDialect.DUCKDB: return DuckDbSqlClient.from_connection_details(url, password) + elif dialect == SqlDialect.DATABRICKS: + return DatabricksSqlClient.from_connection_details(url, password) else: raise ValueError(f"Unknown dialect: `{dialect}` in URL {url}") @@ -139,6 +145,11 @@ def make_sql_client_from_config(handler: YamlFileHandler) -> SqlClient: password=password, database=database, ) + elif dialect == SqlDialect.DATABRICKS.value: + host = not_empty(handler.get_value(CONFIG_DWH_HOST), CONFIG_DWH_HOST, url) + access_token = not_empty(handler.get_value(CONFIG_DWH_ACCESS_TOKEN), CONFIG_DWH_ACCESS_TOKEN, url) + http_path = not_empty(handler.get_value(CONFIG_DWH_HTTP_PATH), CONFIG_DWH_HTTP_PATH, url) + return DatabricksSqlClient(host=host, access_token=access_token, http_path=http_path) else: supported_dialects = [x.value for x in SqlDialect] raise ValueError(f"Invalid dialect '{dialect}', must be one of {supported_dialects} in {url}") diff --git a/metricflow/test/compare_df.py b/metricflow/test/compare_df.py index 415b49a00b..1a1e381816 100644 --- a/metricflow/test/compare_df.py +++ b/metricflow/test/compare_df.py @@ -1,5 +1,4 @@ import logging - import math import pandas as pd @@ -26,6 +25,15 @@ def _dataframes_contain_same_data( elif isinstance(expected.iloc[c, r], float) and isinstance(actual.iloc[c, r], float): if not math.isclose(expected.iloc[c, r], actual.iloc[c, r]): return False + elif ( + isinstance(expected.iloc[c, r], pd.Timestamp) + and isinstance(actual.iloc[c, r], pd.Timestamp) + # If expected has no tz but actual is UTC, remove timezone. Some engines add UTC by default. + and actual.iloc[c, r].tzname() == "UTC" + and expected.iloc[c, r].tzname() is None + ): + if actual.iloc[c, r].tz_localize(None) != expected.iloc[c, r].tz_localize(None): + return False elif expected.iloc[c, r] != actual.iloc[c, r]: return False return True diff --git a/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_query_data_source__plan0.sql b/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_query_data_source__plan0.sql new file mode 100644 index 0000000000..59738a3c1a --- /dev/null +++ b/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_query_data_source__plan0.sql @@ -0,0 +1,13 @@ +-- Read Elements From Data Source 'revenue' +SELECT + revenue_src_10006.revenue AS txn_revenue + , revenue_src_10006.created_at AS ds + , DATE_TRUNC('week', revenue_src_10006.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , revenue_src_10006.user_id AS user +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue +) revenue_src_10006 diff --git a/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_table_data_source_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_table_data_source_with_measures__plan0.sql new file mode 100644 index 0000000000..c755126f21 --- /dev/null +++ b/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_table_data_source_with_measures__plan0.sql @@ -0,0 +1,29 @@ +-- Read Elements From Data Source 'id_verifications' +SELECT + 1 AS identity_verifications + , id_verifications_src_10003.ds + , DATE_TRUNC('week', id_verifications_src_10003.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , id_verifications_src_10003.ds_partitioned + , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , id_verifications_src_10003.verification_type + , id_verifications_src_10003.ds AS verification__ds + , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned + , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , id_verifications_src_10003.verification_type AS verification__verification_type + , id_verifications_src_10003.verification_id AS verification + , id_verifications_src_10003.user_id AS user + , id_verifications_src_10003.user_id AS verification__user +FROM ***************************.fct_id_verifications id_verifications_src_10003 diff --git a/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_table_data_source_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_table_data_source_without_measures__plan0.sql new file mode 100644 index 0000000000..75ae7f94bb --- /dev/null +++ b/metricflow/test/snapshots/test_convert_data_source.py/SqlQueryPlan/DatabricksSqlClient/test_convert_table_data_source_without_measures__plan0.sql @@ -0,0 +1,16 @@ +-- Read Elements From Data Source 'users_latest' +SELECT + users_latest_src_10008.ds + , DATE_TRUNC('week', users_latest_src_10008.ds) AS ds__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS ds__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS ds__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS ds__year + , users_latest_src_10008.home_state_latest + , users_latest_src_10008.ds AS user__ds + , DATE_TRUNC('week', users_latest_src_10008.ds) AS user__ds__week + , DATE_TRUNC('month', users_latest_src_10008.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_latest_src_10008.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_latest_src_10008.ds) AS user__ds__year + , users_latest_src_10008.home_state_latest AS user__home_state_latest + , users_latest_src_10008.user_id AS user +FROM ***************************.dim_users_latest users_latest_src_10008 diff --git a/metricflow/test/snapshots/test_data_warehouse_tasks.py/data_warehouse_validation_model/DatabricksSqlClient/test_build_metric_tasks__query0.sql b/metricflow/test/snapshots/test_data_warehouse_tasks.py/data_warehouse_validation_model/DatabricksSqlClient/test_build_metric_tasks__query0.sql new file mode 100644 index 0000000000..2019f9906a --- /dev/null +++ b/metricflow/test/snapshots/test_data_warehouse_tasks.py/data_warehouse_validation_model/DatabricksSqlClient/test_build_metric_tasks__query0.sql @@ -0,0 +1,19 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + metric_time + , SUM(count_dogs) AS count_dogs +FROM ( + -- Read Elements From Data Source 'animals' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['count_dogs', 'metric_time'] + SELECT + ds AS metric_time + , 1 AS count_dogs + FROM ( + SELECT * FROM ***************************.fct_animals + ) animals_src_0 +) subq_2 +GROUP BY + metric_time diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_combined_metrics_plan__ep_0.xml new file mode 100644 index 0000000000..48c9dfc8af --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_combined_metrics_plan__ep_0.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_joined_plan__ep_0.xml new file mode 100644 index 0000000000..aff9172522 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_joined_plan__ep_0.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_multihop_joined_plan__ep_0.xml new file mode 100644 index 0000000000..257e61535d --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_multihop_joined_plan__ep_0.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_small_combined_metrics_plan__ep_0.xml new file mode 100644 index 0000000000..f96509b994 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DatabricksSqlClient/test_small_combined_metrics_plan__ep_0.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier__plan0.sql new file mode 100644 index 0000000000..19c7d6a3ca --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier__plan0.sql @@ -0,0 +1,73 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.user_team___team_id + , subq_3.user_team___user_id + , subq_3.messages +FROM ( + -- Aggregate Measures + SELECT + subq_2.user_team___team_id + , subq_2.user_team___user_id + , SUM(subq_2.messages) AS messages + FROM ( + -- Pass Only Elements: + -- ['messages', 'user_team'] + SELECT + subq_1.user_team___team_id + , subq_1.user_team___user_id + , subq_1.messages + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.user_id__ds + , subq_0.user_id__ds__week + , subq_0.user_id__ds__month + , subq_0.user_id__ds__quarter + , subq_0.user_id__ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user_id + , subq_0.user_team___team_id + , subq_0.user_team___user_id + , subq_0.user_id__user_team___team_id + , subq_0.user_id__user_team___user_id + , subq_0.team_id + , subq_0.user_id__team_id + , subq_0.messages + FROM ( + -- Read Elements From Data Source 'messages_source' + SELECT + 1 AS messages + , messages_source_src_10015.ds + , DATE_TRUNC('week', messages_source_src_10015.ds) AS ds__week + , DATE_TRUNC('month', messages_source_src_10015.ds) AS ds__month + , DATE_TRUNC('quarter', messages_source_src_10015.ds) AS ds__quarter + , DATE_TRUNC('year', messages_source_src_10015.ds) AS ds__year + , messages_source_src_10015.team_id + , messages_source_src_10015.ds AS user_id__ds + , DATE_TRUNC('week', messages_source_src_10015.ds) AS user_id__ds__week + , DATE_TRUNC('month', messages_source_src_10015.ds) AS user_id__ds__month + , DATE_TRUNC('quarter', messages_source_src_10015.ds) AS user_id__ds__quarter + , DATE_TRUNC('year', messages_source_src_10015.ds) AS user_id__ds__year + , messages_source_src_10015.team_id AS user_id__team_id + , messages_source_src_10015.user_id + , messages_source_src_10015.team_id AS user_team___team_id + , messages_source_src_10015.user_id AS user_team___user_id + , messages_source_src_10015.team_id AS user_id__user_team___team_id + , messages_source_src_10015.user_id AS user_id__user_team___user_id + FROM ***************************.fct_messages messages_source_src_10015 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.user_team___team_id + , subq_2.user_team___user_id +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier__plan0_optimized.sql new file mode 100644 index 0000000000..5874a6ce5c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier__plan0_optimized.sql @@ -0,0 +1,20 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + user_team___team_id + , user_team___user_id + , SUM(messages) AS messages +FROM ( + -- Read Elements From Data Source 'messages_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['messages', 'user_team'] + SELECT + team_id AS user_team___team_id + , user_id AS user_team___user_id + , 1 AS messages + FROM ***************************.fct_messages messages_source_src_10015 +) subq_6 +GROUP BY + user_team___team_id + , user_team___user_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_join__plan0.sql new file mode 100644 index 0000000000..9759a80bf2 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_join__plan0.sql @@ -0,0 +1,155 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.user_team___team_id + , subq_7.user_team___user_id + , subq_7.user_team__country + , subq_7.messages +FROM ( + -- Aggregate Measures + SELECT + subq_6.user_team___team_id + , subq_6.user_team___user_id + , subq_6.user_team__country + , SUM(subq_6.messages) AS messages + FROM ( + -- Pass Only Elements: + -- ['messages', 'user_team__country', 'user_team'] + SELECT + subq_5.user_team___team_id + , subq_5.user_team___user_id + , subq_5.user_team__country + , subq_5.messages + FROM ( + -- Join Standard Outputs + SELECT + subq_2.user_team___team_id AS user_team___team_id + , subq_2.user_team___user_id AS user_team___user_id + , subq_4.country AS user_team__country + , subq_2.messages AS messages + FROM ( + -- Pass Only Elements: + -- ['messages', 'user_team', 'user_team'] + SELECT + subq_1.user_team___team_id + , subq_1.user_team___user_id + , subq_1.messages + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.user_id__ds + , subq_0.user_id__ds__week + , subq_0.user_id__ds__month + , subq_0.user_id__ds__quarter + , subq_0.user_id__ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user_id + , subq_0.user_team___team_id + , subq_0.user_team___user_id + , subq_0.user_id__user_team___team_id + , subq_0.user_id__user_team___user_id + , subq_0.team_id + , subq_0.user_id__team_id + , subq_0.messages + FROM ( + -- Read Elements From Data Source 'messages_source' + SELECT + 1 AS messages + , messages_source_src_10015.ds + , DATE_TRUNC('week', messages_source_src_10015.ds) AS ds__week + , DATE_TRUNC('month', messages_source_src_10015.ds) AS ds__month + , DATE_TRUNC('quarter', messages_source_src_10015.ds) AS ds__quarter + , DATE_TRUNC('year', messages_source_src_10015.ds) AS ds__year + , messages_source_src_10015.team_id + , messages_source_src_10015.ds AS user_id__ds + , DATE_TRUNC('week', messages_source_src_10015.ds) AS user_id__ds__week + , DATE_TRUNC('month', messages_source_src_10015.ds) AS user_id__ds__month + , DATE_TRUNC('quarter', messages_source_src_10015.ds) AS user_id__ds__quarter + , DATE_TRUNC('year', messages_source_src_10015.ds) AS user_id__ds__year + , messages_source_src_10015.team_id AS user_id__team_id + , messages_source_src_10015.user_id + , messages_source_src_10015.team_id AS user_team___team_id + , messages_source_src_10015.user_id AS user_team___user_id + , messages_source_src_10015.team_id AS user_id__user_team___team_id + , messages_source_src_10015.user_id AS user_id__user_team___user_id + FROM ***************************.fct_messages messages_source_src_10015 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['user_team', 'country'] + SELECT + subq_3.user_team___team_id + , subq_3.user_team___user_id + , subq_3.country + FROM ( + -- Read Elements From Data Source 'users_source' + SELECT + users_source_src_10017.created_at AS ds + , DATE_TRUNC('week', users_source_src_10017.created_at) AS ds__week + , DATE_TRUNC('month', users_source_src_10017.created_at) AS ds__month + , DATE_TRUNC('quarter', users_source_src_10017.created_at) AS ds__quarter + , DATE_TRUNC('year', users_source_src_10017.created_at) AS ds__year + , users_source_src_10017.team_id + , users_source_src_10017.country + , users_source_src_10017.created_at AS user_id__ds + , DATE_TRUNC('week', users_source_src_10017.created_at) AS user_id__ds__week + , DATE_TRUNC('month', users_source_src_10017.created_at) AS user_id__ds__month + , DATE_TRUNC('quarter', users_source_src_10017.created_at) AS user_id__ds__quarter + , DATE_TRUNC('year', users_source_src_10017.created_at) AS user_id__ds__year + , users_source_src_10017.team_id AS user_id__team_id + , users_source_src_10017.country AS user_id__country + , users_source_src_10017.created_at AS user_composite_ident_2__ds + , DATE_TRUNC('week', users_source_src_10017.created_at) AS user_composite_ident_2__ds__week + , DATE_TRUNC('month', users_source_src_10017.created_at) AS user_composite_ident_2__ds__month + , DATE_TRUNC('quarter', users_source_src_10017.created_at) AS user_composite_ident_2__ds__quarter + , DATE_TRUNC('year', users_source_src_10017.created_at) AS user_composite_ident_2__ds__year + , users_source_src_10017.team_id AS user_composite_ident_2__team_id + , users_source_src_10017.country AS user_composite_ident_2__country + , users_source_src_10017.created_at AS user_team__ds + , DATE_TRUNC('week', users_source_src_10017.created_at) AS user_team__ds__week + , DATE_TRUNC('month', users_source_src_10017.created_at) AS user_team__ds__month + , DATE_TRUNC('quarter', users_source_src_10017.created_at) AS user_team__ds__quarter + , DATE_TRUNC('year', users_source_src_10017.created_at) AS user_team__ds__year + , users_source_src_10017.team_id AS user_team__team_id + , users_source_src_10017.country AS user_team__country + , users_source_src_10017.id AS user_id + , users_source_src_10017.ident_2 AS user_composite_ident_2___ident_2 + , users_source_src_10017.id AS user_composite_ident_2___user_id + , users_source_src_10017.team_id AS user_team___team_id + , users_source_src_10017.id AS user_team___user_id + , users_source_src_10017.ident_2 AS user_id__user_composite_ident_2___ident_2 + , users_source_src_10017.id AS user_id__user_composite_ident_2___user_id + , users_source_src_10017.team_id AS user_id__user_team___team_id + , users_source_src_10017.id AS user_id__user_team___user_id + , users_source_src_10017.id AS user_composite_ident_2__user_id + , users_source_src_10017.team_id AS user_composite_ident_2__user_team___team_id + , users_source_src_10017.id AS user_composite_ident_2__user_team___user_id + , users_source_src_10017.id AS user_team__user_id + , users_source_src_10017.ident_2 AS user_team__user_composite_ident_2___ident_2 + , users_source_src_10017.id AS user_team__user_composite_ident_2___user_id + FROM ***************************.fct_users users_source_src_10017 + ) subq_3 + ) subq_4 + ON + ( + subq_2.user_team___team_id = subq_4.user_team___team_id + ) AND ( + subq_2.user_team___user_id = subq_4.user_team___user_id + ) + ) subq_5 + ) subq_6 + GROUP BY + subq_6.user_team___team_id + , subq_6.user_team___user_id + , subq_6.user_team__country +) subq_7 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_join__plan0_optimized.sql new file mode 100644 index 0000000000..197f4ee9ff --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_join__plan0_optimized.sql @@ -0,0 +1,33 @@ +-- Join Standard Outputs +-- Pass Only Elements: +-- ['messages', 'user_team__country', 'user_team'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + subq_10.user_team___team_id AS user_team___team_id + , subq_10.user_team___user_id AS user_team___user_id + , users_source_src_10017.country AS user_team__country + , SUM(subq_10.messages) AS messages +FROM ( + -- Read Elements From Data Source 'messages_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['messages', 'user_team', 'user_team'] + SELECT + team_id AS user_team___team_id + , user_id AS user_team___user_id + , 1 AS messages + FROM ***************************.fct_messages messages_source_src_10015 +) subq_10 +LEFT OUTER JOIN + ***************************.fct_users users_source_src_10017 +ON + ( + subq_10.user_team___team_id = users_source_src_10017.team_id + ) AND ( + subq_10.user_team___user_id = users_source_src_10017.id + ) +GROUP BY + subq_10.user_team___team_id + , subq_10.user_team___user_id + , users_source_src_10017.country diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_order_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_order_by__plan0.sql new file mode 100644 index 0000000000..729cf82253 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_order_by__plan0.sql @@ -0,0 +1,81 @@ +-- Order By ['user_team'] +SELECT + subq_4.user_team___team_id + , subq_4.user_team___user_id + , subq_4.messages +FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.user_team___team_id + , subq_3.user_team___user_id + , subq_3.messages + FROM ( + -- Aggregate Measures + SELECT + subq_2.user_team___team_id + , subq_2.user_team___user_id + , SUM(subq_2.messages) AS messages + FROM ( + -- Pass Only Elements: + -- ['messages', 'user_team'] + SELECT + subq_1.user_team___team_id + , subq_1.user_team___user_id + , subq_1.messages + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.user_id__ds + , subq_0.user_id__ds__week + , subq_0.user_id__ds__month + , subq_0.user_id__ds__quarter + , subq_0.user_id__ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user_id + , subq_0.user_team___team_id + , subq_0.user_team___user_id + , subq_0.user_id__user_team___team_id + , subq_0.user_id__user_team___user_id + , subq_0.team_id + , subq_0.user_id__team_id + , subq_0.messages + FROM ( + -- Read Elements From Data Source 'messages_source' + SELECT + 1 AS messages + , messages_source_src_10015.ds + , DATE_TRUNC('week', messages_source_src_10015.ds) AS ds__week + , DATE_TRUNC('month', messages_source_src_10015.ds) AS ds__month + , DATE_TRUNC('quarter', messages_source_src_10015.ds) AS ds__quarter + , DATE_TRUNC('year', messages_source_src_10015.ds) AS ds__year + , messages_source_src_10015.team_id + , messages_source_src_10015.ds AS user_id__ds + , DATE_TRUNC('week', messages_source_src_10015.ds) AS user_id__ds__week + , DATE_TRUNC('month', messages_source_src_10015.ds) AS user_id__ds__month + , DATE_TRUNC('quarter', messages_source_src_10015.ds) AS user_id__ds__quarter + , DATE_TRUNC('year', messages_source_src_10015.ds) AS user_id__ds__year + , messages_source_src_10015.team_id AS user_id__team_id + , messages_source_src_10015.user_id + , messages_source_src_10015.team_id AS user_team___team_id + , messages_source_src_10015.user_id AS user_team___user_id + , messages_source_src_10015.team_id AS user_id__user_team___team_id + , messages_source_src_10015.user_id AS user_id__user_team___user_id + FROM ***************************.fct_messages messages_source_src_10015 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.user_team___team_id + , subq_2.user_team___user_id + ) subq_3 +) subq_4 +ORDER BY subq_4.user_team___team_id DESC, subq_4.user_team___user_id DESC diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_order_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_order_by__plan0_optimized.sql new file mode 100644 index 0000000000..0d8ba1d7e2 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_composite_identifier_with_order_by__plan0_optimized.sql @@ -0,0 +1,22 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +-- Order By ['user_team'] +SELECT + user_team___team_id + , user_team___user_id + , SUM(messages) AS messages +FROM ( + -- Read Elements From Data Source 'messages_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['messages', 'user_team'] + SELECT + team_id AS user_team___team_id + , user_id AS user_team___user_id + , 1 AS messages + FROM ***************************.fct_messages messages_source_src_10015 +) subq_7 +GROUP BY + user_team___team_id + , user_team___user_id +ORDER BY user_team___team_id DESC, user_team___user_id DESC diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node__plan0.sql new file mode 100644 index 0000000000..cd9ec64f3e --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node__plan0.sql @@ -0,0 +1,130 @@ +-- Compute Metrics via Expressions +SELECT + subq_5.listing + , subq_5.listing__country_latest + , subq_5.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_4.listing + , subq_4.listing__country_latest + , SUM(subq_4.bookings) AS bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_1.listing AS listing + , subq_3.country_latest AS listing__country_latest + , subq_1.bookings AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'listing'] + SELECT + subq_0.listing + , subq_0.bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_2.listing + , subq_2.country_latest + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_2 + ) subq_3 + ON + subq_1.listing = subq_3.listing + ) subq_4 + GROUP BY + subq_4.listing + , subq_4.listing__country_latest +) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node__plan0_optimized.sql new file mode 100644 index 0000000000..c92dc4aec4 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node__plan0_optimized.sql @@ -0,0 +1,26 @@ +-- Join Standard Outputs +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + subq_7.listing AS listing + , listings_latest_src_10004.country AS listing__country_latest + , SUM(subq_7.bookings) AS bookings +FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Pass Only Elements: + -- ['bookings', 'listing'] + SELECT + listing_id AS listing + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_7 +LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 +ON + subq_7.listing = listings_latest_src_10004.listing_id +GROUP BY + subq_7.listing + , listings_latest_src_10004.country diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_multiple_data_sources__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_multiple_data_sources__plan0.sql new file mode 100644 index 0000000000..77c7be400e --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_multiple_data_sources__plan0.sql @@ -0,0 +1,461 @@ +-- Compute Metrics via Expressions +SELECT + subq_19.ds + , subq_19.listing__country_latest + , CAST(subq_19.bookings AS DOUBLE) / CAST(NULLIF(subq_19.views, 0) AS DOUBLE) AS bookings_per_view +FROM ( + -- Pass Only Elements: + -- ['listing__country_latest', 'ds', 'bookings', 'views'] + SELECT + subq_18.ds + , subq_18.listing__country_latest + , subq_18.bookings + , subq_18.views + FROM ( + -- Join Aggregated Measures with Standard Outputs + SELECT + subq_8.ds AS ds + , subq_8.listing__country_latest AS listing__country_latest + , subq_8.bookings AS bookings + , subq_17.views AS views + FROM ( + -- Aggregate Measures + SELECT + subq_7.ds + , subq_7.listing__country_latest + , SUM(subq_7.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'listing__country_latest', 'ds'] + SELECT + subq_6.ds + , subq_6.listing__country_latest + , subq_6.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds AS ds + , subq_2.listing AS listing + , subq_5.country_latest AS listing__country_latest + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'ds', 'listing'] + SELECT + subq_1.ds + , subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_4.listing + , subq_4.country_latest + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.created_at + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.listing__ds + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__created_at + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.ds AS metric_time + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_3 + ) subq_4 + ) subq_5 + ON + subq_2.listing = subq_5.listing + ) subq_6 + ) subq_7 + GROUP BY + subq_7.ds + , subq_7.listing__country_latest + ) subq_8 + INNER JOIN ( + -- Aggregate Measures + SELECT + subq_16.ds + , subq_16.listing__country_latest + , SUM(subq_16.views) AS views + FROM ( + -- Pass Only Elements: + -- ['views', 'listing__country_latest', 'ds'] + SELECT + subq_15.ds + , subq_15.listing__country_latest + , subq_15.views + FROM ( + -- Join Standard Outputs + SELECT + subq_11.ds AS ds + , subq_11.listing AS listing + , subq_14.country_latest AS listing__country_latest + , subq_11.views AS views + FROM ( + -- Pass Only Elements: + -- ['views', 'ds', 'listing'] + SELECT + subq_10.ds + , subq_10.listing + , subq_10.views + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_9.ds + , subq_9.ds__week + , subq_9.ds__month + , subq_9.ds__quarter + , subq_9.ds__year + , subq_9.ds_partitioned + , subq_9.ds_partitioned__week + , subq_9.ds_partitioned__month + , subq_9.ds_partitioned__quarter + , subq_9.ds_partitioned__year + , subq_9.create_a_cycle_in_the_join_graph__ds + , subq_9.create_a_cycle_in_the_join_graph__ds__week + , subq_9.create_a_cycle_in_the_join_graph__ds__month + , subq_9.create_a_cycle_in_the_join_graph__ds__quarter + , subq_9.create_a_cycle_in_the_join_graph__ds__year + , subq_9.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_9.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_9.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_9.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_9.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_9.ds AS metric_time + , subq_9.ds__week AS metric_time__week + , subq_9.ds__month AS metric_time__month + , subq_9.ds__quarter AS metric_time__quarter + , subq_9.ds__year AS metric_time__year + , subq_9.listing + , subq_9.user + , subq_9.create_a_cycle_in_the_join_graph + , subq_9.create_a_cycle_in_the_join_graph__listing + , subq_9.create_a_cycle_in_the_join_graph__user + , subq_9.views + FROM ( + -- Read Elements From Data Source 'views_source' + SELECT + 1 AS views + , views_source_src_10009.ds + , DATE_TRUNC('week', views_source_src_10009.ds) AS ds__week + , DATE_TRUNC('month', views_source_src_10009.ds) AS ds__month + , DATE_TRUNC('quarter', views_source_src_10009.ds) AS ds__quarter + , DATE_TRUNC('year', views_source_src_10009.ds) AS ds__year + , views_source_src_10009.ds_partitioned + , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS ds_partitioned__year + , views_source_src_10009.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', views_source_src_10009.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', views_source_src_10009.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', views_source_src_10009.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', views_source_src_10009.ds) AS create_a_cycle_in_the_join_graph__ds__year + , views_source_src_10009.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', views_source_src_10009.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', views_source_src_10009.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', views_source_src_10009.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', views_source_src_10009.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , views_source_src_10009.listing_id AS listing + , views_source_src_10009.user_id AS user + , views_source_src_10009.user_id AS create_a_cycle_in_the_join_graph + , views_source_src_10009.listing_id AS create_a_cycle_in_the_join_graph__listing + , views_source_src_10009.user_id AS create_a_cycle_in_the_join_graph__user + FROM ( + -- User Defined SQL Query + SELECT user_id, listing_id, ds, ds_partitioned FROM ***************************.fct_views + ) views_source_src_10009 + ) subq_9 + ) subq_10 + ) subq_11 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_13.listing + , subq_13.country_latest + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_12.ds + , subq_12.ds__week + , subq_12.ds__month + , subq_12.ds__quarter + , subq_12.ds__year + , subq_12.created_at + , subq_12.created_at__week + , subq_12.created_at__month + , subq_12.created_at__quarter + , subq_12.created_at__year + , subq_12.listing__ds + , subq_12.listing__ds__week + , subq_12.listing__ds__month + , subq_12.listing__ds__quarter + , subq_12.listing__ds__year + , subq_12.listing__created_at + , subq_12.listing__created_at__week + , subq_12.listing__created_at__month + , subq_12.listing__created_at__quarter + , subq_12.listing__created_at__year + , subq_12.ds AS metric_time + , subq_12.ds__week AS metric_time__week + , subq_12.ds__month AS metric_time__month + , subq_12.ds__quarter AS metric_time__quarter + , subq_12.ds__year AS metric_time__year + , subq_12.listing + , subq_12.user + , subq_12.listing__user + , subq_12.country_latest + , subq_12.is_lux_latest + , subq_12.capacity_latest + , subq_12.listing__country_latest + , subq_12.listing__is_lux_latest + , subq_12.listing__capacity_latest + , subq_12.listings + , subq_12.largest_listing + , subq_12.smallest_listing + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_12 + ) subq_13 + ) subq_14 + ON + subq_11.listing = subq_14.listing + ) subq_15 + ) subq_16 + GROUP BY + subq_16.ds + , subq_16.listing__country_latest + ) subq_17 + ON + ( + ( + subq_8.listing__country_latest = subq_17.listing__country_latest + ) OR ( + ( + subq_8.listing__country_latest IS NULL + ) AND ( + subq_17.listing__country_latest IS NULL + ) + ) + ) AND ( + ( + subq_8.ds = subq_17.ds + ) OR ( + (subq_8.ds IS NULL) AND (subq_17.ds IS NULL) + ) + ) + ) subq_18 +) subq_19 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_multiple_data_sources__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_multiple_data_sources__plan0_optimized.sql new file mode 100644 index 0000000000..093782dc0e --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_multiple_data_sources__plan0_optimized.sql @@ -0,0 +1,88 @@ +-- Join Aggregated Measures with Standard Outputs +-- Pass Only Elements: +-- ['listing__country_latest', 'ds', 'bookings', 'views'] +-- Compute Metrics via Expressions +SELECT + subq_28.ds AS ds + , subq_28.listing__country_latest AS listing__country_latest + , CAST(subq_28.bookings AS DOUBLE) / CAST(NULLIF(subq_37.views, 0) AS DOUBLE) AS bookings_per_view +FROM ( + -- Join Standard Outputs + -- Pass Only Elements: + -- ['bookings', 'listing__country_latest', 'ds'] + -- Aggregate Measures + SELECT + subq_22.ds AS ds + , listings_latest_src_10004.country AS listing__country_latest + , SUM(subq_22.bookings) AS bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'ds', 'listing'] + SELECT + ds + , listing_id AS listing + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_22 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 + ON + subq_22.listing = listings_latest_src_10004.listing_id + GROUP BY + subq_22.ds + , listings_latest_src_10004.country +) subq_28 +INNER JOIN ( + -- Join Standard Outputs + -- Pass Only Elements: + -- ['views', 'listing__country_latest', 'ds'] + -- Aggregate Measures + SELECT + subq_31.ds AS ds + , listings_latest_src_10004.country AS listing__country_latest + , SUM(subq_31.views) AS views + FROM ( + -- Read Elements From Data Source 'views_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['views', 'ds', 'listing'] + SELECT + ds + , listing_id AS listing + , 1 AS views + FROM ( + -- User Defined SQL Query + SELECT user_id, listing_id, ds, ds_partitioned FROM ***************************.fct_views + ) views_source_src_10009 + ) subq_31 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 + ON + subq_31.listing = listings_latest_src_10004.listing_id + GROUP BY + subq_31.ds + , listings_latest_src_10004.country +) subq_37 +ON + ( + ( + subq_28.listing__country_latest = subq_37.listing__country_latest + ) OR ( + ( + subq_28.listing__country_latest IS NULL + ) AND ( + subq_37.listing__country_latest IS NULL + ) + ) + ) AND ( + ( + subq_28.ds = subq_37.ds + ) OR ( + (subq_28.ds IS NULL) AND (subq_37.ds IS NULL) + ) + ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_single_data_source__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_single_data_source__plan0.sql new file mode 100644 index 0000000000..d63c4cf75e --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_single_data_source__plan0.sql @@ -0,0 +1,133 @@ +-- Compute Metrics via Expressions +SELECT + subq_5.listing + , subq_5.listing__country_latest + , CAST(subq_5.bookings AS DOUBLE) / CAST(NULLIF(subq_5.bookers, 0) AS DOUBLE) AS bookings_per_booker +FROM ( + -- Aggregate Measures + SELECT + subq_4.listing + , subq_4.listing__country_latest + , SUM(subq_4.bookings) AS bookings + , COUNT(DISTINCT subq_4.bookers) AS bookers + FROM ( + -- Join Standard Outputs + SELECT + subq_1.listing AS listing + , subq_3.country_latest AS listing__country_latest + , subq_1.bookings AS bookings + , subq_1.bookers AS bookers + FROM ( + -- Pass Only Elements: + -- ['bookings', 'bookers', 'listing'] + SELECT + subq_0.listing + , subq_0.bookings + , subq_0.bookers + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_2.listing + , subq_2.country_latest + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_2 + ) subq_3 + ON + subq_1.listing = subq_3.listing + ) subq_4 + GROUP BY + subq_4.listing + , subq_4.listing__country_latest +) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_single_data_source__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_single_data_source__plan0_optimized.sql new file mode 100644 index 0000000000..d4ff05fa1c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_ratio_from_single_data_source__plan0_optimized.sql @@ -0,0 +1,34 @@ +-- Compute Metrics via Expressions +SELECT + listing + , listing__country_latest + , CAST(bookings AS DOUBLE) / CAST(NULLIF(bookers, 0) AS DOUBLE) AS bookings_per_booker +FROM ( + -- Join Standard Outputs + -- Aggregate Measures + SELECT + subq_7.listing AS listing + , listings_latest_src_10004.country AS listing__country_latest + , SUM(subq_7.bookings) AS bookings + , COUNT(DISTINCT subq_7.bookers) AS bookers + FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Pass Only Elements: + -- ['bookings', 'bookers', 'listing'] + SELECT + listing_id AS listing + , 1 AS bookings + , guest_id AS bookers + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_7 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 + ON + subq_7.listing = listings_latest_src_10004.listing_id + GROUP BY + subq_7.listing + , listings_latest_src_10004.country +) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_simple_expr__plan0.sql new file mode 100644 index 0000000000..ebf5465941 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_simple_expr__plan0.sql @@ -0,0 +1,130 @@ +-- Compute Metrics via Expressions +SELECT + subq_5.listing + , subq_5.listing__country_latest + , booking_value * 0.05 AS booking_fees +FROM ( + -- Aggregate Measures + SELECT + subq_4.listing + , subq_4.listing__country_latest + , SUM(subq_4.booking_value) AS booking_value + FROM ( + -- Join Standard Outputs + SELECT + subq_1.listing AS listing + , subq_3.country_latest AS listing__country_latest + , subq_1.booking_value AS booking_value + FROM ( + -- Pass Only Elements: + -- ['booking_value', 'listing'] + SELECT + subq_0.listing + , subq_0.booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_2.listing + , subq_2.country_latest + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_2 + ) subq_3 + ON + subq_1.listing = subq_3.listing + ) subq_4 + GROUP BY + subq_4.listing + , subq_4.listing__country_latest +) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_simple_expr__plan0_optimized.sql new file mode 100644 index 0000000000..cbc93f25c5 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_compute_metrics_node_simple_expr__plan0_optimized.sql @@ -0,0 +1,24 @@ +-- Compute Metrics via Expressions +SELECT + listing + , listing__country_latest + , booking_value * 0.05 AS booking_fees +FROM ( + -- Join Standard Outputs + -- Aggregate Measures + SELECT + bookings_source_src_10001.listing_id AS listing + , listings_latest_src_10004.country AS listing__country_latest + , SUM(bookings_source_src_10001.booking_value) AS booking_value + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 + ON + bookings_source_src_10001.listing_id = listings_latest_src_10004.listing_id + GROUP BY + bookings_source_src_10001.listing_id + , listings_latest_src_10004.country +) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_constrain_time_range_node__plan0.sql new file mode 100644 index 0000000000..94ddca2626 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_constrain_time_range_node__plan0.sql @@ -0,0 +1,75 @@ +-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] +SELECT + subq_2.ds + , subq_2.metric_time + , subq_2.bookings +FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_1.ds + , subq_1.ds AS metric_time + , subq_1.bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'ds'] + SELECT + subq_0.ds + , subq_0.bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 +) subq_2 +WHERE subq_2.metric_time BETWEEN CAST('2020-01-01' AS TIMESTAMP) AND CAST('2020-01-02' AS TIMESTAMP) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_constrain_time_range_node__plan0_optimized.sql new file mode 100644 index 0000000000..80cc60cc5c --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_constrain_time_range_node__plan0_optimized.sql @@ -0,0 +1,14 @@ +-- Read Elements From Data Source 'bookings_source' +-- Pass Only Elements: +-- ['bookings', 'ds'] +-- Metric Time Dimension 'ds' +-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-02T00:00:00] +SELECT + ds + , ds AS metric_time + , 1 AS bookings +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings +) bookings_source_src_10001 +WHERE ds BETWEEN CAST('2020-01-01' AS TIMESTAMP) AND CAST('2020-01-02' AS TIMESTAMP) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric__plan0.sql new file mode 100644 index 0000000000..c9adb7c74a --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric__plan0.sql @@ -0,0 +1,50 @@ +-- Compute Metrics via Expressions +SELECT + subq_4.ds__month + , subq_4.txn_revenue AS trailing_2_months_revenue +FROM ( + -- Aggregate Measures + SELECT + subq_3.ds__month + , SUM(subq_3.txn_revenue) AS txn_revenue + FROM ( + -- Pass Only Elements: + -- ['txn_revenue', 'ds__month'] + SELECT + subq_1.ds__month + , subq_1.txn_revenue + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user + , subq_0.txn_revenue + FROM ( + -- Read Elements From Data Source 'revenue' + SELECT + revenue_src_10006.revenue AS txn_revenue + , revenue_src_10006.created_at AS ds + , DATE_TRUNC('week', revenue_src_10006.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , revenue_src_10006.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue + ) revenue_src_10006 + ) subq_0 + ) subq_1 + ) subq_3 + GROUP BY + subq_3.ds__month +) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric__plan0_optimized.sql new file mode 100644 index 0000000000..6ce7eb9f16 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric__plan0_optimized.sql @@ -0,0 +1,15 @@ +-- Read Elements From Data Source 'revenue' +-- Metric Time Dimension 'ds' +-- Pass Only Elements: +-- ['txn_revenue', 'ds__month'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + DATE_TRUNC('month', created_at) AS ds__month + , SUM(revenue) AS trailing_2_months_revenue +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue +) revenue_src_10006 +GROUP BY + DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_grain_to_date__plan0.sql new file mode 100644 index 0000000000..9c5aac9f71 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_grain_to_date__plan0.sql @@ -0,0 +1,50 @@ +-- Compute Metrics via Expressions +SELECT + subq_4.ds__month + , subq_4.txn_revenue AS revenue_mtd +FROM ( + -- Aggregate Measures + SELECT + subq_3.ds__month + , SUM(subq_3.txn_revenue) AS txn_revenue + FROM ( + -- Pass Only Elements: + -- ['txn_revenue', 'ds__month'] + SELECT + subq_1.ds__month + , subq_1.txn_revenue + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user + , subq_0.txn_revenue + FROM ( + -- Read Elements From Data Source 'revenue' + SELECT + revenue_src_10006.revenue AS txn_revenue + , revenue_src_10006.created_at AS ds + , DATE_TRUNC('week', revenue_src_10006.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , revenue_src_10006.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue + ) revenue_src_10006 + ) subq_0 + ) subq_1 + ) subq_3 + GROUP BY + subq_3.ds__month +) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_grain_to_date__plan0_optimized.sql new file mode 100644 index 0000000000..70a814685d --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_grain_to_date__plan0_optimized.sql @@ -0,0 +1,15 @@ +-- Read Elements From Data Source 'revenue' +-- Metric Time Dimension 'ds' +-- Pass Only Elements: +-- ['txn_revenue', 'ds__month'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + DATE_TRUNC('month', created_at) AS ds__month + , SUM(revenue) AS revenue_mtd +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue +) revenue_src_10006 +GROUP BY + DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_ds__plan0.sql new file mode 100644 index 0000000000..8a8b927c31 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_ds__plan0.sql @@ -0,0 +1,45 @@ +-- Compute Metrics via Expressions +SELECT + subq_4.txn_revenue AS trailing_2_months_revenue +FROM ( + -- Aggregate Measures + SELECT + SUM(subq_3.txn_revenue) AS txn_revenue + FROM ( + -- Pass Only Elements: + -- ['txn_revenue'] + SELECT + subq_1.txn_revenue + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user + , subq_0.txn_revenue + FROM ( + -- Read Elements From Data Source 'revenue' + SELECT + revenue_src_10006.revenue AS txn_revenue + , revenue_src_10006.created_at AS ds + , DATE_TRUNC('week', revenue_src_10006.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , revenue_src_10006.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue + ) revenue_src_10006 + ) subq_0 + ) subq_1 + ) subq_3 +) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_ds__plan0_optimized.sql new file mode 100644 index 0000000000..a852f552b0 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_ds__plan0_optimized.sql @@ -0,0 +1,12 @@ +-- Read Elements From Data Source 'revenue' +-- Metric Time Dimension 'ds' +-- Pass Only Elements: +-- ['txn_revenue'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + SUM(revenue) AS trailing_2_months_revenue +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue +) revenue_src_10006 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window__plan0.sql new file mode 100644 index 0000000000..e460bce945 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window__plan0.sql @@ -0,0 +1,50 @@ +-- Compute Metrics via Expressions +SELECT + subq_4.ds__month + , subq_4.txn_revenue AS revenue_all_time +FROM ( + -- Aggregate Measures + SELECT + subq_3.ds__month + , SUM(subq_3.txn_revenue) AS txn_revenue + FROM ( + -- Pass Only Elements: + -- ['txn_revenue', 'ds__month'] + SELECT + subq_1.ds__month + , subq_1.txn_revenue + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user + , subq_0.txn_revenue + FROM ( + -- Read Elements From Data Source 'revenue' + SELECT + revenue_src_10006.revenue AS txn_revenue + , revenue_src_10006.created_at AS ds + , DATE_TRUNC('week', revenue_src_10006.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , revenue_src_10006.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue + ) revenue_src_10006 + ) subq_0 + ) subq_1 + ) subq_3 + GROUP BY + subq_3.ds__month +) subq_4 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window__plan0_optimized.sql new file mode 100644 index 0000000000..870ee251a6 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window__plan0_optimized.sql @@ -0,0 +1,15 @@ +-- Read Elements From Data Source 'revenue' +-- Metric Time Dimension 'ds' +-- Pass Only Elements: +-- ['txn_revenue', 'ds__month'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + DATE_TRUNC('month', created_at) AS ds__month + , SUM(revenue) AS revenue_all_time +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue +) revenue_src_10006 +GROUP BY + DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window_with_time_constraint__plan0.sql new file mode 100644 index 0000000000..72136f3a44 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window_with_time_constraint__plan0.sql @@ -0,0 +1,67 @@ +-- Compute Metrics via Expressions +SELECT + subq_5.ds__month + , subq_5.txn_revenue AS revenue_all_time +FROM ( + -- Aggregate Measures + SELECT + subq_4.ds__month + , SUM(subq_4.txn_revenue) AS txn_revenue + FROM ( + -- Pass Only Elements: + -- ['txn_revenue', 'ds__month'] + SELECT + subq_2.ds__month + , subq_2.txn_revenue + FROM ( + -- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00] + SELECT + subq_1.ds + , subq_1.ds__week + , subq_1.ds__month + , subq_1.ds__quarter + , subq_1.ds__year + , subq_1.metric_time + , subq_1.metric_time__week + , subq_1.metric_time__month + , subq_1.metric_time__quarter + , subq_1.metric_time__year + , subq_1.user + , subq_1.txn_revenue + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user + , subq_0.txn_revenue + FROM ( + -- Read Elements From Data Source 'revenue' + SELECT + revenue_src_10006.revenue AS txn_revenue + , revenue_src_10006.created_at AS ds + , DATE_TRUNC('week', revenue_src_10006.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , revenue_src_10006.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue + ) revenue_src_10006 + ) subq_0 + ) subq_1 + WHERE subq_1.metric_time BETWEEN CAST('2000-01-01' AS TIMESTAMP) AND CAST('2020-01-01' AS TIMESTAMP) + ) subq_2 + ) subq_4 + GROUP BY + subq_4.ds__month +) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql new file mode 100644 index 0000000000..53bd8842bd --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Read Elements From Data Source 'revenue' +-- Metric Time Dimension 'ds' +-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00] +-- Pass Only Elements: +-- ['txn_revenue', 'ds__month'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + DATE_TRUNC('month', created_at) AS ds__month + , SUM(revenue) AS revenue_all_time +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue +) revenue_src_10006 +WHERE created_at BETWEEN CAST('2000-01-01' AS TIMESTAMP) AND CAST('2020-01-01' AS TIMESTAMP) +GROUP BY + DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_with_time_constraint__plan0.sql new file mode 100644 index 0000000000..fa6672724b --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_with_time_constraint__plan0.sql @@ -0,0 +1,67 @@ +-- Compute Metrics via Expressions +SELECT + subq_5.ds__month + , subq_5.txn_revenue AS trailing_2_months_revenue +FROM ( + -- Aggregate Measures + SELECT + subq_4.ds__month + , SUM(subq_4.txn_revenue) AS txn_revenue + FROM ( + -- Pass Only Elements: + -- ['txn_revenue', 'ds__month'] + SELECT + subq_2.ds__month + , subq_2.txn_revenue + FROM ( + -- Constrain Time Range to [2019-12-01T00:00:00, 2020-01-01T00:00:00] + SELECT + subq_1.ds + , subq_1.ds__week + , subq_1.ds__month + , subq_1.ds__quarter + , subq_1.ds__year + , subq_1.metric_time + , subq_1.metric_time__week + , subq_1.metric_time__month + , subq_1.metric_time__quarter + , subq_1.metric_time__year + , subq_1.user + , subq_1.txn_revenue + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.user + , subq_0.txn_revenue + FROM ( + -- Read Elements From Data Source 'revenue' + SELECT + revenue_src_10006.revenue AS txn_revenue + , revenue_src_10006.created_at AS ds + , DATE_TRUNC('week', revenue_src_10006.created_at) AS ds__week + , DATE_TRUNC('month', revenue_src_10006.created_at) AS ds__month + , DATE_TRUNC('quarter', revenue_src_10006.created_at) AS ds__quarter + , DATE_TRUNC('year', revenue_src_10006.created_at) AS ds__year + , revenue_src_10006.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue + ) revenue_src_10006 + ) subq_0 + ) subq_1 + WHERE subq_1.metric_time BETWEEN CAST('2019-12-01' AS TIMESTAMP) AND CAST('2020-01-01' AS TIMESTAMP) + ) subq_2 + ) subq_4 + GROUP BY + subq_4.ds__month +) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_with_time_constraint__plan0_optimized.sql new file mode 100644 index 0000000000..5e6e5237f3 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_cumulative_metric_with_time_constraint__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Read Elements From Data Source 'revenue' +-- Metric Time Dimension 'ds' +-- Constrain Time Range to [2019-12-01T00:00:00, 2020-01-01T00:00:00] +-- Pass Only Elements: +-- ['txn_revenue', 'ds__month'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + DATE_TRUNC('month', created_at) AS ds__month + , SUM(revenue) AS trailing_2_months_revenue +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_revenue +) revenue_src_10006 +WHERE created_at BETWEEN CAST('2019-12-01' AS TIMESTAMP) AND CAST('2020-01-01' AS TIMESTAMP) +GROUP BY + DATE_TRUNC('month', created_at) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_distinct_values__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_distinct_values__plan0.sql new file mode 100644 index 0000000000..be05b9afec --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_distinct_values__plan0.sql @@ -0,0 +1,243 @@ +-- Order By ['listing__country_latest'] Limit 100 +SELECT + subq_10.listing__country_latest +FROM ( + -- Pass Only Elements: + -- ['listing__country_latest'] + SELECT + subq_9.listing__country_latest + FROM ( + -- Compute Metrics via Expressions + SELECT + subq_8.listing__country_latest + , subq_8.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_7.listing__country_latest + , SUM(subq_7.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'listing__country_latest'] + SELECT + subq_6.listing__country_latest + , subq_6.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.listing AS listing + , subq_5.country_latest AS listing__country_latest + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'listing'] + SELECT + subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_4.listing + , subq_4.country_latest + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.created_at + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.listing__ds + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__created_at + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.ds AS metric_time + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_3 + ) subq_4 + ) subq_5 + ON + subq_2.listing = subq_5.listing + ) subq_6 + ) subq_7 + GROUP BY + subq_7.listing__country_latest + ) subq_8 + ) subq_9 +) subq_10 +ORDER BY subq_10.listing__country_latest +LIMIT 100 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_distinct_values__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_distinct_values__plan0_optimized.sql new file mode 100644 index 0000000000..c479c10486 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_distinct_values__plan0_optimized.sql @@ -0,0 +1,22 @@ +-- Join Standard Outputs +-- Pass Only Elements: +-- ['bookings', 'listing__country_latest'] +-- Aggregate Measures +-- Compute Metrics via Expressions +-- Pass Only Elements: +-- ['listing__country_latest'] +-- Order By ['listing__country_latest'] Limit 100 +SELECT + listings_latest_src_10004.country AS listing__country_latest +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings +) bookings_source_src_10001 +LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 +ON + bookings_source_src_10001.listing_id = listings_latest_src_10004.listing_id +GROUP BY + listings_latest_src_10004.country +ORDER BY listing__country_latest +LIMIT 100 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_node__plan0.sql new file mode 100644 index 0000000000..ee74556387 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_node__plan0.sql @@ -0,0 +1,59 @@ +-- Pass Only Elements: +-- ['bookings'] +SELECT + subq_0.bookings +FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_0 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_node__plan0_optimized.sql new file mode 100644 index 0000000000..340ef5e161 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_node__plan0_optimized.sql @@ -0,0 +1,9 @@ +-- Read Elements From Data Source 'bookings_source' +-- Pass Only Elements: +-- ['bookings'] +SELECT + 1 AS bookings +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings +) bookings_source_src_10001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_node__plan0.sql new file mode 100644 index 0000000000..1673b06f8d --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_node__plan0.sql @@ -0,0 +1,67 @@ +-- Constrain Output with WHERE +SELECT + subq_1.ds + , subq_1.bookings +FROM ( + -- Pass Only Elements: + -- ['bookings', 'ds'] + SELECT + subq_0.ds + , subq_0.bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 +) subq_1 +WHERE ds = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_node__plan0_optimized.sql new file mode 100644 index 0000000000..f1f2692862 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_node__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Constrain Output with WHERE +SELECT + ds + , bookings +FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Pass Only Elements: + -- ['bookings', 'ds'] + SELECT + ds + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_3 +WHERE ds = '2020-01-01' diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_on_join_dim__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_on_join_dim__plan0.sql new file mode 100644 index 0000000000..c48ffd8d0a --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -0,0 +1,248 @@ +-- Compute Metrics via Expressions +SELECT + subq_10.is_instant + , subq_10.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_9.is_instant + , SUM(subq_9.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'is_instant'] + SELECT + subq_8.is_instant + , subq_8.bookings + FROM ( + -- Constrain Output with WHERE + SELECT + subq_7.is_instant + , subq_7.listing__country_latest + , subq_7.bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'is_instant', 'listing__country_latest'] + SELECT + subq_6.is_instant + , subq_6.listing__country_latest + , subq_6.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.listing AS listing + , subq_2.is_instant AS is_instant + , subq_5.country_latest AS listing__country_latest + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'is_instant', 'listing'] + SELECT + subq_1.listing + , subq_1.is_instant + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_4.listing + , subq_4.country_latest + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.created_at + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.listing__ds + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__created_at + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.ds AS metric_time + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_3 + ) subq_4 + ) subq_5 + ON + subq_2.listing = subq_5.listing + ) subq_6 + ) subq_7 + WHERE listing__country_latest = 'us' + ) subq_8 + ) subq_9 + GROUP BY + subq_9.is_instant +) subq_10 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql new file mode 100644 index 0000000000..c5a1407424 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_filter_with_where_constraint_on_join_dim__plan0_optimized.sql @@ -0,0 +1,38 @@ +-- Constrain Output with WHERE +-- Pass Only Elements: +-- ['bookings', 'is_instant'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + is_instant + , SUM(bookings) AS bookings +FROM ( + -- Join Standard Outputs + -- Pass Only Elements: + -- ['bookings', 'is_instant', 'listing__country_latest'] + SELECT + subq_13.is_instant AS is_instant + , listings_latest_src_10004.country AS listing__country_latest + , subq_13.bookings AS bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'is_instant', 'listing'] + SELECT + listing_id AS listing + , is_instant + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_13 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 + ON + subq_13.listing = listings_latest_src_10004.listing_id +) subq_18 +WHERE listing__country_latest = 'us' +GROUP BY + is_instant diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_limit_rows__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_limit_rows__plan0.sql new file mode 100644 index 0000000000..47e67e15e4 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_limit_rows__plan0.sql @@ -0,0 +1,136 @@ +-- Order By [] Limit 1 +SELECT + subq_4.ds + , subq_4.bookings +FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.ds + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.ds + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'ds'] + SELECT + subq_1.ds + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.ds + ) subq_3 +) subq_4 +LIMIT 1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_limit_rows__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_limit_rows__plan0_optimized.sql new file mode 100644 index 0000000000..0ad159d226 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_limit_rows__plan0_optimized.sql @@ -0,0 +1,22 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +-- Order By [] Limit 1 +SELECT + ds + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'ds'] + SELECT + ds + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_7 +GROUP BY + ds +LIMIT 1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_local_dimension_using_local_identifier__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_local_dimension_using_local_identifier__plan0.sql new file mode 100644 index 0000000000..2e7ec02d12 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_local_dimension_using_local_identifier__plan0.sql @@ -0,0 +1,97 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.listing__country_latest + , subq_3.listings +FROM ( + -- Aggregate Measures + SELECT + subq_2.listing__country_latest + , SUM(subq_2.listings) AS listings + FROM ( + -- Pass Only Elements: + -- ['listings', 'listing__country_latest'] + SELECT + subq_1.listing__country_latest + , subq_1.listings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.created_at + , subq_0.created_at__week + , subq_0.created_at__month + , subq_0.created_at__quarter + , subq_0.created_at__year + , subq_0.listing__ds + , subq_0.listing__ds__week + , subq_0.listing__ds__month + , subq_0.listing__ds__quarter + , subq_0.listing__ds__year + , subq_0.listing__created_at + , subq_0.listing__created_at__week + , subq_0.listing__created_at__month + , subq_0.listing__created_at__quarter + , subq_0.listing__created_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.user + , subq_0.listing__user + , subq_0.country_latest + , subq_0.is_lux_latest + , subq_0.capacity_latest + , subq_0.listing__country_latest + , subq_0.listing__is_lux_latest + , subq_0.listing__capacity_latest + , subq_0.listings + , subq_0.largest_listing + , subq_0.smallest_listing + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.listing__country_latest +) subq_3 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_local_dimension_using_local_identifier__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_local_dimension_using_local_identifier__plan0_optimized.sql new file mode 100644 index 0000000000..3c0f240434 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_local_dimension_using_local_identifier__plan0_optimized.sql @@ -0,0 +1,17 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + listing__country_latest + , SUM(listings) AS listings +FROM ( + -- Read Elements From Data Source 'listings_latest' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['listings', 'listing__country_latest'] + SELECT + country AS listing__country_latest + , 1 AS listings + FROM ***************************.dim_listings_latest listings_latest_src_10004 +) subq_6 +GROUP BY + listing__country_latest diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_aggregation_node__plan0.sql new file mode 100644 index 0000000000..e498b8c0ad --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_aggregation_node__plan0.sql @@ -0,0 +1,70 @@ +-- Aggregate Measures +SELECT + SUM(subq_1.bookings) AS bookings + , SUM(subq_1.instant_bookings) AS instant_bookings + , COUNT(DISTINCT subq_1.bookers) AS bookers + , AVG(subq_1.average_booking_value) AS average_booking_value +FROM ( + -- Pass Only Elements: + -- ['bookings', 'instant_bookings', 'average_booking_value', 'bookers'] + SELECT + subq_0.bookings + , subq_0.instant_bookings + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 +) subq_1 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_aggregation_node__plan0_optimized.sql new file mode 100644 index 0000000000..6baaa783f7 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_aggregation_node__plan0_optimized.sql @@ -0,0 +1,13 @@ +-- Read Elements From Data Source 'bookings_source' +-- Pass Only Elements: +-- ['bookings', 'instant_bookings', 'average_booking_value', 'bookers'] +-- Aggregate Measures +SELECT + SUM(1) AS bookings + , SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings + , COUNT(DISTINCT guest_id) AS bookers + , AVG(booking_value) AS average_booking_value +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings +) bookings_source_src_10001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint__plan0.sql new file mode 100644 index 0000000000..211a6caf86 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint__plan0.sql @@ -0,0 +1,404 @@ +-- Compute Metrics via Expressions +SELECT + subq_16.metric_time + , average_booking_value * bookings / NULLIF(booking_value, 0) AS lux_booking_value_rate_expr +FROM ( + -- Pass Only Elements: + -- ['metric_time', 'average_booking_value', 'bookings', 'booking_value'] + SELECT + subq_15.metric_time + , subq_15.bookings + , subq_15.average_booking_value + , subq_15.booking_value + FROM ( + -- Join Aggregated Measures with Standard Outputs + SELECT + subq_10.metric_time AS metric_time + , subq_10.bookings AS bookings + , subq_10.average_booking_value AS average_booking_value + , subq_14.booking_value AS booking_value + FROM ( + -- Aggregate Measures + SELECT + subq_9.metric_time + , SUM(subq_9.bookings) AS bookings + , AVG(subq_9.average_booking_value) AS average_booking_value + FROM ( + -- Pass Only Elements: + -- ['average_booking_value', 'bookings', 'metric_time'] + SELECT + subq_8.metric_time + , subq_8.bookings + , subq_8.average_booking_value + FROM ( + -- Constrain Output with WHERE + SELECT + subq_7.metric_time + , subq_7.listing__is_lux_latest + , subq_7.bookings + , subq_7.average_booking_value + FROM ( + -- Pass Only Elements: + -- ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'metric_time'] + SELECT + subq_6.metric_time + , subq_6.listing__is_lux_latest + , subq_6.bookings + , subq_6.average_booking_value + FROM ( + -- Join Standard Outputs + SELECT + subq_2.metric_time AS metric_time + , subq_2.listing AS listing + , subq_5.is_lux_latest AS listing__is_lux_latest + , subq_2.bookings AS bookings + , subq_2.average_booking_value AS average_booking_value + FROM ( + -- Pass Only Elements: + -- ['average_booking_value', 'bookings', 'metric_time', 'listing'] + SELECT + subq_1.metric_time + , subq_1.listing + , subq_1.bookings + , subq_1.average_booking_value + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'is_lux_latest'] + SELECT + subq_4.listing + , subq_4.is_lux_latest + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.created_at + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.listing__ds + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__created_at + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.ds AS metric_time + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_3 + ) subq_4 + ) subq_5 + ON + subq_2.listing = subq_5.listing + ) subq_6 + ) subq_7 + WHERE listing__is_lux_latest + ) subq_8 + ) subq_9 + GROUP BY + subq_9.metric_time + ) subq_10 + INNER JOIN ( + -- Aggregate Measures + SELECT + subq_13.metric_time + , SUM(subq_13.booking_value) AS booking_value + FROM ( + -- Pass Only Elements: + -- ['booking_value', 'metric_time'] + SELECT + subq_12.metric_time + , subq_12.booking_value + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_11.ds + , subq_11.ds__week + , subq_11.ds__month + , subq_11.ds__quarter + , subq_11.ds__year + , subq_11.ds_partitioned + , subq_11.ds_partitioned__week + , subq_11.ds_partitioned__month + , subq_11.ds_partitioned__quarter + , subq_11.ds_partitioned__year + , subq_11.booking_paid_at + , subq_11.booking_paid_at__week + , subq_11.booking_paid_at__month + , subq_11.booking_paid_at__quarter + , subq_11.booking_paid_at__year + , subq_11.create_a_cycle_in_the_join_graph__ds + , subq_11.create_a_cycle_in_the_join_graph__ds__week + , subq_11.create_a_cycle_in_the_join_graph__ds__month + , subq_11.create_a_cycle_in_the_join_graph__ds__quarter + , subq_11.create_a_cycle_in_the_join_graph__ds__year + , subq_11.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_11.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_11.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_11.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_11.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_11.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_11.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_11.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_11.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_11.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_11.ds AS metric_time + , subq_11.ds__week AS metric_time__week + , subq_11.ds__month AS metric_time__month + , subq_11.ds__quarter AS metric_time__quarter + , subq_11.ds__year AS metric_time__year + , subq_11.listing + , subq_11.guest + , subq_11.host + , subq_11.create_a_cycle_in_the_join_graph + , subq_11.create_a_cycle_in_the_join_graph__listing + , subq_11.create_a_cycle_in_the_join_graph__guest + , subq_11.create_a_cycle_in_the_join_graph__host + , subq_11.is_instant + , subq_11.create_a_cycle_in_the_join_graph__is_instant + , subq_11.bookings + , subq_11.instant_bookings + , subq_11.booking_value + , subq_11.max_booking_value + , subq_11.min_booking_value + , subq_11.bookers + , subq_11.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_11 + ) subq_12 + ) subq_13 + GROUP BY + subq_13.metric_time + ) subq_14 + ON + ( + ( + subq_10.metric_time = subq_14.metric_time + ) OR ( + (subq_10.metric_time IS NULL) AND (subq_14.metric_time IS NULL) + ) + ) + ) subq_15 +) subq_16 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint__plan0_optimized.sql new file mode 100644 index 0000000000..a31bc07141 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint__plan0_optimized.sql @@ -0,0 +1,80 @@ +-- Compute Metrics via Expressions +SELECT + metric_time + , average_booking_value * bookings / NULLIF(booking_value, 0) AS lux_booking_value_rate_expr +FROM ( + -- Join Aggregated Measures with Standard Outputs + -- Pass Only Elements: + -- ['metric_time', 'average_booking_value', 'bookings', 'booking_value'] + SELECT + subq_27.metric_time AS metric_time + , subq_27.bookings AS bookings + , subq_27.average_booking_value AS average_booking_value + , subq_31.booking_value AS booking_value + FROM ( + -- Constrain Output with WHERE + -- Pass Only Elements: + -- ['average_booking_value', 'bookings', 'metric_time'] + -- Aggregate Measures + SELECT + metric_time + , SUM(bookings) AS bookings + , AVG(average_booking_value) AS average_booking_value + FROM ( + -- Join Standard Outputs + -- Pass Only Elements: + -- ['average_booking_value', 'bookings', 'listing__is_lux_latest', 'metric_time'] + SELECT + subq_19.metric_time AS metric_time + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , subq_19.bookings AS bookings + , subq_19.average_booking_value AS average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['average_booking_value', 'bookings', 'metric_time', 'listing'] + SELECT + ds AS metric_time + , listing_id AS listing + , 1 AS bookings + , booking_value AS average_booking_value + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_19 + LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 + ON + subq_19.listing = listings_latest_src_10004.listing_id + ) subq_24 + WHERE listing__is_lux_latest + GROUP BY + metric_time + ) subq_27 + INNER JOIN ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['booking_value', 'metric_time'] + -- Aggregate Measures + SELECT + ds AS metric_time + , SUM(booking_value) AS booking_value + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + GROUP BY + ds + ) subq_31 + ON + ( + ( + subq_27.metric_time = subq_31.metric_time + ) OR ( + (subq_27.metric_time IS NULL) AND (subq_31.metric_time IS NULL) + ) + ) +) subq_33 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_reused_measure__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_reused_measure__plan0.sql new file mode 100644 index 0000000000..a6e16eb660 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_reused_measure__plan0.sql @@ -0,0 +1,293 @@ +-- Compute Metrics via Expressions +SELECT + subq_11.metric_time + , CAST(subq_11.booking_value_with_is_instant_constraint AS DOUBLE) / CAST(NULLIF(subq_11.booking_value, 0) AS DOUBLE) AS instant_booking_value_ratio +FROM ( + -- Pass Only Elements: + -- ['metric_time', 'booking_value_with_is_instant_constraint', 'booking_value'] + SELECT + subq_10.metric_time + , subq_10.booking_value_with_is_instant_constraint + , subq_10.booking_value + FROM ( + -- Join Aggregated Measures with Standard Outputs + SELECT + subq_5.metric_time AS metric_time + , subq_5.booking_value_with_is_instant_constraint AS booking_value_with_is_instant_constraint + , subq_9.booking_value AS booking_value + FROM ( + -- Aggregate Measures + SELECT + subq_4.metric_time + , SUM(subq_4.booking_value) AS booking_value_with_is_instant_constraint + FROM ( + -- Pass Only Elements: + -- ['booking_value', 'metric_time'] + SELECT + subq_3.metric_time + , subq_3.booking_value + FROM ( + -- Constrain Output with WHERE + SELECT + subq_2.metric_time + , subq_2.is_instant + , subq_2.booking_value + FROM ( + -- Pass Only Elements: + -- ['booking_value', 'is_instant', 'metric_time'] + SELECT + subq_1.metric_time + , subq_1.is_instant + , subq_1.booking_value + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + WHERE is_instant + ) subq_3 + ) subq_4 + GROUP BY + subq_4.metric_time + ) subq_5 + INNER JOIN ( + -- Aggregate Measures + SELECT + subq_8.metric_time + , SUM(subq_8.booking_value) AS booking_value + FROM ( + -- Pass Only Elements: + -- ['booking_value', 'metric_time'] + SELECT + subq_7.metric_time + , subq_7.booking_value + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_6.ds + , subq_6.ds__week + , subq_6.ds__month + , subq_6.ds__quarter + , subq_6.ds__year + , subq_6.ds_partitioned + , subq_6.ds_partitioned__week + , subq_6.ds_partitioned__month + , subq_6.ds_partitioned__quarter + , subq_6.ds_partitioned__year + , subq_6.booking_paid_at + , subq_6.booking_paid_at__week + , subq_6.booking_paid_at__month + , subq_6.booking_paid_at__quarter + , subq_6.booking_paid_at__year + , subq_6.create_a_cycle_in_the_join_graph__ds + , subq_6.create_a_cycle_in_the_join_graph__ds__week + , subq_6.create_a_cycle_in_the_join_graph__ds__month + , subq_6.create_a_cycle_in_the_join_graph__ds__quarter + , subq_6.create_a_cycle_in_the_join_graph__ds__year + , subq_6.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_6.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_6.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_6.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_6.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_6.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_6.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_6.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_6.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_6.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_6.ds AS metric_time + , subq_6.ds__week AS metric_time__week + , subq_6.ds__month AS metric_time__month + , subq_6.ds__quarter AS metric_time__quarter + , subq_6.ds__year AS metric_time__year + , subq_6.listing + , subq_6.guest + , subq_6.host + , subq_6.create_a_cycle_in_the_join_graph + , subq_6.create_a_cycle_in_the_join_graph__listing + , subq_6.create_a_cycle_in_the_join_graph__guest + , subq_6.create_a_cycle_in_the_join_graph__host + , subq_6.is_instant + , subq_6.create_a_cycle_in_the_join_graph__is_instant + , subq_6.bookings + , subq_6.instant_bookings + , subq_6.booking_value + , subq_6.max_booking_value + , subq_6.min_booking_value + , subq_6.bookers + , subq_6.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_6 + ) subq_7 + ) subq_8 + GROUP BY + subq_8.metric_time + ) subq_9 + ON + ( + ( + subq_5.metric_time = subq_9.metric_time + ) OR ( + (subq_5.metric_time IS NULL) AND (subq_9.metric_time IS NULL) + ) + ) + ) subq_10 +) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_reused_measure__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_reused_measure__plan0_optimized.sql new file mode 100644 index 0000000000..5bc37af0ef --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_reused_measure__plan0_optimized.sql @@ -0,0 +1,57 @@ +-- Join Aggregated Measures with Standard Outputs +-- Pass Only Elements: +-- ['metric_time', 'booking_value_with_is_instant_constraint', 'booking_value'] +-- Compute Metrics via Expressions +SELECT + subq_17.metric_time AS metric_time + , CAST(subq_17.booking_value_with_is_instant_constraint AS DOUBLE) / CAST(NULLIF(subq_21.booking_value, 0) AS DOUBLE) AS instant_booking_value_ratio +FROM ( + -- Constrain Output with WHERE + -- Pass Only Elements: + -- ['booking_value', 'metric_time'] + -- Aggregate Measures + SELECT + metric_time + , SUM(booking_value) AS booking_value_with_is_instant_constraint + FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['booking_value', 'is_instant', 'metric_time'] + SELECT + ds AS metric_time + , is_instant + , booking_value + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_14 + WHERE is_instant + GROUP BY + metric_time +) subq_17 +INNER JOIN ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['booking_value', 'metric_time'] + -- Aggregate Measures + SELECT + ds AS metric_time + , SUM(booking_value) AS booking_value + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + GROUP BY + ds +) subq_21 +ON + ( + ( + subq_17.metric_time = subq_21.metric_time + ) OR ( + (subq_17.metric_time IS NULL) AND (subq_21.metric_time IS NULL) + ) + ) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_single_expr_and_alias__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_single_expr_and_alias__plan0.sql new file mode 100644 index 0000000000..b261397d01 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_single_expr_and_alias__plan0.sql @@ -0,0 +1,145 @@ +-- Compute Metrics via Expressions +SELECT + subq_5.metric_time + , delayed_bookings * 2 AS double_counted_delayed_bookings +FROM ( + -- Aggregate Measures + SELECT + subq_4.metric_time + , SUM(subq_4.bookings) AS delayed_bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time'] + SELECT + subq_3.metric_time + , subq_3.bookings + FROM ( + -- Constrain Output with WHERE + SELECT + subq_2.metric_time + , subq_2.is_instant + , subq_2.bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'is_instant', 'metric_time'] + SELECT + subq_1.metric_time + , subq_1.is_instant + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + WHERE NOT is_instant + ) subq_3 + ) subq_4 + GROUP BY + subq_4.metric_time +) subq_5 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql new file mode 100644 index 0000000000..9a370ec428 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_measure_constraint_with_single_expr_and_alias__plan0_optimized.sql @@ -0,0 +1,30 @@ +-- Compute Metrics via Expressions +SELECT + metric_time + , delayed_bookings * 2 AS double_counted_delayed_bookings +FROM ( + -- Constrain Output with WHERE + -- Pass Only Elements: + -- ['bookings', 'metric_time'] + -- Aggregate Measures + SELECT + metric_time + , SUM(bookings) AS delayed_bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'is_instant', 'metric_time'] + SELECT + ds AS metric_time + , is_instant + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_8 + WHERE NOT is_instant + GROUP BY + metric_time +) subq_11 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multi_join_node__plan0.sql new file mode 100644 index 0000000000..91b07d26d7 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multi_join_node__plan0.sql @@ -0,0 +1,160 @@ +-- Join Standard Outputs +SELECT + subq_1.listing AS listing + , subq_3.country_latest AS listing__country_latest + , subq_5.country_latest AS listing__country_latest + , subq_1.bookings AS bookings +FROM ( + -- Pass Only Elements: + -- ['bookings', 'listing'] + SELECT + subq_0.listing + , subq_0.bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 +) subq_1 +LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_2.listing + , subq_2.country_latest + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_2 +) subq_3 +ON + subq_1.listing = subq_3.listing +LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_4.listing + , subq_4.country_latest + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_4 +) subq_5 +ON + subq_1.listing = subq_5.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multi_join_node__plan0_optimized.sql new file mode 100644 index 0000000000..b9a2048915 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multi_join_node__plan0_optimized.sql @@ -0,0 +1,40 @@ +-- Join Standard Outputs +SELECT + subq_7.listing AS listing + , subq_9.country_latest AS listing__country_latest + , subq_11.country_latest AS listing__country_latest + , subq_7.bookings AS bookings +FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Pass Only Elements: + -- ['bookings', 'listing'] + SELECT + listing_id AS listing + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_7 +LEFT OUTER JOIN ( + -- Read Elements From Data Source 'listings_latest' + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + listing_id AS listing + , country AS country_latest + FROM ***************************.dim_listings_latest listings_latest_src_10004 +) subq_9 +ON + subq_7.listing = subq_9.listing +LEFT OUTER JOIN ( + -- Read Elements From Data Source 'listings_latest' + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + listing_id AS listing + , country AS country_latest + FROM ***************************.dim_listings_latest listings_latest_src_10004 +) subq_11 +ON + subq_7.listing = subq_11.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multihop_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multihop_node__plan0.sql new file mode 100644 index 0000000000..652cfd9501 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multihop_node__plan0.sql @@ -0,0 +1,218 @@ +-- Compute Metrics via Expressions +SELECT + subq_10.account_id__customer_id__customer_name + , subq_10.txn_count +FROM ( + -- Aggregate Measures + SELECT + subq_9.account_id__customer_id__customer_name + , SUM(subq_9.txn_count) AS txn_count + FROM ( + -- Pass Only Elements: + -- ['txn_count', 'account_id__customer_id__customer_name'] + SELECT + subq_8.account_id__customer_id__customer_name + , subq_8.txn_count + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned AS ds_partitioned + , subq_7.ds_partitioned AS account_id__ds_partitioned + , subq_2.account_id AS account_id + , subq_7.customer_id__customer_name AS account_id__customer_id__customer_name + , subq_2.txn_count AS txn_count + FROM ( + -- Pass Only Elements: + -- ['txn_count', 'account_id', 'ds_partitioned'] + SELECT + subq_1.ds_partitioned + , subq_1.account_id + , subq_1.txn_count + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.account_id__ds_partitioned + , subq_0.account_id__ds_partitioned__week + , subq_0.account_id__ds_partitioned__month + , subq_0.account_id__ds_partitioned__quarter + , subq_0.account_id__ds_partitioned__year + , subq_0.account_id__ds + , subq_0.account_id__ds__week + , subq_0.account_id__ds__month + , subq_0.account_id__ds__quarter + , subq_0.account_id__ds__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.account_id + , subq_0.account_month + , subq_0.account_id__account_month + , subq_0.txn_count + FROM ( + -- Read Elements From Data Source 'account_month_txns' + SELECT + account_month_txns_src_10010.txn_count + , account_month_txns_src_10010.ds_partitioned + , DATE_TRUNC('week', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS ds_partitioned__year + , account_month_txns_src_10010.ds + , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS ds__week + , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS ds__month + , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS ds__quarter + , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS ds__year + , account_month_txns_src_10010.account_month + , account_month_txns_src_10010.ds_partitioned AS account_id__ds_partitioned + , DATE_TRUNC('week', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', account_month_txns_src_10010.ds_partitioned) AS account_id__ds_partitioned__year + , account_month_txns_src_10010.ds AS account_id__ds + , DATE_TRUNC('week', account_month_txns_src_10010.ds) AS account_id__ds__week + , DATE_TRUNC('month', account_month_txns_src_10010.ds) AS account_id__ds__month + , DATE_TRUNC('quarter', account_month_txns_src_10010.ds) AS account_id__ds__quarter + , DATE_TRUNC('year', account_month_txns_src_10010.ds) AS account_id__ds__year + , account_month_txns_src_10010.account_month AS account_id__account_month + , account_month_txns_src_10010.account_id + FROM ***************************.account_month_txns account_month_txns_src_10010 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['account_id', 'ds_partitioned', 'customer_id__customer_name'] + SELECT + subq_6.ds_partitioned + , subq_6.account_id + , subq_6.customer_id__customer_name + FROM ( + -- Join Standard Outputs + SELECT + subq_3.ds_partitioned AS ds_partitioned + , subq_3.ds_partitioned__week AS ds_partitioned__week + , subq_3.ds_partitioned__month AS ds_partitioned__month + , subq_3.ds_partitioned__quarter AS ds_partitioned__quarter + , subq_3.ds_partitioned__year AS ds_partitioned__year + , subq_3.account_id__ds_partitioned AS account_id__ds_partitioned + , subq_3.account_id__ds_partitioned__week AS account_id__ds_partitioned__week + , subq_3.account_id__ds_partitioned__month AS account_id__ds_partitioned__month + , subq_3.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter + , subq_3.account_id__ds_partitioned__year AS account_id__ds_partitioned__year + , subq_5.ds_partitioned AS customer_id__ds_partitioned + , subq_5.ds_partitioned__week AS customer_id__ds_partitioned__week + , subq_5.ds_partitioned__month AS customer_id__ds_partitioned__month + , subq_5.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter + , subq_5.ds_partitioned__year AS customer_id__ds_partitioned__year + , subq_3.account_id AS account_id + , subq_3.customer_id AS customer_id + , subq_3.account_id__customer_id AS account_id__customer_id + , subq_3.extra_dim AS extra_dim + , subq_3.account_id__extra_dim AS account_id__extra_dim + , subq_5.customer_name AS customer_id__customer_name + , subq_5.customer_atomic_weight AS customer_id__customer_atomic_weight + FROM ( + -- Read Elements From Data Source 'bridge_table' + SELECT + bridge_table_src_10011.extra_dim + , bridge_table_src_10011.ds_partitioned + , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS ds_partitioned__year + , bridge_table_src_10011.extra_dim AS account_id__extra_dim + , bridge_table_src_10011.ds_partitioned AS account_id__ds_partitioned + , DATE_TRUNC('week', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__week + , DATE_TRUNC('month', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__month + , DATE_TRUNC('quarter', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__quarter + , DATE_TRUNC('year', bridge_table_src_10011.ds_partitioned) AS account_id__ds_partitioned__year + , bridge_table_src_10011.account_id + , bridge_table_src_10011.customer_id + , bridge_table_src_10011.customer_id AS account_id__customer_id + FROM ***************************.bridge_table bridge_table_src_10011 + ) subq_3 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['customer_name', + -- 'customer_atomic_weight', + -- 'customer_id__customer_name', + -- 'customer_id__customer_atomic_weight', + -- 'customer_id', + -- 'ds_partitioned', + -- 'ds_partitioned__week', + -- 'ds_partitioned__month', + -- 'ds_partitioned__quarter', + -- 'ds_partitioned__year', + -- 'customer_id__ds_partitioned', + -- 'customer_id__ds_partitioned__week', + -- 'customer_id__ds_partitioned__month', + -- 'customer_id__ds_partitioned__quarter', + -- 'customer_id__ds_partitioned__year'] + SELECT + subq_4.ds_partitioned + , subq_4.ds_partitioned__week + , subq_4.ds_partitioned__month + , subq_4.ds_partitioned__quarter + , subq_4.ds_partitioned__year + , subq_4.customer_id__ds_partitioned + , subq_4.customer_id__ds_partitioned__week + , subq_4.customer_id__ds_partitioned__month + , subq_4.customer_id__ds_partitioned__quarter + , subq_4.customer_id__ds_partitioned__year + , subq_4.customer_id + , subq_4.customer_name + , subq_4.customer_atomic_weight + , subq_4.customer_id__customer_name + , subq_4.customer_id__customer_atomic_weight + FROM ( + -- Read Elements From Data Source 'customer_table' + SELECT + customer_table_src_10013.customer_name + , customer_table_src_10013.customer_atomic_weight + , customer_table_src_10013.ds_partitioned + , DATE_TRUNC('week', customer_table_src_10013.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS ds_partitioned__year + , customer_table_src_10013.customer_name AS customer_id__customer_name + , customer_table_src_10013.customer_atomic_weight AS customer_id__customer_atomic_weight + , customer_table_src_10013.ds_partitioned AS customer_id__ds_partitioned + , DATE_TRUNC('week', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__week + , DATE_TRUNC('month', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__month + , DATE_TRUNC('quarter', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__quarter + , DATE_TRUNC('year', customer_table_src_10013.ds_partitioned) AS customer_id__ds_partitioned__year + , customer_table_src_10013.customer_id + FROM ***************************.customer_table customer_table_src_10013 + ) subq_4 + ) subq_5 + ON + ( + subq_3.customer_id = subq_5.customer_id + ) AND ( + subq_3.ds_partitioned = subq_5.ds_partitioned + ) + ) subq_6 + ) subq_7 + ON + ( + subq_2.account_id = subq_7.account_id + ) AND ( + subq_2.ds_partitioned = subq_7.ds_partitioned + ) + ) subq_8 + ) subq_9 + GROUP BY + subq_9.account_id__customer_id__customer_name +) subq_10 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multihop_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multihop_node__plan0_optimized.sql new file mode 100644 index 0000000000..518b5c37a6 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_multihop_node__plan0_optimized.sql @@ -0,0 +1,35 @@ +-- Join Standard Outputs +-- Pass Only Elements: +-- ['txn_count', 'account_id__customer_id__customer_name'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + subq_18.customer_id__customer_name AS account_id__customer_id__customer_name + , SUM(account_month_txns_src_10010.txn_count) AS txn_count +FROM ***************************.account_month_txns account_month_txns_src_10010 +LEFT OUTER JOIN ( + -- Join Standard Outputs + -- Pass Only Elements: + -- ['account_id', 'ds_partitioned', 'customer_id__customer_name'] + SELECT + bridge_table_src_10011.ds_partitioned AS ds_partitioned + , bridge_table_src_10011.account_id AS account_id + , customer_table_src_10013.customer_name AS customer_id__customer_name + FROM ***************************.bridge_table bridge_table_src_10011 + LEFT OUTER JOIN + ***************************.customer_table customer_table_src_10013 + ON + ( + bridge_table_src_10011.customer_id = customer_table_src_10013.customer_id + ) AND ( + bridge_table_src_10011.ds_partitioned = customer_table_src_10013.ds_partitioned + ) +) subq_18 +ON + ( + account_month_txns_src_10010.account_id = subq_18.account_id + ) AND ( + account_month_txns_src_10010.ds_partitioned = subq_18.ds_partitioned + ) +GROUP BY + subq_18.customer_id__customer_name diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_order_by_node__plan0.sql new file mode 100644 index 0000000000..1375f22801 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_order_by_node__plan0.sql @@ -0,0 +1,86 @@ +-- Order By ['ds', 'bookings'] +SELECT + subq_3.ds + , subq_3.is_instant + , subq_3.bookings +FROM ( + -- Compute Metrics via Expressions + SELECT + subq_2.ds + , subq_2.is_instant + , subq_2.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_1.ds + , subq_1.is_instant + , SUM(subq_1.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'is_instant', 'ds'] + SELECT + subq_0.ds + , subq_0.is_instant + , subq_0.bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + GROUP BY + subq_1.ds + , subq_1.is_instant + ) subq_2 +) subq_3 +ORDER BY subq_3.ds, subq_3.bookings DESC diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_order_by_node__plan0_optimized.sql new file mode 100644 index 0000000000..acd6087ced --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_order_by_node__plan0_optimized.sql @@ -0,0 +1,24 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +-- Order By ['ds', 'bookings'] +SELECT + ds + , is_instant + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Pass Only Elements: + -- ['bookings', 'is_instant', 'ds'] + SELECT + ds + , is_instant + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_5 +GROUP BY + ds + , is_instant +ORDER BY ds, bookings DESC diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_partitioned_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_partitioned_join__plan0.sql new file mode 100644 index 0000000000..d6b0caaed7 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_partitioned_join__plan0.sql @@ -0,0 +1,154 @@ +-- Compute Metrics via Expressions +SELECT + subq_7.user__home_state + , subq_7.identity_verifications +FROM ( + -- Aggregate Measures + SELECT + subq_6.user__home_state + , SUM(subq_6.identity_verifications) AS identity_verifications + FROM ( + -- Pass Only Elements: + -- ['identity_verifications', 'user__home_state'] + SELECT + subq_5.user__home_state + , subq_5.identity_verifications + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned AS ds_partitioned + , subq_4.ds_partitioned AS user__ds_partitioned + , subq_2.user AS user + , subq_4.home_state AS user__home_state + , subq_2.identity_verifications AS identity_verifications + FROM ( + -- Pass Only Elements: + -- ['identity_verifications', 'user', 'ds_partitioned'] + SELECT + subq_1.ds_partitioned + , subq_1.user + , subq_1.identity_verifications + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.verification__ds + , subq_0.verification__ds__week + , subq_0.verification__ds__month + , subq_0.verification__ds__quarter + , subq_0.verification__ds__year + , subq_0.verification__ds_partitioned + , subq_0.verification__ds_partitioned__week + , subq_0.verification__ds_partitioned__month + , subq_0.verification__ds_partitioned__quarter + , subq_0.verification__ds_partitioned__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.verification + , subq_0.user + , subq_0.verification__user + , subq_0.verification_type + , subq_0.verification__verification_type + , subq_0.identity_verifications + FROM ( + -- Read Elements From Data Source 'id_verifications' + SELECT + 1 AS identity_verifications + , id_verifications_src_10003.ds + , DATE_TRUNC('week', id_verifications_src_10003.ds) AS ds__week + , DATE_TRUNC('month', id_verifications_src_10003.ds) AS ds__month + , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS ds__quarter + , DATE_TRUNC('year', id_verifications_src_10003.ds) AS ds__year + , id_verifications_src_10003.ds_partitioned + , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS ds_partitioned__year + , id_verifications_src_10003.verification_type + , id_verifications_src_10003.ds AS verification__ds + , DATE_TRUNC('week', id_verifications_src_10003.ds) AS verification__ds__week + , DATE_TRUNC('month', id_verifications_src_10003.ds) AS verification__ds__month + , DATE_TRUNC('quarter', id_verifications_src_10003.ds) AS verification__ds__quarter + , DATE_TRUNC('year', id_verifications_src_10003.ds) AS verification__ds__year + , id_verifications_src_10003.ds_partitioned AS verification__ds_partitioned + , DATE_TRUNC('week', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__week + , DATE_TRUNC('month', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__month + , DATE_TRUNC('quarter', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__quarter + , DATE_TRUNC('year', id_verifications_src_10003.ds_partitioned) AS verification__ds_partitioned__year + , id_verifications_src_10003.verification_type AS verification__verification_type + , id_verifications_src_10003.verification_id AS verification + , id_verifications_src_10003.user_id AS user + , id_verifications_src_10003.user_id AS verification__user + FROM ***************************.fct_id_verifications id_verifications_src_10003 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['user', 'ds_partitioned', 'home_state'] + SELECT + subq_3.ds_partitioned + , subq_3.user + , subq_3.home_state + FROM ( + -- Read Elements From Data Source 'users_ds_source' + SELECT + users_ds_source_src_10007.ds + , DATE_TRUNC('week', users_ds_source_src_10007.ds) AS ds__week + , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS ds__month + , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS ds__quarter + , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS ds__year + , users_ds_source_src_10007.created_at + , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS created_at__week + , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS created_at__year + , users_ds_source_src_10007.ds_partitioned + , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS ds_partitioned__year + , users_ds_source_src_10007.home_state + , users_ds_source_src_10007.ds AS user__ds + , DATE_TRUNC('week', users_ds_source_src_10007.ds) AS user__ds__week + , DATE_TRUNC('month', users_ds_source_src_10007.ds) AS user__ds__month + , DATE_TRUNC('quarter', users_ds_source_src_10007.ds) AS user__ds__quarter + , DATE_TRUNC('year', users_ds_source_src_10007.ds) AS user__ds__year + , users_ds_source_src_10007.created_at AS user__created_at + , DATE_TRUNC('week', users_ds_source_src_10007.created_at) AS user__created_at__week + , DATE_TRUNC('month', users_ds_source_src_10007.created_at) AS user__created_at__month + , DATE_TRUNC('quarter', users_ds_source_src_10007.created_at) AS user__created_at__quarter + , DATE_TRUNC('year', users_ds_source_src_10007.created_at) AS user__created_at__year + , users_ds_source_src_10007.ds_partitioned AS user__ds_partitioned + , DATE_TRUNC('week', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__week + , DATE_TRUNC('month', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__month + , DATE_TRUNC('quarter', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__quarter + , DATE_TRUNC('year', users_ds_source_src_10007.ds_partitioned) AS user__ds_partitioned__year + , users_ds_source_src_10007.home_state AS user__home_state + , users_ds_source_src_10007.user_id AS user + FROM ***************************.dim_users users_ds_source_src_10007 + ) subq_3 + ) subq_4 + ON + ( + subq_2.user = subq_4.user + ) AND ( + subq_2.ds_partitioned = subq_4.ds_partitioned + ) + ) subq_5 + ) subq_6 + GROUP BY + subq_6.user__home_state +) subq_7 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_partitioned_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_partitioned_join__plan0_optimized.sql new file mode 100644 index 0000000000..bf506dc1d7 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_partitioned_join__plan0_optimized.sql @@ -0,0 +1,29 @@ +-- Join Standard Outputs +-- Pass Only Elements: +-- ['identity_verifications', 'user__home_state'] +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + users_ds_source_src_10007.home_state AS user__home_state + , SUM(subq_10.identity_verifications) AS identity_verifications +FROM ( + -- Read Elements From Data Source 'id_verifications' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['identity_verifications', 'user', 'ds_partitioned'] + SELECT + ds_partitioned + , user_id AS user + , 1 AS identity_verifications + FROM ***************************.fct_id_verifications id_verifications_src_10003 +) subq_10 +LEFT OUTER JOIN + ***************************.dim_users users_ds_source_src_10007 +ON + ( + subq_10.user = users_ds_source_src_10007.user_id + ) AND ( + subq_10.ds_partitioned = users_ds_source_src_10007.ds_partitioned + ) +GROUP BY + users_ds_source_src_10007.home_state diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node__plan0.sql new file mode 100644 index 0000000000..db7284f437 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node__plan0.sql @@ -0,0 +1,55 @@ +-- Join on MIN(ds) and [] grouping by None +SELECT + subq_0.ds AS ds + , subq_0.ds__week AS ds__week + , subq_0.ds__month AS ds__month + , subq_0.ds__quarter AS ds__quarter + , subq_0.ds__year AS ds__year + , subq_0.user AS user + , subq_0.account_type AS account_type + , subq_0.account_balance AS account_balance + , subq_0.total_account_balance_first_day AS total_account_balance_first_day + , subq_0.current_account_balance_by_user AS current_account_balance_by_user +FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + accounts_source_src_10000.account_balance + , accounts_source_src_10000.account_balance AS total_account_balance_first_day + , accounts_source_src_10000.account_balance AS current_account_balance_by_user + , accounts_source_src_10000.ds + , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , accounts_source_src_10000.account_type + , accounts_source_src_10000.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 +) subq_0 +INNER JOIN ( + -- Filter row on MIN(ds) + SELECT + MIN(subq_1.ds) AS ds__complete + FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + accounts_source_src_10000.account_balance + , accounts_source_src_10000.account_balance AS total_account_balance_first_day + , accounts_source_src_10000.account_balance AS current_account_balance_by_user + , accounts_source_src_10000.ds + , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , accounts_source_src_10000.account_type + , accounts_source_src_10000.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 + ) subq_1 +) subq_2 +ON + subq_0.ds = subq_2.ds__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node__plan0_optimized.sql new file mode 100644 index 0000000000..32b8bb64c3 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node__plan0_optimized.sql @@ -0,0 +1,42 @@ +-- Join on MIN(ds) and [] grouping by None +SELECT + subq_3.ds AS ds + , subq_3.ds__week AS ds__week + , subq_3.ds__month AS ds__month + , subq_3.ds__quarter AS ds__quarter + , subq_3.ds__year AS ds__year + , subq_3.user AS user + , subq_3.account_type AS account_type + , subq_3.account_balance AS account_balance + , subq_3.total_account_balance_first_day AS total_account_balance_first_day + , subq_3.current_account_balance_by_user AS current_account_balance_by_user +FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + account_balance + , account_balance AS total_account_balance_first_day + , account_balance AS current_account_balance_by_user + , ds + , DATE_TRUNC('week', ds) AS ds__week + , DATE_TRUNC('month', ds) AS ds__month + , DATE_TRUNC('quarter', ds) AS ds__quarter + , DATE_TRUNC('year', ds) AS ds__year + , account_type + , user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 +) subq_3 +INNER JOIN ( + -- Read Elements From Data Source 'accounts_source' + -- Filter row on MIN(ds) + SELECT + MIN(ds) AS ds__complete + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 +) subq_5 +ON + subq_3.ds = subq_5.ds__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_grouping__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_grouping__plan0.sql new file mode 100644 index 0000000000..865be8f4c7 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_grouping__plan0.sql @@ -0,0 +1,58 @@ +-- Join on MAX(ds) and ['user'] grouping by None +SELECT + subq_0.ds AS ds + , subq_0.ds__week AS ds__week + , subq_0.ds__month AS ds__month + , subq_0.ds__quarter AS ds__quarter + , subq_0.ds__year AS ds__year + , subq_0.user AS user + , subq_0.account_type AS account_type + , subq_0.account_balance AS account_balance + , subq_0.total_account_balance_first_day AS total_account_balance_first_day + , subq_0.current_account_balance_by_user AS current_account_balance_by_user +FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + accounts_source_src_10000.account_balance + , accounts_source_src_10000.account_balance AS total_account_balance_first_day + , accounts_source_src_10000.account_balance AS current_account_balance_by_user + , accounts_source_src_10000.ds + , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , accounts_source_src_10000.account_type + , accounts_source_src_10000.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 +) subq_0 +INNER JOIN ( + -- Filter row on MAX(ds) + SELECT + subq_1.user + , MAX(subq_1.ds) AS ds__complete + FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + accounts_source_src_10000.account_balance + , accounts_source_src_10000.account_balance AS total_account_balance_first_day + , accounts_source_src_10000.account_balance AS current_account_balance_by_user + , accounts_source_src_10000.ds + , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , accounts_source_src_10000.account_type + , accounts_source_src_10000.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 + ) subq_1 + GROUP BY + subq_1.user +) subq_2 +ON + (subq_0.ds = subq_2.ds__complete) AND (subq_0.user = subq_2.user) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_grouping__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_grouping__plan0_optimized.sql new file mode 100644 index 0000000000..b271a3b7c3 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_grouping__plan0_optimized.sql @@ -0,0 +1,45 @@ +-- Join on MAX(ds) and ['user'] grouping by None +SELECT + subq_3.ds AS ds + , subq_3.ds__week AS ds__week + , subq_3.ds__month AS ds__month + , subq_3.ds__quarter AS ds__quarter + , subq_3.ds__year AS ds__year + , subq_3.user AS user + , subq_3.account_type AS account_type + , subq_3.account_balance AS account_balance + , subq_3.total_account_balance_first_day AS total_account_balance_first_day + , subq_3.current_account_balance_by_user AS current_account_balance_by_user +FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + account_balance + , account_balance AS total_account_balance_first_day + , account_balance AS current_account_balance_by_user + , ds + , DATE_TRUNC('week', ds) AS ds__week + , DATE_TRUNC('month', ds) AS ds__month + , DATE_TRUNC('quarter', ds) AS ds__quarter + , DATE_TRUNC('year', ds) AS ds__year + , account_type + , user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 +) subq_3 +INNER JOIN ( + -- Read Elements From Data Source 'accounts_source' + -- Filter row on MAX(ds) + SELECT + user_id AS user + , MAX(ds) AS ds__complete + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 + GROUP BY + user_id +) subq_5 +ON + (subq_3.ds = subq_5.ds__complete) AND (subq_3.user = subq_5.user) diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_queried_group_by__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_queried_group_by__plan0.sql new file mode 100644 index 0000000000..fc98c5b23f --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_queried_group_by__plan0.sql @@ -0,0 +1,57 @@ +-- Join on MIN(ds) and [] grouping by ds +SELECT + subq_0.ds AS ds + , subq_0.ds__week AS ds__week + , subq_0.ds__month AS ds__month + , subq_0.ds__quarter AS ds__quarter + , subq_0.ds__year AS ds__year + , subq_0.user AS user + , subq_0.account_type AS account_type + , subq_0.account_balance AS account_balance + , subq_0.total_account_balance_first_day AS total_account_balance_first_day + , subq_0.current_account_balance_by_user AS current_account_balance_by_user +FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + accounts_source_src_10000.account_balance + , accounts_source_src_10000.account_balance AS total_account_balance_first_day + , accounts_source_src_10000.account_balance AS current_account_balance_by_user + , accounts_source_src_10000.ds + , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , accounts_source_src_10000.account_type + , accounts_source_src_10000.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 +) subq_0 +INNER JOIN ( + -- Filter row on MIN(ds) + SELECT + MIN(subq_1.ds) AS ds__complete + FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + accounts_source_src_10000.account_balance + , accounts_source_src_10000.account_balance AS total_account_balance_first_day + , accounts_source_src_10000.account_balance AS current_account_balance_by_user + , accounts_source_src_10000.ds + , DATE_TRUNC('week', accounts_source_src_10000.ds) AS ds__week + , DATE_TRUNC('month', accounts_source_src_10000.ds) AS ds__month + , DATE_TRUNC('quarter', accounts_source_src_10000.ds) AS ds__quarter + , DATE_TRUNC('year', accounts_source_src_10000.ds) AS ds__year + , accounts_source_src_10000.account_type + , accounts_source_src_10000.user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 + ) subq_1 + GROUP BY + subq_1.ds__week +) subq_2 +ON + subq_0.ds = subq_2.ds__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql new file mode 100644 index 0000000000..d40ad40236 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_semi_additive_join_node_with_queried_group_by__plan0_optimized.sql @@ -0,0 +1,44 @@ +-- Join on MIN(ds) and [] grouping by ds +SELECT + subq_3.ds AS ds + , subq_3.ds__week AS ds__week + , subq_3.ds__month AS ds__month + , subq_3.ds__quarter AS ds__quarter + , subq_3.ds__year AS ds__year + , subq_3.user AS user + , subq_3.account_type AS account_type + , subq_3.account_balance AS account_balance + , subq_3.total_account_balance_first_day AS total_account_balance_first_day + , subq_3.current_account_balance_by_user AS current_account_balance_by_user +FROM ( + -- Read Elements From Data Source 'accounts_source' + SELECT + account_balance + , account_balance AS total_account_balance_first_day + , account_balance AS current_account_balance_by_user + , ds + , DATE_TRUNC('week', ds) AS ds__week + , DATE_TRUNC('month', ds) AS ds__month + , DATE_TRUNC('quarter', ds) AS ds__quarter + , DATE_TRUNC('year', ds) AS ds__year + , account_type + , user_id AS user + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 +) subq_3 +INNER JOIN ( + -- Read Elements From Data Source 'accounts_source' + -- Filter row on MIN(ds) + SELECT + MIN(ds) AS ds__complete + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_accounts + ) accounts_source_src_10000 + GROUP BY + DATE_TRUNC('week', ds) +) subq_5 +ON + subq_3.ds = subq_5.ds__complete diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_single_join_node__plan0.sql new file mode 100644 index 0000000000..35e162f0b4 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_single_join_node__plan0.sql @@ -0,0 +1,113 @@ +-- Join Standard Outputs +SELECT + subq_1.listing AS listing + , subq_3.country_latest AS listing__country_latest + , subq_1.bookings AS bookings +FROM ( + -- Pass Only Elements: + -- ['bookings', 'listing'] + SELECT + subq_0.listing + , subq_0.bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 +) subq_1 +LEFT OUTER JOIN ( + -- Pass Only Elements: + -- ['listing', 'country_latest'] + SELECT + subq_2.listing + , subq_2.country_latest + FROM ( + -- Read Elements From Data Source 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_10004.capacity AS largest_listing + , listings_latest_src_10004.capacity AS smallest_listing + , listings_latest_src_10004.created_at AS ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS ds__year + , listings_latest_src_10004.created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS created_at__year + , listings_latest_src_10004.country AS country_latest + , listings_latest_src_10004.is_lux AS is_lux_latest + , listings_latest_src_10004.capacity AS capacity_latest + , listings_latest_src_10004.created_at AS listing__ds + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__ds__year + , listings_latest_src_10004.created_at AS listing__created_at + , DATE_TRUNC('week', listings_latest_src_10004.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_10004.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_10004.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_10004.created_at) AS listing__created_at__year + , listings_latest_src_10004.country AS listing__country_latest + , listings_latest_src_10004.is_lux AS listing__is_lux_latest + , listings_latest_src_10004.capacity AS listing__capacity_latest + , listings_latest_src_10004.listing_id AS listing + , listings_latest_src_10004.user_id AS user + , listings_latest_src_10004.user_id AS listing__user + FROM ***************************.dim_listings_latest listings_latest_src_10004 + ) subq_2 +) subq_3 +ON + subq_1.listing = subq_3.listing diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_single_join_node__plan0_optimized.sql new file mode 100644 index 0000000000..3a3acc15c9 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_single_join_node__plan0_optimized.sql @@ -0,0 +1,21 @@ +-- Join Standard Outputs +SELECT + subq_5.listing AS listing + , listings_latest_src_10004.country AS listing__country_latest + , subq_5.bookings AS bookings +FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Pass Only Elements: + -- ['bookings', 'listing'] + SELECT + listing_id AS listing + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_5 +LEFT OUTER JOIN + ***************************.dim_listings_latest listings_latest_src_10004 +ON + subq_5.listing = listings_latest_src_10004.listing_id diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_source_node__plan0.sql new file mode 100644 index 0000000000..0018eba009 --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_source_node__plan0.sql @@ -0,0 +1,53 @@ +-- Read Elements From Data Source 'bookings_source' +SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings +) bookings_source_src_10001 diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_source_node__plan0_optimized.sql new file mode 100644 index 0000000000..8693f414ef --- /dev/null +++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DatabricksSqlClient/test_source_node__plan0_optimized.sql @@ -0,0 +1,53 @@ +-- Read Elements From Data Source 'bookings_source' +SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , booking_value + , booking_value AS max_booking_value + , booking_value AS min_booking_value + , guest_id AS bookers + , booking_value AS average_booking_value + , booking_value AS booking_payments + , is_instant + , ds + , DATE_TRUNC('week', ds) AS ds__week + , DATE_TRUNC('month', ds) AS ds__month + , DATE_TRUNC('quarter', ds) AS ds__quarter + , DATE_TRUNC('year', ds) AS ds__year + , ds_partitioned + , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , booking_paid_at + , DATE_TRUNC('week', booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', booking_paid_at) AS booking_paid_at__year + , is_instant AS create_a_cycle_in_the_join_graph__is_instant + , ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', ds) AS create_a_cycle_in_the_join_graph__ds__year + , ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , listing_id AS listing + , guest_id AS guest + , host_id AS host + , guest_id AS create_a_cycle_in_the_join_graph + , listing_id AS create_a_cycle_in_the_join_graph__listing + , guest_id AS create_a_cycle_in_the_join_graph__guest + , host_id AS create_a_cycle_in_the_join_graph__host +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings +) bookings_source_src_10001 diff --git a/metricflow/test/snapshots/test_engine_specific_rendering.py/SqlQueryPlan/DatabricksSqlClient/test_cast_to_timestamp__plan0.sql b/metricflow/test/snapshots/test_engine_specific_rendering.py/SqlQueryPlan/DatabricksSqlClient/test_cast_to_timestamp__plan0.sql new file mode 100644 index 0000000000..c47396730d --- /dev/null +++ b/metricflow/test/snapshots/test_engine_specific_rendering.py/SqlQueryPlan/DatabricksSqlClient/test_cast_to_timestamp__plan0.sql @@ -0,0 +1,4 @@ +-- Test Cast to Timestamp Expression +SELECT + CAST('2020-01-01' AS TIMESTAMP) AS col0 +FROM foo.bar a diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql new file mode 100644 index 0000000000..689e90c71e --- /dev/null +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_non_primary_time__plan0.sql @@ -0,0 +1,102 @@ +-- Metric Time Dimension 'booking_paid_at' +SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.booking_paid_at AS metric_time + , subq_0.booking_paid_at__week AS metric_time__week + , subq_0.booking_paid_at__month AS metric_time__month + , subq_0.booking_paid_at__quarter AS metric_time__quarter + , subq_0.booking_paid_at__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.booking_payments +FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql new file mode 100644 index 0000000000..797d1499be --- /dev/null +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_non_primary_time__plan0_optimized.sql @@ -0,0 +1,52 @@ +-- Read Elements From Data Source 'bookings_source' +-- Metric Time Dimension 'booking_paid_at' +SELECT + ds + , DATE_TRUNC('week', ds) AS ds__week + , DATE_TRUNC('month', ds) AS ds__month + , DATE_TRUNC('quarter', ds) AS ds__quarter + , DATE_TRUNC('year', ds) AS ds__year + , ds_partitioned + , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , booking_paid_at + , DATE_TRUNC('week', booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', booking_paid_at) AS booking_paid_at__year + , ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', ds) AS create_a_cycle_in_the_join_graph__ds__year + , ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , booking_paid_at AS metric_time + , DATE_TRUNC('week', booking_paid_at) AS metric_time__week + , DATE_TRUNC('month', booking_paid_at) AS metric_time__month + , DATE_TRUNC('quarter', booking_paid_at) AS metric_time__quarter + , DATE_TRUNC('year', booking_paid_at) AS metric_time__year + , listing_id AS listing + , guest_id AS guest + , host_id AS host + , guest_id AS create_a_cycle_in_the_join_graph + , listing_id AS create_a_cycle_in_the_join_graph__listing + , guest_id AS create_a_cycle_in_the_join_graph__guest + , host_id AS create_a_cycle_in_the_join_graph__host + , is_instant + , is_instant AS create_a_cycle_in_the_join_graph__is_instant + , booking_value AS booking_payments +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings +) bookings_source_src_10001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql new file mode 100644 index 0000000000..8e8ac67e42 --- /dev/null +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_primary_time__plan0.sql @@ -0,0 +1,108 @@ +-- Metric Time Dimension 'ds' +SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value +FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 +) subq_0 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql new file mode 100644 index 0000000000..936d6753a0 --- /dev/null +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_metric_time_dimension_transform_node_using_primary_time__plan0_optimized.sql @@ -0,0 +1,58 @@ +-- Read Elements From Data Source 'bookings_source' +-- Metric Time Dimension 'ds' +SELECT + ds + , DATE_TRUNC('week', ds) AS ds__week + , DATE_TRUNC('month', ds) AS ds__month + , DATE_TRUNC('quarter', ds) AS ds__quarter + , DATE_TRUNC('year', ds) AS ds__year + , ds_partitioned + , DATE_TRUNC('week', ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', ds_partitioned) AS ds_partitioned__year + , booking_paid_at + , DATE_TRUNC('week', booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', booking_paid_at) AS booking_paid_at__year + , ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', ds) AS create_a_cycle_in_the_join_graph__ds__year + , ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , ds AS metric_time + , DATE_TRUNC('week', ds) AS metric_time__week + , DATE_TRUNC('month', ds) AS metric_time__month + , DATE_TRUNC('quarter', ds) AS metric_time__quarter + , DATE_TRUNC('year', ds) AS metric_time__year + , listing_id AS listing + , guest_id AS guest + , host_id AS host + , guest_id AS create_a_cycle_in_the_join_graph + , listing_id AS create_a_cycle_in_the_join_graph__listing + , guest_id AS create_a_cycle_in_the_join_graph__guest + , host_id AS create_a_cycle_in_the_join_graph__host + , is_instant + , is_instant AS create_a_cycle_in_the_join_graph__is_instant + , 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , booking_value + , booking_value AS max_booking_value + , booking_value AS min_booking_value + , guest_id AS bookers + , booking_value AS average_booking_value +FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings +) bookings_source_src_10001 diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_simple_query_with_metric_time_dimension__plan0.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_simple_query_with_metric_time_dimension__plan0.sql new file mode 100644 index 0000000000..3db8d84bba --- /dev/null +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_simple_query_with_metric_time_dimension__plan0.sql @@ -0,0 +1,263 @@ +-- Combine Metrics +SELECT + COALESCE(subq_8.metric_time, subq_9.metric_time) AS metric_time + , subq_8.bookings AS bookings + , subq_9.booking_payments AS booking_payments +FROM ( + -- Compute Metrics via Expressions + SELECT + subq_3.metric_time + , subq_3.bookings + FROM ( + -- Aggregate Measures + SELECT + subq_2.metric_time + , SUM(subq_2.bookings) AS bookings + FROM ( + -- Pass Only Elements: + -- ['bookings', 'metric_time'] + SELECT + subq_1.metric_time + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds_partitioned + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.booking_paid_at + , subq_0.booking_paid_at__week + , subq_0.booking_paid_at__month + , subq_0.booking_paid_at__quarter + , subq_0.booking_paid_at__year + , subq_0.create_a_cycle_in_the_join_graph__ds + , subq_0.create_a_cycle_in_the_join_graph__ds__week + , subq_0.create_a_cycle_in_the_join_graph__ds__month + , subq_0.create_a_cycle_in_the_join_graph__ds__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds__year + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_0.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_0.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_0.ds AS metric_time + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.create_a_cycle_in_the_join_graph + , subq_0.create_a_cycle_in_the_join_graph__listing + , subq_0.create_a_cycle_in_the_join_graph__guest + , subq_0.create_a_cycle_in_the_join_graph__host + , subq_0.is_instant + , subq_0.create_a_cycle_in_the_join_graph__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_0 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.metric_time + ) subq_3 +) subq_8 +FULL OUTER JOIN ( + -- Compute Metrics via Expressions + SELECT + subq_7.metric_time + , subq_7.booking_payments + FROM ( + -- Aggregate Measures + SELECT + subq_6.metric_time + , SUM(subq_6.booking_payments) AS booking_payments + FROM ( + -- Pass Only Elements: + -- ['booking_payments', 'metric_time'] + SELECT + subq_5.metric_time + , subq_5.booking_payments + FROM ( + -- Metric Time Dimension 'booking_paid_at' + SELECT + subq_4.ds + , subq_4.ds__week + , subq_4.ds__month + , subq_4.ds__quarter + , subq_4.ds__year + , subq_4.ds_partitioned + , subq_4.ds_partitioned__week + , subq_4.ds_partitioned__month + , subq_4.ds_partitioned__quarter + , subq_4.ds_partitioned__year + , subq_4.booking_paid_at + , subq_4.booking_paid_at__week + , subq_4.booking_paid_at__month + , subq_4.booking_paid_at__quarter + , subq_4.booking_paid_at__year + , subq_4.create_a_cycle_in_the_join_graph__ds + , subq_4.create_a_cycle_in_the_join_graph__ds__week + , subq_4.create_a_cycle_in_the_join_graph__ds__month + , subq_4.create_a_cycle_in_the_join_graph__ds__quarter + , subq_4.create_a_cycle_in_the_join_graph__ds__year + , subq_4.create_a_cycle_in_the_join_graph__ds_partitioned + , subq_4.create_a_cycle_in_the_join_graph__ds_partitioned__week + , subq_4.create_a_cycle_in_the_join_graph__ds_partitioned__month + , subq_4.create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , subq_4.create_a_cycle_in_the_join_graph__ds_partitioned__year + , subq_4.create_a_cycle_in_the_join_graph__booking_paid_at + , subq_4.create_a_cycle_in_the_join_graph__booking_paid_at__week + , subq_4.create_a_cycle_in_the_join_graph__booking_paid_at__month + , subq_4.create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , subq_4.create_a_cycle_in_the_join_graph__booking_paid_at__year + , subq_4.booking_paid_at AS metric_time + , subq_4.booking_paid_at__week AS metric_time__week + , subq_4.booking_paid_at__month AS metric_time__month + , subq_4.booking_paid_at__quarter AS metric_time__quarter + , subq_4.booking_paid_at__year AS metric_time__year + , subq_4.listing + , subq_4.guest + , subq_4.host + , subq_4.create_a_cycle_in_the_join_graph + , subq_4.create_a_cycle_in_the_join_graph__listing + , subq_4.create_a_cycle_in_the_join_graph__guest + , subq_4.create_a_cycle_in_the_join_graph__host + , subq_4.is_instant + , subq_4.create_a_cycle_in_the_join_graph__is_instant + , subq_4.booking_payments + FROM ( + -- Read Elements From Data Source 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_10001.booking_value + , bookings_source_src_10001.booking_value AS max_booking_value + , bookings_source_src_10001.booking_value AS min_booking_value + , bookings_source_src_10001.guest_id AS bookers + , bookings_source_src_10001.booking_value AS average_booking_value + , bookings_source_src_10001.booking_value AS booking_payments + , bookings_source_src_10001.is_instant + , bookings_source_src_10001.ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS ds__year + , bookings_source_src_10001.ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS ds_partitioned__year + , bookings_source_src_10001.booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS booking_paid_at__year + , bookings_source_src_10001.is_instant AS create_a_cycle_in_the_join_graph__is_instant + , bookings_source_src_10001.ds AS create_a_cycle_in_the_join_graph__ds + , DATE_TRUNC('week', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__week + , DATE_TRUNC('month', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds) AS create_a_cycle_in_the_join_graph__ds__year + , bookings_source_src_10001.ds_partitioned AS create_a_cycle_in_the_join_graph__ds_partitioned + , DATE_TRUNC('week', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_10001.ds_partitioned) AS create_a_cycle_in_the_join_graph__ds_partitioned__year + , bookings_source_src_10001.booking_paid_at AS create_a_cycle_in_the_join_graph__booking_paid_at + , DATE_TRUNC('week', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__week + , DATE_TRUNC('month', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_10001.booking_paid_at) AS create_a_cycle_in_the_join_graph__booking_paid_at__year + , bookings_source_src_10001.listing_id AS listing + , bookings_source_src_10001.guest_id AS guest + , bookings_source_src_10001.host_id AS host + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph + , bookings_source_src_10001.listing_id AS create_a_cycle_in_the_join_graph__listing + , bookings_source_src_10001.guest_id AS create_a_cycle_in_the_join_graph__guest + , bookings_source_src_10001.host_id AS create_a_cycle_in_the_join_graph__host + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_4 + ) subq_5 + ) subq_6 + GROUP BY + subq_6.metric_time + ) subq_7 +) subq_9 +ON + subq_8.metric_time = subq_9.metric_time diff --git a/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_simple_query_with_metric_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_simple_query_with_metric_time_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..5d15e1520c --- /dev/null +++ b/metricflow/test/snapshots/test_metric_time_dimension_to_sql.py/SqlQueryPlan/DatabricksSqlClient/test_simple_query_with_metric_time_dimension__plan0_optimized.sql @@ -0,0 +1,46 @@ +-- Combine Metrics +SELECT + COALESCE(subq_18.metric_time, subq_19.metric_time) AS metric_time + , subq_18.bookings AS bookings + , subq_19.booking_payments AS booking_payments +FROM ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + metric_time + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'metric_time'] + SELECT + ds AS metric_time + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + ) subq_12 + GROUP BY + metric_time +) subq_18 +FULL OUTER JOIN ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'booking_paid_at' + -- Pass Only Elements: + -- ['booking_payments', 'metric_time'] + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + booking_paid_at AS metric_time + , SUM(booking_value) AS booking_payments + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_10001 + GROUP BY + booking_paid_at +) subq_19 +ON + subq_18.metric_time = subq_19.metric_time diff --git a/metricflow/test/snapshots/test_rendered_query.py/MetricFlowExplainResult/DatabricksSqlClient/test_render_query__query0.sql b/metricflow/test/snapshots/test_rendered_query.py/MetricFlowExplainResult/DatabricksSqlClient/test_render_query__query0.sql new file mode 100644 index 0000000000..94b5b518a4 --- /dev/null +++ b/metricflow/test/snapshots/test_rendered_query.py/MetricFlowExplainResult/DatabricksSqlClient/test_render_query__query0.sql @@ -0,0 +1,20 @@ +-- Aggregate Measures +-- Compute Metrics via Expressions +SELECT + ds + , SUM(bookings) AS bookings +FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'ds'] + SELECT + ds + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_1 +) subq_2 +GROUP BY + ds diff --git a/metricflow/test/snapshots/test_rendered_query.py/MetricFlowExplainResult/DatabricksSqlClient/test_render_write_to_table_query__query0.sql b/metricflow/test/snapshots/test_rendered_query.py/MetricFlowExplainResult/DatabricksSqlClient/test_render_write_to_table_query__query0.sql new file mode 100644 index 0000000000..e513634a4b --- /dev/null +++ b/metricflow/test/snapshots/test_rendered_query.py/MetricFlowExplainResult/DatabricksSqlClient/test_render_write_to_table_query__query0.sql @@ -0,0 +1,22 @@ +CREATE TABLE ***************************.test_table AS ( + -- Aggregate Measures + -- Compute Metrics via Expressions + SELECT + ds + , SUM(bookings) AS bookings + FROM ( + -- Read Elements From Data Source 'bookings_source' + -- Metric Time Dimension 'ds' + -- Pass Only Elements: + -- ['bookings', 'ds'] + SELECT + ds + , 1 AS bookings + FROM ( + -- User Defined SQL Query + SELECT * FROM ***************************.fct_bookings + ) bookings_source_src_1 + ) subq_2 + GROUP BY + ds +) diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan0.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan0.sql new file mode 100644 index 0000000000..94a467a61a --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan0.sql @@ -0,0 +1,4 @@ +-- test0 +SELECT + SUM(1) AS bookings +FROM demo.fct_bookings a diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan1.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan1.sql new file mode 100644 index 0000000000..4f2811f3ab --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan1.sql @@ -0,0 +1,6 @@ +-- test1 +SELECT + SUM(1) AS bookings + , b.country AS user__country + , c.country AS listing__country +FROM demo.fct_bookings a diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan2.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan2.sql new file mode 100644 index 0000000000..9084cacd9c --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan2.sql @@ -0,0 +1,10 @@ +-- test2 +SELECT + SUM(1) AS bookings + , b.country AS user__country + , c.country AS listing__country +FROM demo.fct_bookings a +LEFT OUTER JOIN + demo.dim_users b +ON + a.user_id = b.user_id diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan3.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan3.sql new file mode 100644 index 0000000000..e283f191ed --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan3.sql @@ -0,0 +1,14 @@ +-- test3 +SELECT + SUM(1) AS bookings + , b.country AS user__country + , c.country AS listing__country +FROM demo.fct_bookings a +LEFT OUTER JOIN + demo.dim_users b +ON + a.user_id = b.user_id +LEFT OUTER JOIN + demo.dim_listings c +ON + a.user_id = c.user_id diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan4.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan4.sql new file mode 100644 index 0000000000..50c2a20f46 --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan4.sql @@ -0,0 +1,16 @@ +-- test4 +SELECT + SUM(1) AS bookings + , b.country AS user__country + , c.country AS listing__country +FROM demo.fct_bookings a +LEFT OUTER JOIN + demo.dim_users b +ON + a.user_id = b.user_id +LEFT OUTER JOIN + demo.dim_listings c +ON + a.user_id = c.user_id +GROUP BY + b.country diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan5.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan5.sql new file mode 100644 index 0000000000..98affe9d30 --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_component_rendering__plan5.sql @@ -0,0 +1,17 @@ +-- test5 +SELECT + SUM(1) AS bookings + , b.country AS user__country + , c.country AS listing__country +FROM demo.fct_bookings a +LEFT OUTER JOIN + demo.dim_users b +ON + a.user_id = b.user_id +LEFT OUTER JOIN + demo.dim_listings c +ON + a.user_id = c.user_id +GROUP BY + b.country + , c.country diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_limit__plan0.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_limit__plan0.sql new file mode 100644 index 0000000000..5720a09db8 --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_limit__plan0.sql @@ -0,0 +1,5 @@ +-- test0 +SELECT + a.bookings +FROM demo.fct_bookings a +LIMIT 1 diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_order_by__plan0.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_order_by__plan0.sql new file mode 100644 index 0000000000..bef477c2b8 --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_order_by__plan0.sql @@ -0,0 +1,6 @@ +-- test0 +SELECT + a.booking_value + , a.bookings +FROM demo.fct_bookings a +ORDER BY a.booking_value, a.bookings DESC diff --git a/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_where__plan0.sql b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_where__plan0.sql new file mode 100644 index 0000000000..0f17ba24b2 --- /dev/null +++ b/metricflow/test/snapshots/test_sql_plan_render.py/SqlQueryPlan/DatabricksSqlClient/test_render_where__plan0.sql @@ -0,0 +1,5 @@ +-- test0 +SELECT + a.booking_value +FROM demo.fct_bookings a +WHERE a.booking_value > 100 diff --git a/metricflow/test/sql_clients/test_sql_client.py b/metricflow/test/sql_clients/test_sql_client.py index 635ac95a39..b2e3c829fc 100644 --- a/metricflow/test/sql_clients/test_sql_client.py +++ b/metricflow/test/sql_clients/test_sql_client.py @@ -38,7 +38,7 @@ def test_query(sql_client: SqlClient) -> None: # noqa: D def test_query_with_execution_params(sql_client: SqlClient) -> None: # noqa: D - expr = "SELECT :x as y" + expr = f"SELECT {sql_client.render_execution_param_key('x')} as y" sql_execution_params = SqlBindParameters() sql_execution_params.param_dict = OrderedDict([("x", "1")]) df = sql_client.query(expr, sql_bind_parameters=sql_execution_params) @@ -55,7 +55,7 @@ def test_select_one_query(sql_client: SqlClient) -> None: # noqa: D def test_failed_query_with_execution_params(sql_client: SqlClient) -> None: # noqa: D - expr = "SELECT :x" + expr = f"SELECT {sql_client.render_execution_param_key('x')}" sql_execution_params = SqlBindParameters() sql_execution_params.param_dict = OrderedDict([("x", "1")]) @@ -96,7 +96,8 @@ def test_table_exists(mf_test_session_state: MetricFlowTestSessionState, sql_cli assert sql_client.table_exists(sql_table) -def test_percent_signs_in_query(sql_client: SqlClient) -> None: # noqa: D +def test_percent_signs_in_query(sql_client: SqlClient) -> None: + """Note: this only syntax works for Datbricks if no execution params are passed.""" stmt = "SELECT foo FROM ( SELECT 'abba' AS foo ) source0 WHERE foo LIKE '%a'" sql_client.query(stmt) df = sql_client.query(stmt) @@ -142,10 +143,7 @@ def _issue_sleep_query(sql_client: SqlClient, sleep_time: int) -> None: engine_type = sql_client.sql_engine_attributes.sql_engine_type if engine_type == SupportedSqlEngine.SNOWFLAKE: sql_client.execute(f"CALL system$wait({sleep_time}, 'SECONDS')") - elif engine_type in ( - SupportedSqlEngine.BIGQUERY, - SupportedSqlEngine.REDSHIFT, - ): + elif engine_type in (SupportedSqlEngine.BIGQUERY, SupportedSqlEngine.REDSHIFT, SupportedSqlEngine.DATABRICKS): raise RuntimeError(f"Sleep yet not supported with {engine_type}") assert_values_exhausted(engine_type) @@ -160,6 +158,7 @@ def _supports_sleep_query(sql_client: SqlClient) -> bool: SupportedSqlEngine.DUCKDB, SupportedSqlEngine.BIGQUERY, SupportedSqlEngine.REDSHIFT, + SupportedSqlEngine.DATABRICKS, ): return False diff --git a/poetry.lock b/poetry.lock index b515571605..bf54952204 100644 --- a/poetry.lock +++ b/poetry.lock @@ -123,6 +123,19 @@ sdist = ["setuptools_rust (>=0.11.4)"] ssh = ["bcrypt (>=3.1.5)"] test = ["pytest (>=6.2.0)", "pytest-cov", "pytest-subtests", "pytest-xdist", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"] +[[package]] +name = "databricks-sql-connector" +version = "2.0.3" +description = "Databricks SQL Connector for Python" +category = "main" +optional = false +python-versions = ">=3.7.1,<4.0.0" + +[package.dependencies] +pandas = ">=1.3.0,<2.0.0" +pyarrow = ">=5.0.0,<6.0.0" +thrift = ">=0.13.0,<0.14.0" + [[package]] name = "distlib" version = "0.3.6" @@ -243,10 +256,10 @@ rsa = {version = ">=3.1.4,<5", markers = "python_version >= \"3.6\""} six = ">=1.9.0" [package.extras] -reauth = ["pyu2f (>=0.1.5)"] +aiohttp = ["requests (>=2.20.0,<3.0.0dev)", "aiohttp (>=3.6.2,<4.0.0dev)"] +enterprise_cert = ["cryptography (==36.0.2)", "pyopenssl (==22.0.0)"] pyopenssl = ["pyopenssl (>=20.0.0)"] -enterprise_cert = ["pyopenssl (==22.0.0)", "cryptography (==36.0.2)"] -aiohttp = ["aiohttp (>=3.6.2,<4.0.0dev)", "requests (>=2.20.0,<3.0.0dev)"] +reauth = ["pyu2f (>=0.1.5)"] [[package]] name = "google-cloud-bigquery" @@ -291,9 +304,9 @@ proto-plus = ">=1.22.0,<2.0.0dev" protobuf = ">=3.19.0,<5.0.0dev" [package.extras] -pyarrow = ["pyarrow (>=0.15.0)"] -pandas = ["pandas (>=0.21.1)"] fastavro = ["fastavro (>=0.21.2)"] +pandas = ["pandas (>=0.21.1)"] +pyarrow = ["pyarrow (>=0.15.0)"] [[package]] name = "google-cloud-core" @@ -622,19 +635,19 @@ pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" [[package]] name = "pandas" -version = "1.2.4" +version = "1.5.0" description = "Powerful data structures for data analysis, time series, and statistics" category = "main" optional = false -python-versions = ">=3.7.1" +python-versions = ">=3.8" [package.dependencies] -numpy = ">=1.16.5" -python-dateutil = ">=2.7.3" -pytz = ">=2017.3" +numpy = {version = ">=1.20.3", markers = "python_version < \"3.10\""} +python-dateutil = ">=2.8.1" +pytz = ">=2020.1" [package.extras] -test = ["pytest (>=5.0.1)", "pytest-xdist", "hypothesis (>=3.58)"] +test = ["pytest-xdist (>=1.31)", "pytest (>=6.0)", "hypothesis (>=5.5.3)"] [[package]] name = "pathspec" @@ -665,8 +678,8 @@ optional = false python-versions = ">=3.6" [package.extras] -dev = ["pre-commit", "tox"] -testing = ["pytest", "pytest-benchmark"] +testing = ["pytest-benchmark", "pytest"] +dev = ["tox", "pre-commit"] [[package]] name = "pre-commit" @@ -724,7 +737,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "pyarrow" -version = "6.0.1" +version = "5.0.0" description = "Python library for Apache Arrow" category = "main" optional = false @@ -800,10 +813,10 @@ optional = false python-versions = ">=3.6" [package.extras] -tests = ["coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)"] -docs = ["zope.interface", "sphinx-rtd-theme", "sphinx"] -dev = ["pre-commit", "mypy", "coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)", "cryptography (>=3.3.1)", "zope.interface", "sphinx-rtd-theme", "sphinx"] crypto = ["cryptography (>=3.3.1)"] +dev = ["sphinx", "sphinx-rtd-theme", "zope.interface", "cryptography (>=3.3.1)", "pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)", "mypy", "pre-commit"] +docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"] +tests = ["pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)"] [[package]] name = "pyopenssl" @@ -1037,7 +1050,7 @@ snowflake-connector-python = "<3.0.0" sqlalchemy = "<2.0.0" [package.extras] -development = ["pytest", "pytest-cov", "pytest-rerunfailures", "pytest-timeout", "coverage", "pexpect", "mock", "pytz", "pytzdata", "cython", "more-itertools", "numpy", "pandas (==0.24.2)", "pandas (>=1.0.0,<1.1.0)"] +development = ["pandas (>=1.0.0,<1.1.0)", "pandas (==0.24.2)", "numpy", "more-itertools", "cython", "pytzdata", "pytz", "mock", "pexpect", "coverage", "pytest-timeout", "pytest-rerunfailures", "pytest-cov", "pytest"] [[package]] name = "spinners" @@ -1144,6 +1157,22 @@ category = "main" optional = false python-versions = "*" +[[package]] +name = "thrift" +version = "0.13.0" +description = "Python bindings for the Apache Thrift RPC system" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +six = ">=1.7.2" + +[package.extras] +all = ["tornado (>=4.0)", "twisted"] +tornado = ["tornado (>=4.0)"] +twisted = ["twisted"] + [[package]] name = "toml" version = "0.10.2" @@ -1229,29 +1258,115 @@ pyyaml = "*" [metadata] lock-version = "1.1" python-versions = ">=3.8,<3.10" -content-hash = "95e7a3baa8011eec94709046d11b328799ba287450ca3fe08e5c9b35f08a8136" +content-hash = "f133c07d28395f3d08007ccb788e1e997b256470eda2d0988b635a27693d629f" [metadata.files] asn1crypto = [ {file = "asn1crypto-1.5.1-py2.py3-none-any.whl", hash = "sha256:db4e40728b728508912cbb3d44f19ce188f218e9eba635821bb4b68564f8fd67"}, {file = "asn1crypto-1.5.1.tar.gz", hash = "sha256:13ae38502be632115abf8a24cbe5f4da52e3b5231990aff31123c805306ccb9c"}, ] -attrs = [] +attrs = [ + {file = "attrs-22.1.0-py2.py3-none-any.whl", hash = "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"}, + {file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"}, +] backoff = [ {file = "backoff-1.11.1-py2.py3-none-any.whl", hash = "sha256:61928f8fa48d52e4faa81875eecf308eccfb1016b018bb6bd21e05b5d90a96c5"}, {file = "backoff-1.11.1.tar.gz", hash = "sha256:ccb962a2378418c667b3c979b504fdeb7d9e0d29c0579e3b13b86467177728cb"}, ] -cachetools = [] -certifi = [] -cffi = [] +cachetools = [ + {file = "cachetools-5.2.0-py3-none-any.whl", hash = "sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db"}, + {file = "cachetools-5.2.0.tar.gz", hash = "sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757"}, +] +certifi = [ + {file = "certifi-2022.6.15-py3-none-any.whl", hash = "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"}, + {file = "certifi-2022.6.15.tar.gz", hash = "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d"}, +] +cffi = [ + {file = "cffi-1.15.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2"}, + {file = "cffi-1.15.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2"}, + {file = "cffi-1.15.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914"}, + {file = "cffi-1.15.1-cp27-cp27m-win32.whl", hash = "sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3"}, + {file = "cffi-1.15.1-cp27-cp27m-win_amd64.whl", hash = "sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e"}, + {file = "cffi-1.15.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162"}, + {file = "cffi-1.15.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b"}, + {file = "cffi-1.15.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21"}, + {file = "cffi-1.15.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185"}, + {file = "cffi-1.15.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd"}, + {file = "cffi-1.15.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc"}, + {file = "cffi-1.15.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f"}, + {file = "cffi-1.15.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e"}, + {file = "cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4"}, + {file = "cffi-1.15.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01"}, + {file = "cffi-1.15.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e"}, + {file = "cffi-1.15.1-cp310-cp310-win32.whl", hash = "sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2"}, + {file = "cffi-1.15.1-cp310-cp310-win_amd64.whl", hash = "sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d"}, + {file = "cffi-1.15.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac"}, + {file = "cffi-1.15.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83"}, + {file = "cffi-1.15.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9"}, + {file = "cffi-1.15.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c"}, + {file = "cffi-1.15.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325"}, + {file = "cffi-1.15.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c"}, + {file = "cffi-1.15.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef"}, + {file = "cffi-1.15.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8"}, + {file = "cffi-1.15.1-cp311-cp311-win32.whl", hash = "sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d"}, + {file = "cffi-1.15.1-cp311-cp311-win_amd64.whl", hash = "sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104"}, + {file = "cffi-1.15.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7"}, + {file = "cffi-1.15.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6"}, + {file = "cffi-1.15.1-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d"}, + {file = "cffi-1.15.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a"}, + {file = "cffi-1.15.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405"}, + {file = "cffi-1.15.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e"}, + {file = "cffi-1.15.1-cp36-cp36m-win32.whl", hash = "sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf"}, + {file = "cffi-1.15.1-cp36-cp36m-win_amd64.whl", hash = "sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497"}, + {file = "cffi-1.15.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375"}, + {file = "cffi-1.15.1-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e"}, + {file = "cffi-1.15.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82"}, + {file = "cffi-1.15.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b"}, + {file = "cffi-1.15.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c"}, + {file = "cffi-1.15.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426"}, + {file = "cffi-1.15.1-cp37-cp37m-win32.whl", hash = "sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9"}, + {file = "cffi-1.15.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045"}, + {file = "cffi-1.15.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3"}, + {file = "cffi-1.15.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a"}, + {file = "cffi-1.15.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5"}, + {file = "cffi-1.15.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca"}, + {file = "cffi-1.15.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02"}, + {file = "cffi-1.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192"}, + {file = "cffi-1.15.1-cp38-cp38-win32.whl", hash = "sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314"}, + {file = "cffi-1.15.1-cp38-cp38-win_amd64.whl", hash = "sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5"}, + {file = "cffi-1.15.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585"}, + {file = "cffi-1.15.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0"}, + {file = "cffi-1.15.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415"}, + {file = "cffi-1.15.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d"}, + {file = "cffi-1.15.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984"}, + {file = "cffi-1.15.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35"}, + {file = "cffi-1.15.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27"}, + {file = "cffi-1.15.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76"}, + {file = "cffi-1.15.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3"}, + {file = "cffi-1.15.1-cp39-cp39-win32.whl", hash = "sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee"}, + {file = "cffi-1.15.1-cp39-cp39-win_amd64.whl", hash = "sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c"}, + {file = "cffi-1.15.1.tar.gz", hash = "sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9"}, +] cfgv = [ {file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"}, {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, ] -charset-normalizer = [] -click = [] -colorama = [] -croniter = [] +charset-normalizer = [ + {file = "charset-normalizer-2.1.1.tar.gz", hash = "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"}, + {file = "charset_normalizer-2.1.1-py3-none-any.whl", hash = "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"}, +] +click = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] +colorama = [ + {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, + {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, +] +croniter = [ + {file = "croniter-1.3.5-py2.py3-none-any.whl", hash = "sha256:4f72faca42c00beb6e30907f1315145f43dfbe5ec0ad4ada24b4c0d57b86a33a"}, + {file = "croniter-1.3.5.tar.gz", hash = "sha256:7592fc0e8a00d82af98dfa2768b75983b6fb4c2adc8f6d0d7c931a715b7cefee"}, +] cryptography = [ {file = "cryptography-36.0.2-cp36-abi3-macosx_10_10_universal2.whl", hash = "sha256:4e2dddd38a5ba733be6a025a1475a9f45e4e41139d1321f412c6b360b19070b6"}, {file = "cryptography-36.0.2-cp36-abi3-macosx_10_10_x86_64.whl", hash = "sha256:4881d09298cd0b669bb15b9cfe6166f16fc1277b4ed0d04a22f3d6430cb30f1d"}, @@ -1274,13 +1389,62 @@ cryptography = [ {file = "cryptography-36.0.2-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:e167b6b710c7f7bc54e67ef593f8731e1f45aa35f8a8a7b72d6e42ec76afd4b3"}, {file = "cryptography-36.0.2.tar.gz", hash = "sha256:70f8f4f7bb2ac9f340655cbac89d68c527af5bb4387522a8413e841e3e6628c9"}, ] +databricks-sql-connector = [ + {file = "databricks-sql-connector-2.0.3.tar.gz", hash = "sha256:0173eb74c15f8b7c7defd15c12e69bd7ad1dd11a29121744900661d93dc8ba81"}, + {file = "databricks_sql_connector-2.0.3-py3-none-any.whl", hash = "sha256:6b19ccbfeeb0d27dcd532d6696486e4451a742750f81085042e83edd0348bed6"}, +] distlib = [ {file = "distlib-0.3.6-py2.py3-none-any.whl", hash = "sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e"}, {file = "distlib-0.3.6.tar.gz", hash = "sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"}, ] -duckdb = [] -duckdb-engine = [] -filelock = [] +duckdb = [ + {file = "duckdb-0.3.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:4ecfa5e8c6bde61efead473b05b35ed989dc08fe76c7ab1c931e4c16e082b10b"}, + {file = "duckdb-0.3.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7bda539e070d08391b36370e847122350c66d90d9fdf20727b23cde86847fa39"}, + {file = "duckdb-0.3.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6d913ea8d59c4004508ed2a21b70dcf7c5cd5d667e7a48efac01e0453627aadc"}, + {file = "duckdb-0.3.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eeab0867e5194e14ea39dbe1d14164c058c9d9fff1328b120361fa6da87aa622"}, + {file = "duckdb-0.3.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0695ee38ad8b2fa4390507ef75c491c93bb508dbe636fec4d08f66bc20b2f911"}, + {file = "duckdb-0.3.4-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:b4a743dc8f1e78539070295be548dfbb7a01c1625d2e37f2414068378a11c3d5"}, + {file = "duckdb-0.3.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6202a9f611aa6526db9699ba625ee0518ca3e269642d6955b995375285f38a7e"}, + {file = "duckdb-0.3.4-cp310-cp310-win32.whl", hash = "sha256:f3452e6780756508f07cd45b696dd92a08adac02d032442ffb4146578c31ff19"}, + {file = "duckdb-0.3.4-cp310-cp310-win_amd64.whl", hash = "sha256:e27f5a6e486785797afc109204dffc81982e6eb0af2001e1e1709dd25c0c203d"}, + {file = "duckdb-0.3.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6e0b88fd0a905e23efb5555f22b980952494c9b94f103c14ea3b613019522095"}, + {file = "duckdb-0.3.4-cp36-cp36m-win32.whl", hash = "sha256:99ba0cdfbbaee22828cb936c4c324617476970359ff6a9e80b5b7daf4269c500"}, + {file = "duckdb-0.3.4-cp36-cp36m-win_amd64.whl", hash = "sha256:03020e992d6093a68ab597e11da2e34587863f238bcc317690e1fec1e93bca41"}, + {file = "duckdb-0.3.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d6280debb6c10a44b1efa073ba07fb067911f3e11d7f5ae9db715478a819a67d"}, + {file = "duckdb-0.3.4-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4b2107da403605bf68692ed5b9194e5692290bd73fa9abdd48fde82be0d6457d"}, + {file = "duckdb-0.3.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e47ab2f2112a258f2e8fae66321009bb51253d674fadf7dd964be0886514684c"}, + {file = "duckdb-0.3.4-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:9df6867017644f016cde47da37de57065540d3cfa410e50b943bd90f42d96110"}, + {file = "duckdb-0.3.4-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:0da2cadcdfbf9aa2e34eba9cc4413ed7c635aaa0bb4cafef7eb37d951f205223"}, + {file = "duckdb-0.3.4-cp37-cp37m-win32.whl", hash = "sha256:672645773abbe32801bf543d12a1189dbc67122db4da6b90a57f3acecd525dbf"}, + {file = "duckdb-0.3.4-cp37-cp37m-win_amd64.whl", hash = "sha256:6fa14f1d3cf225f788ad7f055e25b98d99c06d3a379df4b788fdf66ebe7f9b98"}, + {file = "duckdb-0.3.4-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:155f6717ad9fe1aa99d8d631508d2577b06519661b7e30cb14cff46a0446558c"}, + {file = "duckdb-0.3.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:013a65ddac424d2d778dff37d5b1e91c2f68365436cc8ec76ea45a906313e0bf"}, + {file = "duckdb-0.3.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ba1d627a913154c651daca5ca168b8fa49caa6792a61f069f30eae645a8d52cd"}, + {file = "duckdb-0.3.4-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e8d4e960945955b19ba051e5bb0d6b17c3bcea3d29f9114bb94faaa7585df8c5"}, + {file = "duckdb-0.3.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56ecd82eb31d89ff349059fd909e02906efa1971faeec1a0f7a81357d09d1ad9"}, + {file = "duckdb-0.3.4-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:78c8d2c6629e14140fd038402bf3cbb8c2017ba68148c29c66f8142ffa8f3a39"}, + {file = "duckdb-0.3.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:4811c3fd101d1561d46b5d6c7b9915c3b2adbc8a6270e7cddc63411c6a4b4a0c"}, + {file = "duckdb-0.3.4-cp38-cp38-win32.whl", hash = "sha256:aa42d850cf2dd3f5f664f7a9c8be548f8618064ca6260808fa4e361a334ce2b1"}, + {file = "duckdb-0.3.4-cp38-cp38-win_amd64.whl", hash = "sha256:6ec0be5153a35e3a7462c014a90bba81964f63f114af3f25384b97b0bf5fcae7"}, + {file = "duckdb-0.3.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e35d92606c34cfb56f084eca2540db6573b260f974245465f6dae9dbcdbe6434"}, + {file = "duckdb-0.3.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:54cf2d11ea8e8a9d474a83137ea654a66b2ac7ea26f615ef4498b9e3fb5091f1"}, + {file = "duckdb-0.3.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:de8762917c1349c1517487500d5975c2788f3544b82ae341d79984eaa836e20a"}, + {file = "duckdb-0.3.4-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:60a163e65a1afdf410b2b9cbecd124875a53e53ad9271bdd66ed98ae42034778"}, + {file = "duckdb-0.3.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f552592ac977d368ea02c6a89b62373fb53a49a36aa8e7d3b3c89999ee420010"}, + {file = "duckdb-0.3.4-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:a1c355929e06f22f35a2d3a74c16721d7b2ecd35e5088bf9722f1ca574ff5a2b"}, + {file = "duckdb-0.3.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f5c65d6a4afa8c313c612d6bc92bca055f1cbcc81646640d5dde797c745b7876"}, + {file = "duckdb-0.3.4-cp39-cp39-win32.whl", hash = "sha256:79256b5521c3945f540dd4ccfcc7658d18e98a42ba619c5571eb075fc234b5a1"}, + {file = "duckdb-0.3.4-cp39-cp39-win_amd64.whl", hash = "sha256:f38cdf5a55a4a4f18c30d2ad73055d4531679fa3282cb08cacf2646f0a0150be"}, + {file = "duckdb-0.3.4.tar.gz", hash = "sha256:ab94cfc9e4c25f93d4a7be2063879475c308d771d53588bfd6198a89a8c2bcd2"}, +] +duckdb-engine = [ + {file = "duckdb_engine-0.1.11-py3-none-any.whl", hash = "sha256:8721775c71300b0b01350429e8727940e03a09e530c91b18861eb6b1d2d8cb1b"}, + {file = "duckdb_engine-0.1.11.tar.gz", hash = "sha256:d958fa32b2f239616416431d474d7a2135fd444b5001339cbe99b868b79ccf50"}, +] +filelock = [ + {file = "filelock-3.8.0-py3-none-any.whl", hash = "sha256:617eb4e5eedc82fc5f47b6d61e4d11cb837c56cb4544e39081099fa17ad109d4"}, + {file = "filelock-3.8.0.tar.gz", hash = "sha256:55447caa666f2198c5b6b13a26d2084d26fa5b115c00d065664b2124680c4edc"}, +] future = [ {file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"}, ] @@ -1300,13 +1464,22 @@ google-api-core = [ {file = "google-api-core-2.10.0.tar.gz", hash = "sha256:1d053734f14591939e7764e99c31253fed46bf2578da0dcd82821f17a6dd991c"}, {file = "google_api_core-2.10.0-py3-none-any.whl", hash = "sha256:325529859836a479244b0882c1a77320fd35cb108df2ec1232e3e908ea56eda4"}, ] -google-auth = [] +google-auth = [ + {file = "google-auth-2.11.0.tar.gz", hash = "sha256:ed65ecf9f681832298e29328e1ef0a3676e3732b2e56f41532d45f70a22de0fb"}, + {file = "google_auth-2.11.0-py2.py3-none-any.whl", hash = "sha256:be62acaae38d0049c21ca90f27a23847245c9f161ff54ede13af2cb6afecbac9"}, +] google-cloud-bigquery = [ {file = "google-cloud-bigquery-2.34.2.tar.gz", hash = "sha256:0eb882df30a00f5a1ef3d339a23a670230800b2ab249459591a7e685aad6714f"}, {file = "google_cloud_bigquery-2.34.2-py2.py3-none-any.whl", hash = "sha256:bd7de9e3126ea0975d1f5b25e69c28b644c69821c229327e64b38e44fb16497e"}, ] -google-cloud-bigquery-storage = [] -google-cloud-core = [] +google-cloud-bigquery-storage = [ + {file = "google-cloud-bigquery-storage-2.14.2.tar.gz", hash = "sha256:5540904a9ca42eec18af3833dd82263837ac44b76bd4db92ade192857dbea04c"}, + {file = "google_cloud_bigquery_storage-2.14.2-py2.py3-none-any.whl", hash = "sha256:6f654df1016f99f8b1beb5b5b47e669554c011ce29d095084c0736c52ebb024a"}, +] +google-cloud-core = [ + {file = "google-cloud-core-2.3.2.tar.gz", hash = "sha256:b9529ee7047fd8d4bf4a2182de619154240df17fbe60ead399078c1ae152af9a"}, + {file = "google_cloud_core-2.3.2-py2.py3-none-any.whl", hash = "sha256:8417acf6466be2fa85123441696c4badda48db314c607cf1e5d543fa8bdc22fe"}, +] google-crc32c = [ {file = "google-crc32c-1.5.0.tar.gz", hash = "sha256:89284716bc6a5a415d4eaa11b1726d2d60a0cd12aadf5439828353662ede9dd7"}, {file = "google_crc32c-1.5.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:596d1f98fc70232fcb6590c439f43b350cb762fb5d61ce7b0e9db4539654cc13"}, @@ -1377,8 +1550,14 @@ google-crc32c = [ {file = "google_crc32c-1.5.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:635f5d4dd18758a1fbd1049a8e8d2fee4ffed124462d837d1a02a0e009c3ab31"}, {file = "google_crc32c-1.5.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:c672d99a345849301784604bfeaeba4db0c7aae50b95be04dd651fd2a7310b93"}, ] -google-resumable-media = [] -googleapis-common-protos = [] +google-resumable-media = [ + {file = "google-resumable-media-2.3.3.tar.gz", hash = "sha256:27c52620bd364d1c8116eaac4ea2afcbfb81ae9139fb3199652fcac1724bfb6c"}, + {file = "google_resumable_media-2.3.3-py2.py3-none-any.whl", hash = "sha256:5b52774ea7a829a8cdaa8bd2d4c3d4bc660c91b30857ab2668d0eb830f4ea8c5"}, +] +googleapis-common-protos = [ + {file = "googleapis-common-protos-1.56.4.tar.gz", hash = "sha256:c25873c47279387cfdcbdafa36149887901d36202cb645a0e4f29686bf6e4417"}, + {file = "googleapis_common_protos-1.56.4-py2.py3-none-any.whl", hash = "sha256:8eb2cbc91b69feaf23e32452a7ae60e791e09967d81d4fcc7fc388182d1bd394"}, +] graphviz = [ {file = "graphviz-0.18.2-py3-none-any.whl", hash = "sha256:b0fda999966e75e974197c2a80946e9345f730837921a1180b4fd8397bea2799"}, {file = "graphviz-0.18.2.zip", hash = "sha256:b876ad68bc7b441f05dee6b36cc338c6b95ddb4e523bb7313c9f3dfe56fc342a"}, @@ -1495,7 +1674,10 @@ halo = [ {file = "halo-0.0.31-py2-none-any.whl", hash = "sha256:5350488fb7d2aa7c31a1344120cee67a872901ce8858f60da7946cef96c208ab"}, {file = "halo-0.0.31.tar.gz", hash = "sha256:7b67a3521ee91d53b7152d4ee3452811e1d2a6321975137762eb3d70063cc9d6"}, ] -identify = [] +identify = [ + {file = "identify-2.5.3-py2.py3-none-any.whl", hash = "sha256:25851c8c1370effb22aaa3c987b30449e9ff0cece408f810ae6ce408fdd20893"}, + {file = "identify-2.5.3.tar.gz", hash = "sha256:887e7b91a1be152b0d46bbf072130235a8117392b9f1828446079a816a05ef44"}, +] idna = [ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, @@ -1504,7 +1686,10 @@ iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] -jinja2 = [] +jinja2 = [ + {file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, + {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, +] jsonschema = [ {file = "jsonschema-3.2.0-py2.py3-none-any.whl", hash = "sha256:4e5b3cf8216f577bee9ce139cbe72eca3ea4f292ec60928ff24758ce626cd163"}, {file = "jsonschema-3.2.0.tar.gz", hash = "sha256:c8a85b28d377cc7737e46e2d9f2b4f44ee3c0e1deac6bf46ddefc7187d30797a"}, @@ -1610,8 +1795,40 @@ more-itertools = [ moz-sql-parser = [ {file = "moz-sql-parser-4.40.21126.tar.gz", hash = "sha256:b3d37cc8ff118d86009aa12646791549537ec0ae8ac312efd4641289c8eee080"}, ] -nodeenv = [] -numpy = [] +nodeenv = [ + {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, + {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, +] +numpy = [ + {file = "numpy-1.23.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e603ca1fb47b913942f3e660a15e55a9ebca906857edfea476ae5f0fe9b457d5"}, + {file = "numpy-1.23.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:633679a472934b1c20a12ed0c9a6c9eb167fbb4cb89031939bfd03dd9dbc62b8"}, + {file = "numpy-1.23.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:17e5226674f6ea79e14e3b91bfbc153fdf3ac13f5cc54ee7bc8fdbe820a32da0"}, + {file = "numpy-1.23.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bdc02c0235b261925102b1bd586579b7158e9d0d07ecb61148a1799214a4afd5"}, + {file = "numpy-1.23.2-cp310-cp310-win32.whl", hash = "sha256:df28dda02c9328e122661f399f7655cdcbcf22ea42daa3650a26bce08a187450"}, + {file = "numpy-1.23.2-cp310-cp310-win_amd64.whl", hash = "sha256:8ebf7e194b89bc66b78475bd3624d92980fca4e5bb86dda08d677d786fefc414"}, + {file = "numpy-1.23.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:dc76bca1ca98f4b122114435f83f1fcf3c0fe48e4e6f660e07996abf2f53903c"}, + {file = "numpy-1.23.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ecfdd68d334a6b97472ed032b5b37a30d8217c097acfff15e8452c710e775524"}, + {file = "numpy-1.23.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5593f67e66dea4e237f5af998d31a43e447786b2154ba1ad833676c788f37cde"}, + {file = "numpy-1.23.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac987b35df8c2a2eab495ee206658117e9ce867acf3ccb376a19e83070e69418"}, + {file = "numpy-1.23.2-cp311-cp311-win32.whl", hash = "sha256:d98addfd3c8728ee8b2c49126f3c44c703e2b005d4a95998e2167af176a9e722"}, + {file = "numpy-1.23.2-cp311-cp311-win_amd64.whl", hash = "sha256:8ecb818231afe5f0f568c81f12ce50f2b828ff2b27487520d85eb44c71313b9e"}, + {file = "numpy-1.23.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:909c56c4d4341ec8315291a105169d8aae732cfb4c250fbc375a1efb7a844f8f"}, + {file = "numpy-1.23.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8247f01c4721479e482cc2f9f7d973f3f47810cbc8c65e38fd1bbd3141cc9842"}, + {file = "numpy-1.23.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b8b97a8a87cadcd3f94659b4ef6ec056261fa1e1c3317f4193ac231d4df70215"}, + {file = "numpy-1.23.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bd5b7ccae24e3d8501ee5563e82febc1771e73bd268eef82a1e8d2b4d556ae66"}, + {file = "numpy-1.23.2-cp38-cp38-win32.whl", hash = "sha256:9b83d48e464f393d46e8dd8171687394d39bc5abfe2978896b77dc2604e8635d"}, + {file = "numpy-1.23.2-cp38-cp38-win_amd64.whl", hash = "sha256:dec198619b7dbd6db58603cd256e092bcadef22a796f778bf87f8592b468441d"}, + {file = "numpy-1.23.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4f41f5bf20d9a521f8cab3a34557cd77b6f205ab2116651f12959714494268b0"}, + {file = "numpy-1.23.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:806cc25d5c43e240db709875e947076b2826f47c2c340a5a2f36da5bb10c58d6"}, + {file = "numpy-1.23.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f9d84a24889ebb4c641a9b99e54adb8cab50972f0166a3abc14c3b93163f074"}, + {file = "numpy-1.23.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c403c81bb8ffb1c993d0165a11493fd4bf1353d258f6997b3ee288b0a48fce77"}, + {file = "numpy-1.23.2-cp39-cp39-win32.whl", hash = "sha256:cf8c6aed12a935abf2e290860af8e77b26a042eb7f2582ff83dc7ed5f963340c"}, + {file = "numpy-1.23.2-cp39-cp39-win_amd64.whl", hash = "sha256:5e28cd64624dc2354a349152599e55308eb6ca95a13ce6a7d5679ebff2962913"}, + {file = "numpy-1.23.2-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:806970e69106556d1dd200e26647e9bee5e2b3f1814f9da104a943e8d548ca38"}, + {file = "numpy-1.23.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bd879d3ca4b6f39b7770829f73278b7c5e248c91d538aab1e506c628353e47f"}, + {file = "numpy-1.23.2-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:be6b350dfbc7f708d9d853663772a9310783ea58f6035eec649fb9c4371b5389"}, + {file = "numpy-1.23.2.tar.gz", hash = "sha256:b78d00e48261fbbd04aa0d7427cf78d18401ee0abd89c7559bbf422e5b1c7d01"}, +] oscrypto = [ {file = "oscrypto-1.3.0-py2.py3-none-any.whl", hash = "sha256:2b2f1d2d42ec152ca90ccb5682f3e051fb55986e1b170ebde472b133713e7085"}, {file = "oscrypto-1.3.0.tar.gz", hash = "sha256:6f5fef59cb5b3708321db7cca56aed8ad7e662853351e7991fcf60ec606d47a4"}, @@ -1621,38 +1838,70 @@ packaging = [ {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, ] pandas = [ - {file = "pandas-1.2.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c601c6fdebc729df4438ec1f62275d6136a0dd14d332fc0e8ce3f7d2aadb4dd6"}, - {file = "pandas-1.2.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:8d4c74177c26aadcfb4fd1de6c1c43c2bf822b3e0fc7a9b409eeaf84b3e92aaa"}, - {file = "pandas-1.2.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:b730add5267f873b3383c18cac4df2527ac4f0f0eed1c6cf37fcb437e25cf558"}, - {file = "pandas-1.2.4-cp37-cp37m-win32.whl", hash = "sha256:2cb7e8f4f152f27dc93f30b5c7a98f6c748601ea65da359af734dd0cf3fa733f"}, - {file = "pandas-1.2.4-cp37-cp37m-win_amd64.whl", hash = "sha256:2111c25e69fa9365ba80bbf4f959400054b2771ac5d041ed19415a8b488dc70a"}, - {file = "pandas-1.2.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:167693a80abc8eb28051fbd184c1b7afd13ce2c727a5af47b048f1ea3afefff4"}, - {file = "pandas-1.2.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:612add929bf3ba9d27b436cc8853f5acc337242d6b584203f207e364bb46cb12"}, - {file = "pandas-1.2.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:971e2a414fce20cc5331fe791153513d076814d30a60cd7348466943e6e909e4"}, - {file = "pandas-1.2.4-cp38-cp38-win32.whl", hash = "sha256:68d7baa80c74aaacbed597265ca2308f017859123231542ff8a5266d489e1858"}, - {file = "pandas-1.2.4-cp38-cp38-win_amd64.whl", hash = "sha256:bd659c11a4578af740782288cac141a322057a2e36920016e0fc7b25c5a4b686"}, - {file = "pandas-1.2.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9db70ffa8b280bb4de83f9739d514cd0735825e79eef3a61d312420b9f16b758"}, - {file = "pandas-1.2.4-cp39-cp39-manylinux1_i686.whl", hash = "sha256:298f0553fd3ba8e002c4070a723a59cdb28eda579f3e243bc2ee397773f5398b"}, - {file = "pandas-1.2.4-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:52d2472acbb8a56819a87aafdb8b5b6d2b3386e15c95bde56b281882529a7ded"}, - {file = "pandas-1.2.4-cp39-cp39-win32.whl", hash = "sha256:d0877407359811f7b853b548a614aacd7dea83b0c0c84620a9a643f180060950"}, - {file = "pandas-1.2.4-cp39-cp39-win_amd64.whl", hash = "sha256:2b063d41803b6a19703b845609c0b700913593de067b552a8b24dd8eeb8c9895"}, - {file = "pandas-1.2.4.tar.gz", hash = "sha256:649ecab692fade3cbfcf967ff936496b0cfba0af00a55dfaacd82bdda5cb2279"}, + {file = "pandas-1.5.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:0d8d7433d19bfa33f11c92ad9997f15a902bda4f5ad3a4814a21d2e910894484"}, + {file = "pandas-1.5.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5cc47f2ebaa20ef96ae72ee082f9e101b3dfbf74f0e62c7a12c0b075a683f03c"}, + {file = "pandas-1.5.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e8e5edf97d8793f51d258c07c629bd49d271d536ce15d66ac00ceda5c150eb3"}, + {file = "pandas-1.5.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:41aec9f87455306496d4486df07c1b98c15569c714be2dd552a6124cd9fda88f"}, + {file = "pandas-1.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c76f1d104844c5360c21d2ef0e1a8b2ccf8b8ebb40788475e255b9462e32b2be"}, + {file = "pandas-1.5.0-cp310-cp310-win_amd64.whl", hash = "sha256:1642fc6138b4e45d57a12c1b464a01a6d868c0148996af23f72dde8d12486bbc"}, + {file = "pandas-1.5.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:171cef540bfcec52257077816a4dbbac152acdb8236ba11d3196ae02bf0959d8"}, + {file = "pandas-1.5.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a68a9b9754efff364b0c5ee5b0f18e15ca640c01afe605d12ba8b239ca304d6b"}, + {file = "pandas-1.5.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:86d87279ebc5bc20848b4ceb619073490037323f80f515e0ec891c80abad958a"}, + {file = "pandas-1.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:207d63ac851e60ec57458814613ef4b3b6a5e9f0b33c57623ba2bf8126c311f8"}, + {file = "pandas-1.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e252a9e49b233ff96e2815c67c29702ac3a062098d80a170c506dff3470fd060"}, + {file = "pandas-1.5.0-cp311-cp311-win_amd64.whl", hash = "sha256:de34636e2dc04e8ac2136a8d3c2051fd56ebe9fd6cd185581259330649e73ca9"}, + {file = "pandas-1.5.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:1d34b1f43d9e3f4aea056ba251f6e9b143055ebe101ed04c847b41bb0bb4a989"}, + {file = "pandas-1.5.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1b82ccc7b093e0a93f8dffd97a542646a3e026817140e2c01266aaef5fdde11b"}, + {file = "pandas-1.5.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4e30a31039574d96f3d683df34ccb50bb435426ad65793e42a613786901f6761"}, + {file = "pandas-1.5.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:62e61003411382e20d7c2aec1ee8d7c86c8b9cf46290993dd8a0a3be44daeb38"}, + {file = "pandas-1.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc987f7717e53d372f586323fff441263204128a1ead053c1b98d7288f836ac9"}, + {file = "pandas-1.5.0-cp38-cp38-win32.whl", hash = "sha256:e178ce2d7e3b934cf8d01dc2d48d04d67cb0abfaffdcc8aa6271fd5a436f39c8"}, + {file = "pandas-1.5.0-cp38-cp38-win_amd64.whl", hash = "sha256:33a9d9e21ab2d91e2ab6e83598419ea6a664efd4c639606b299aae8097c1c94f"}, + {file = "pandas-1.5.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:73844e247a7b7dac2daa9df7339ecf1fcf1dfb8cbfd11e3ffe9819ae6c31c515"}, + {file = "pandas-1.5.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:e9c5049333c5bebf993033f4bf807d163e30e8fada06e1da7fa9db86e2392009"}, + {file = "pandas-1.5.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:85a516a7f6723ca1528f03f7851fa8d0360d1d6121cf15128b290cf79b8a7f6a"}, + {file = "pandas-1.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:947ed9f896ee61adbe61829a7ae1ade493c5a28c66366ec1de85c0642009faac"}, + {file = "pandas-1.5.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c7f38d91f21937fe2bec9449570d7bf36ad7136227ef43b321194ec249e2149d"}, + {file = "pandas-1.5.0-cp39-cp39-win32.whl", hash = "sha256:2504c032f221ef9e4a289f5e46a42b76f5e087ecb67d62e342ccbba95a32a488"}, + {file = "pandas-1.5.0-cp39-cp39-win_amd64.whl", hash = "sha256:8a4fc04838615bf0a8d3a03ed68197f358054f0df61f390bcc64fbe39e3d71ec"}, + {file = "pandas-1.5.0.tar.gz", hash = "sha256:3ee61b881d2f64dd90c356eb4a4a4de75376586cd3c9341c6c0fcaae18d52977"}, ] pathspec = [ {file = "pathspec-0.10.1-py3-none-any.whl", hash = "sha256:46846318467efc4556ccfd27816e004270a9eeeeb4d062ce5e6fc7a87c573f93"}, {file = "pathspec-0.10.1.tar.gz", hash = "sha256:7ace6161b621d31e7902eb6b5ae148d12cfd23f4a249b9ffb6b9fee12084323d"}, ] -platformdirs = [] +platformdirs = [ + {file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"}, + {file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"}, +] pluggy = [ {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, ] -pre-commit = [] +pre-commit = [ + {file = "pre_commit-2.20.0-py2.py3-none-any.whl", hash = "sha256:51a5ba7c480ae8072ecdb6933df22d2f812dc897d5fe848778116129a681aac7"}, + {file = "pre_commit-2.20.0.tar.gz", hash = "sha256:a978dac7bc9ec0bcee55c18a277d553b0f419d259dadb4b9418ff2d00eb43959"}, +] proto-plus = [ {file = "proto-plus-1.22.1.tar.gz", hash = "sha256:6c7dfd122dfef8019ff654746be4f5b1d9c80bba787fe9611b508dd88be3a2fa"}, {file = "proto_plus-1.22.1-py3-none-any.whl", hash = "sha256:ea8982669a23c379f74495bc48e3dcb47c822c484ce8ee1d1d7beb339d4e34c5"}, ] -protobuf = [] +protobuf = [ + {file = "protobuf-4.21.5-cp310-abi3-win32.whl", hash = "sha256:5310cbe761e87f0c1decce019d23f2101521d4dfff46034f8a12a53546036ec7"}, + {file = "protobuf-4.21.5-cp310-abi3-win_amd64.whl", hash = "sha256:e5c5a2886ae48d22a9d32fbb9b6636a089af3cd26b706750258ce1ca96cc0116"}, + {file = "protobuf-4.21.5-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:ee04f5823ed98bb9a8c3b1dc503c49515e0172650875c3f76e225b223793a1f2"}, + {file = "protobuf-4.21.5-cp37-abi3-manylinux2014_aarch64.whl", hash = "sha256:b04484d6f42f48c57dd2737a72692f4c6987529cdd148fb5b8e5f616862a2e37"}, + {file = "protobuf-4.21.5-cp37-abi3-manylinux2014_x86_64.whl", hash = "sha256:5e0b272217aad8971763960238c1a1e6a65d50ef7824e23300da97569a251c55"}, + {file = "protobuf-4.21.5-cp37-cp37m-win32.whl", hash = "sha256:5eb0724615e90075f1d763983e708e1cef08e66b1891d8b8b6c33bc3b2f1a02b"}, + {file = "protobuf-4.21.5-cp37-cp37m-win_amd64.whl", hash = "sha256:011c0f267e85f5d73750b6c25f0155d5db1e9443cd3590ab669a6221dd8fcdb0"}, + {file = "protobuf-4.21.5-cp38-cp38-win32.whl", hash = "sha256:7b6f22463e2d1053d03058b7b4ceca6e4ed4c14f8c286c32824df751137bf8e7"}, + {file = "protobuf-4.21.5-cp38-cp38-win_amd64.whl", hash = "sha256:b52e7a522911a40445a5f588bd5b5e584291bfc5545e09b7060685e4b2ff814f"}, + {file = "protobuf-4.21.5-cp39-cp39-win32.whl", hash = "sha256:a7faa62b183d6a928e3daffd06af843b4287d16ef6e40f331575ecd236a7974d"}, + {file = "protobuf-4.21.5-cp39-cp39-win_amd64.whl", hash = "sha256:5e0ce02418ef03d7657a420ae8fd6fec4995ac713a3cb09164e95f694dbcf085"}, + {file = "protobuf-4.21.5-py2.py3-none-any.whl", hash = "sha256:bf711b451212dc5b0fa45ae7dada07d8e71a4b0ff0bc8e4783ee145f47ac4f82"}, + {file = "protobuf-4.21.5-py3-none-any.whl", hash = "sha256:3ec6f5b37935406bb9df9b277e79f8ed81d697146e07ef2ba8a5a272fb24b2c9"}, + {file = "protobuf-4.21.5.tar.gz", hash = "sha256:eb1106e87e095628e96884a877a51cdb90087106ee693925ec0a300468a9be3a"}, +] psycopg2 = [ {file = "psycopg2-2.9.3-cp310-cp310-win32.whl", hash = "sha256:083707a696e5e1c330af2508d8fab36f9700b26621ccbcb538abe22e15485362"}, {file = "psycopg2-2.9.3-cp310-cp310-win_amd64.whl", hash = "sha256:d3ca6421b942f60c008f81a3541e8faf6865a28d5a9b48544b0ee4f40cac7fca"}, @@ -1671,42 +1920,34 @@ py = [ {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, ] pyarrow = [ - {file = "pyarrow-6.0.1-cp310-cp310-macosx_10_13_universal2.whl", hash = "sha256:c80d2436294a07f9cc54852aa1cef034b6f9c97d29235c4bd53bbf52e24f1ebf"}, - {file = "pyarrow-6.0.1-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:f150b4f222d0ba397388908725692232345adaa8e58ad543ca00f03c7234ae7b"}, - {file = "pyarrow-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c3a727642c1283dcb44728f0d0a00f8864b171e31c835f4b8def07e3fa8f5c73"}, - {file = "pyarrow-6.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d29605727865177918e806d855fd8404b6242bf1e56ade0a0023cd4fe5f7f841"}, - {file = "pyarrow-6.0.1-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:b63b54dd0bada05fff76c15b233f9322de0e6947071b7871ec45024e16045aeb"}, - {file = "pyarrow-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9e90e75cb11e61ffeffb374f1db7c4788f1df0cb269596bf86c473155294958d"}, - {file = "pyarrow-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f4f3db1da51db4cfbafab3066a01b01578884206dced9f505da950d9ed4402d"}, - {file = "pyarrow-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:2523f87bd36877123fc8c4813f60d298722143ead73e907690a87e8557114693"}, - {file = "pyarrow-6.0.1-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:8f7d34efb9d667f9204b40ce91a77613c46691c24cd098e3b6986bd7401b8f06"}, - {file = "pyarrow-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e3c9184335da8faf08c0df95668ce9d778df3795ce4eec959f44908742900e10"}, - {file = "pyarrow-6.0.1-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:02baee816456a6e64486e587caaae2bf9f084fa3a891354ff18c3e945a1cb72f"}, - {file = "pyarrow-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:604782b1c744b24a55df80125991a7154fbdef60991eb3d02bfaed06d22f055e"}, - {file = "pyarrow-6.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fab8132193ae095c43b1e8d6d7f393451ac198de5aaf011c6b576b1442966fec"}, - {file = "pyarrow-6.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:31038366484e538608f43920a5e2957b8862a43aa49438814619b527f50ec127"}, - {file = "pyarrow-6.0.1-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:632bea00c2fbe2da5d29ff1698fec312ed3aabfb548f06100144e1907e22093a"}, - {file = "pyarrow-6.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dc03c875e5d68b0d0143f94c438add3ab3c2411ade2748423a9c24608fea571e"}, - {file = "pyarrow-6.0.1-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1cd4de317df01679e538004123d6d7bc325d73bad5c6bbc3d5f8aa2280408869"}, - {file = "pyarrow-6.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e77b1f7c6c08ec319b7882c1a7c7304731530923532b3243060e6e64c456cf34"}, - {file = "pyarrow-6.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a424fd9a3253d0322d53be7bbb20b5b01511706a61efadcf37f416da325e3d48"}, - {file = "pyarrow-6.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:c958cf3a4a9eee09e1063c02b89e882d19c61b3a2ce6cbd55191a6f45ed5004b"}, - {file = "pyarrow-6.0.1-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:0e0ef24b316c544f4bb56f5c376129097df3739e665feca0eb567f716d45c55a"}, - {file = "pyarrow-6.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2c13ec3b26b3b069d673c5fa3a0c70c38f0d5c94686ac5dbc9d7e7d24040f812"}, - {file = "pyarrow-6.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:71891049dc58039a9523e1cb0d921be001dacb2b327fa7b62a35b96a3aad9f0d"}, - {file = "pyarrow-6.0.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:943141dd8cca6c5722552a0b11a3c2e791cdf85f1768dea8170b0a8a7e824ff9"}, - {file = "pyarrow-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fd077c06061b8fa8fdf91591a4270e368f63cf73c6ab56924d3b64efa96a873"}, - {file = "pyarrow-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5308f4bb770b48e07c8cff36cf6a4452862e8ce9492428ad5581d846420b3884"}, - {file = "pyarrow-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:cde4f711cd9476d4da18128c3a40cb529b6b7d2679aee6e0576212547530fef1"}, - {file = "pyarrow-6.0.1-cp39-cp39-macosx_10_13_universal2.whl", hash = "sha256:b8628269bd9289cae0ea668f5900451043252fe3666667f614e140084dd31aac"}, - {file = "pyarrow-6.0.1-cp39-cp39-macosx_10_13_x86_64.whl", hash = "sha256:981ccdf4f2696550733e18da882469893d2f33f55f3cbeb6a90f81741cbf67aa"}, - {file = "pyarrow-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:954326b426eec6e31ff55209f8840b54d788420e96c4005aaa7beed1fe60b42d"}, - {file = "pyarrow-6.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6b6483bf6b61fe9a046235e4ad4d9286b707607878d7dbdc2eb85a6ec4090baf"}, - {file = "pyarrow-6.0.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7ecad40a1d4e0104cd87757a403f36850261e7a989cf9e4cb3e30420bbbd1092"}, - {file = "pyarrow-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:04c752fb41921d0064568a15a87dbb0222cfbe9040d4b2c1b306fe6e0a453530"}, - {file = "pyarrow-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:725d3fe49dfe392ff14a8ae6a75b230a60e8985f2b621b18cfa912fe02b65f1a"}, - {file = "pyarrow-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:2403c8af207262ce8e2bc1a9d19313941fd2e424f1cb3c4b749c17efe1fd699a"}, - {file = "pyarrow-6.0.1.tar.gz", hash = "sha256:423990d56cd8f12283b67367d48e142739b789085185018eb03d05087c3c8d43"}, + {file = "pyarrow-5.0.0-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:e9ec80f4a77057498cf4c5965389e42e7f6a618b6859e6dd615e57505c9167a6"}, + {file = "pyarrow-5.0.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:b1453c2411b5062ba6bf6832dbc4df211ad625f678c623a2ee177aee158f199b"}, + {file = "pyarrow-5.0.0-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:9e04d3621b9f2f23898eed0d044203f66c156d880f02c5534a7f9947ebb1a4af"}, + {file = "pyarrow-5.0.0-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:64f30aa6b28b666a925d11c239344741850eb97c29d3aa0f7187918cf82494f7"}, + {file = "pyarrow-5.0.0-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:99c8b0f7e2ce2541dd4c0c0101d9944bb8e592ae3295fe7a2f290ab99222666d"}, + {file = "pyarrow-5.0.0-cp36-cp36m-win_amd64.whl", hash = "sha256:456a4488ae810a0569d1adf87dbc522bcc9a0e4a8d1809b934ca28c163d8edce"}, + {file = "pyarrow-5.0.0-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:c5493d2414d0d690a738aac8dd6d38518d1f9b870e52e24f89d8d7eb3afd4161"}, + {file = "pyarrow-5.0.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:1832709281efefa4f199c639e9f429678286329860188e53beeda71750775923"}, + {file = "pyarrow-5.0.0-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:b6387d2058d95fa48ccfedea810a768187affb62f4a3ef6595fa30bf9d1a65cf"}, + {file = "pyarrow-5.0.0-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:bbe2e439bec2618c74a3bb259700c8a7353dc2ea0c5a62686b6cf04a50ab1e0d"}, + {file = "pyarrow-5.0.0-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:5c0d1b68e67bb334a5af0cecdf9b6a702aaa4cc259c5cbb71b25bbed40fcedaf"}, + {file = "pyarrow-5.0.0-cp37-cp37m-win_amd64.whl", hash = "sha256:6e937ce4a40ea0cc7896faff96adecadd4485beb53fbf510b46858e29b2e75ae"}, + {file = "pyarrow-5.0.0-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:7560332e5846f0e7830b377c14c93624e24a17f91c98f0b25dafb0ca1ea6ba02"}, + {file = "pyarrow-5.0.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:53e550dec60d1ab86cba3afa1719dc179a8bc9632a0e50d9fe91499cf0a7f2bc"}, + {file = "pyarrow-5.0.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2d26186ca9748a1fb89ae6c1fa04fb343a4279b53f118734ea8096f15d66c820"}, + {file = "pyarrow-5.0.0-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:7c4edd2bacee3eea6c8c28bddb02347f9d41a55ec9692c71c6de6e47c62a7f0d"}, + {file = "pyarrow-5.0.0-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:601b0aabd6fb066429e706282934d4d8d38f53bdb8d82da9576be49f07eedf5c"}, + {file = "pyarrow-5.0.0-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:ff21711f6ff3b0bc90abc8ca8169e676faeb2401ddc1a0bc1c7dc181708a3406"}, + {file = "pyarrow-5.0.0-cp38-cp38-win_amd64.whl", hash = "sha256:ed135a99975380c27077f9d0e210aea8618ed9fadcec0e71f8a3190939557afe"}, + {file = "pyarrow-5.0.0-cp39-cp39-macosx_10_13_universal2.whl", hash = "sha256:6e1f0e4374061116f40e541408a8a170c170d0a070b788717e18165ebfdd2a54"}, + {file = "pyarrow-5.0.0-cp39-cp39-macosx_10_13_x86_64.whl", hash = "sha256:4341ac0f552dc04c450751e049976940c7f4f8f2dae03685cc465ebe0a61e231"}, + {file = "pyarrow-5.0.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c3fc856f107ca2fb3c9391d7ea33bbb33f3a1c2b4a0e2b41f7525c626214cc03"}, + {file = "pyarrow-5.0.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:357605665fbefb573d40939b13a684c2490b6ed1ab4a5de8dd246db4ab02e5a4"}, + {file = "pyarrow-5.0.0-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f4db312e9ba80e730cefcae0a05b63ea5befc7634c28df56682b628ad8e1c25c"}, + {file = "pyarrow-5.0.0-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:1d9485741e497ccc516cb0a0c8f56e22be55aea815be185c3f9a681323b0e614"}, + {file = "pyarrow-5.0.0-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:b3115df938b8d7a7372911a3cb3904196194bcea8bb48911b4b3eafee3ab8d90"}, + {file = "pyarrow-5.0.0-cp39-cp39-win_amd64.whl", hash = "sha256:4d8adda1892ef4553c4804af7f67cce484f4d6371564e2d8374b8e2bc85293e2"}, + {file = "pyarrow-5.0.0.tar.gz", hash = "sha256:24e64ea33eed07441cc0e80c949e3a1b48211a1add8953268391d250f4d39922"}, ] pyasn1 = [ {file = "pyasn1-0.4.8-py2.4.egg", hash = "sha256:fec3e9d8e36808a28efb59b489e4528c10ad0f480e57dcc32b4de5c9d8c9fdf3"}, @@ -1745,7 +1986,38 @@ pycparser = [ pycron = [ {file = "pycron-3.0.0.tar.gz", hash = "sha256:b916044e3e8253d5409c68df3ac64a3472c4e608dab92f40e8f595e5d3acb3de"}, ] -pycryptodomex = [] +pycryptodomex = [ + {file = "pycryptodomex-3.15.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:6f5b6ba8aefd624834bc177a2ac292734996bb030f9d1b388e7504103b6fcddf"}, + {file = "pycryptodomex-3.15.0-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:4540904c09704b6f831059c0dfb38584acb82cb97b0125cd52688c1f1e3fffa6"}, + {file = "pycryptodomex-3.15.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:0fadb9f7fa3150577800eef35f62a8a24b9ddf1563ff060d9bd3af22d3952c8c"}, + {file = "pycryptodomex-3.15.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:fc9bc7a9b79fe5c750fc81a307052f8daabb709bdaabb0fb18fb136b66b653b5"}, + {file = "pycryptodomex-3.15.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:f8be976cec59b11f011f790b88aca67b4ea2bd286578d0bd3e31bcd19afcd3e4"}, + {file = "pycryptodomex-3.15.0-cp27-cp27m-manylinux2014_aarch64.whl", hash = "sha256:78d9621cf0ea35abf2d38fa2ca6d0634eab6c991a78373498ab149953787e5e5"}, + {file = "pycryptodomex-3.15.0-cp27-cp27m-win32.whl", hash = "sha256:b6306403228edde6e289f626a3908a2f7f67c344e712cf7c0a508bab3ad9e381"}, + {file = "pycryptodomex-3.15.0-cp27-cp27m-win_amd64.whl", hash = "sha256:48697790203909fab02a33226fda546604f4e2653f9d47bc5d3eb40879fa7c64"}, + {file = "pycryptodomex-3.15.0-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:18e2ab4813883ae63396c0ffe50b13554b32bb69ec56f0afaf052e7a7ae0d55b"}, + {file = "pycryptodomex-3.15.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:3709f13ca3852b0b07fc04a2c03b379189232b24007c466be0f605dd4723e9d4"}, + {file = "pycryptodomex-3.15.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:191e73bc84a8064ad1874dba0ebadedd7cce4dedee998549518f2c74a003b2e1"}, + {file = "pycryptodomex-3.15.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:e3164a18348bd53c69b4435ebfb4ac8a4076291ffa2a70b54f0c4b80c7834b1d"}, + {file = "pycryptodomex-3.15.0-cp27-cp27mu-manylinux2014_aarch64.whl", hash = "sha256:5676a132169a1c1a3712edf25250722ebc8c9102aa9abd814df063ca8362454f"}, + {file = "pycryptodomex-3.15.0-cp35-abi3-macosx_10_9_x86_64.whl", hash = "sha256:e2b12968522a0358b8917fc7b28865acac002f02f4c4c6020fcb264d76bfd06d"}, + {file = "pycryptodomex-3.15.0-cp35-abi3-manylinux1_i686.whl", hash = "sha256:e47bf8776a7e15576887f04314f5228c6527b99946e6638cf2f16da56d260cab"}, + {file = "pycryptodomex-3.15.0-cp35-abi3-manylinux1_x86_64.whl", hash = "sha256:996e1ba717077ce1e6d4849af7a1426f38b07b3d173b879e27d5e26d2e958beb"}, + {file = "pycryptodomex-3.15.0-cp35-abi3-manylinux2010_i686.whl", hash = "sha256:65204412d0c6a8e3c41e21e93a5e6054a74fea501afa03046a388cf042e3377a"}, + {file = "pycryptodomex-3.15.0-cp35-abi3-manylinux2010_x86_64.whl", hash = "sha256:dd452a5af7014e866206d41751886c9b4bf379a339fdf2dbfc7dd16c0fb4f8e0"}, + {file = "pycryptodomex-3.15.0-cp35-abi3-manylinux2014_aarch64.whl", hash = "sha256:b9279adc16e4b0f590ceff581f53a80179b02cba9056010d733eb4196134a870"}, + {file = "pycryptodomex-3.15.0-cp35-abi3-win32.whl", hash = "sha256:46b3f05f2f7ac7841053da4e0f69616929ca3c42f238c405f6c3df7759ad2780"}, + {file = "pycryptodomex-3.15.0-cp35-abi3-win_amd64.whl", hash = "sha256:8eecdf9cdc7343001d047f951b9cc805cd68cb6cd77b20ea46af5bffc5bd3dfb"}, + {file = "pycryptodomex-3.15.0-pp27-pypy_73-macosx_10_9_x86_64.whl", hash = "sha256:67e1e6a92151023ccdfcfbc0afb3314ad30080793b4c27956ea06ab1fb9bcd8a"}, + {file = "pycryptodomex-3.15.0-pp27-pypy_73-manylinux1_x86_64.whl", hash = "sha256:c4cb9cb492ea7dcdf222a8d19a1d09002798ea516aeae8877245206d27326d86"}, + {file = "pycryptodomex-3.15.0-pp27-pypy_73-manylinux2010_x86_64.whl", hash = "sha256:94c7b60e1f52e1a87715571327baea0733708ab4723346598beca4a3b6879794"}, + {file = "pycryptodomex-3.15.0-pp27-pypy_73-win32.whl", hash = "sha256:04cc393045a8f19dd110c975e30f38ed7ab3faf21ede415ea67afebd95a22380"}, + {file = "pycryptodomex-3.15.0-pp36-pypy36_pp73-macosx_10_9_x86_64.whl", hash = "sha256:0776bfaf2c48154ab54ea45392847c1283d2fcf64e232e85565f858baedfc1fa"}, + {file = "pycryptodomex-3.15.0-pp36-pypy36_pp73-manylinux1_x86_64.whl", hash = "sha256:463119d7d22d0fc04a0f9122e9d3e6121c6648bcb12a052b51bd1eed1b996aa2"}, + {file = "pycryptodomex-3.15.0-pp36-pypy36_pp73-manylinux2010_x86_64.whl", hash = "sha256:a07a64709e366c2041cd5cfbca592b43998bf4df88f7b0ca73dca37071ccf1bd"}, + {file = "pycryptodomex-3.15.0-pp36-pypy36_pp73-win32.whl", hash = "sha256:35a8f7afe1867118330e2e0e0bf759c409e28557fb1fc2fbb1c6c937297dbe9a"}, + {file = "pycryptodomex-3.15.0.tar.gz", hash = "sha256:7341f1bb2dadb0d1a0047f34c3a58208a92423cdbd3244d998e4b28df5eac0ed"}, +] pydantic = [ {file = "pydantic-1.10.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:221166d99726238f71adc4fa9f3e94063a10787574b966f86a774559e709ac5a"}, {file = "pydantic-1.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a90e85d95fd968cd7cae122e0d3e0e1f6613bc88c1ff3fe838ac9785ea4b1c4c"}, @@ -1784,9 +2056,18 @@ pydantic = [ {file = "pydantic-1.10.1-py3-none-any.whl", hash = "sha256:f8b10e59c035ff3dcc9791619d6e6c5141e0fa5cbe264e19e267b8d523b210bf"}, {file = "pydantic-1.10.1.tar.gz", hash = "sha256:d41bb80347a8a2d51fbd6f1748b42aca14541315878447ba159617544712f770"}, ] -pyjwt = [] -pyopenssl = [] -pyparsing = [] +pyjwt = [ + {file = "PyJWT-2.4.0-py3-none-any.whl", hash = "sha256:72d1d253f32dbd4f5c88eaf1fdc62f3a19f676ccbadb9dbc5d07e951b2b26daf"}, + {file = "PyJWT-2.4.0.tar.gz", hash = "sha256:d42908208c699b3b973cbeb01a969ba6a96c821eefb1c5bfe4c390c01d67abba"}, +] +pyopenssl = [ + {file = "pyOpenSSL-22.0.0-py2.py3-none-any.whl", hash = "sha256:ea252b38c87425b64116f808355e8da644ef9b07e429398bfece610f893ee2e0"}, + {file = "pyOpenSSL-22.0.0.tar.gz", hash = "sha256:660b1b1425aac4a1bea1d94168a85d99f0b3144c869dd4390d27629d0087f1bf"}, +] +pyparsing = [ + {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, + {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, +] pyrsistent = [ {file = "pyrsistent-0.18.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:df46c854f490f81210870e509818b729db4488e1f30f2a1ce1698b2295a878d1"}, {file = "pyrsistent-0.18.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d45866ececf4a5fff8742c25722da6d4c9e180daa7b405dc0a2a2790d668c26"}, @@ -1814,7 +2095,10 @@ pytest = [ {file = "pytest-7.1.3-py3-none-any.whl", hash = "sha256:1377bda3466d70b55e3f5cecfa55bb7cfcf219c7964629b967c37cf0bda818b7"}, {file = "pytest-7.1.3.tar.gz", hash = "sha256:4f365fec2dff9c1162f834d9f18af1ba13062db0c708bf7b946f8a5c76180c39"}, ] -pytest-mock = [] +pytest-mock = [ + {file = "pytest-mock-3.8.2.tar.gz", hash = "sha256:77f03f4554392558700295e05aed0b1096a20d4a60a4f3ddcde58b0c31c8fca2"}, + {file = "pytest_mock-3.8.2-py3-none-any.whl", hash = "sha256:8a9e226d6c0ef09fcf20c94eb3405c388af438a90f3e39687f84166da82d5948"}, +] python-dateutil = [ {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, @@ -1822,7 +2106,10 @@ python-dateutil = [ python-levenshtein = [ {file = "python-Levenshtein-0.12.2.tar.gz", hash = "sha256:dc2395fbd148a1ab31090dd113c366695934b9e85fe5a4b2a032745efd0346f6"}, ] -pytz = [] +pytz = [ + {file = "pytz-2022.2.1-py2.py3-none-any.whl", hash = "sha256:220f481bdafa09c3955dfbdddb7b57780e9a94f5127e35456a48589b9e0c0197"}, + {file = "pytz-2022.2.1.tar.gz", hash = "sha256:cea221417204f2d1a2aa03ddae3e867921971d0d76f14d87abb4414415bbdcf5"}, +] pyyaml = [ {file = "PyYAML-5.4.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922"}, {file = "PyYAML-5.4.1-cp27-cp27m-win32.whl", hash = "sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393"}, @@ -1854,14 +2141,21 @@ pyyaml = [ {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, ] -requests = [] -rsa = [] +requests = [ + {file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"}, + {file = "requests-2.28.1.tar.gz", hash = "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"}, +] +rsa = [ + {file = "rsa-4.9-py3-none-any.whl", hash = "sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7"}, + {file = "rsa-4.9.tar.gz", hash = "sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21"}, +] "ruamel.yaml" = [ {file = "ruamel.yaml-0.17.21-py3-none-any.whl", hash = "sha256:742b35d3d665023981bd6d16b3d24248ce5df75fdb4e2924e93a05c1f8b61ca7"}, {file = "ruamel.yaml-0.17.21.tar.gz", hash = "sha256:8b7ce697a2f212752a35c1ac414471dc16c424c9573be4926b56ff3f5d23b7af"}, ] "ruamel.yaml.clib" = [ {file = "ruamel.yaml.clib-0.2.6-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6e7be2c5bcb297f5b82fee9c665eb2eb7001d1050deaba8471842979293a80b0"}, + {file = "ruamel.yaml.clib-0.2.6-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:066f886bc90cc2ce44df8b5f7acfc6a7e2b2e672713f027136464492b0c34d7c"}, {file = "ruamel.yaml.clib-0.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:221eca6f35076c6ae472a531afa1c223b9c29377e62936f61bc8e6e8bdc5f9e7"}, {file = "ruamel.yaml.clib-0.2.6-cp310-cp310-win32.whl", hash = "sha256:1070ba9dd7f9370d0513d649420c3b362ac2d687fe78c6e888f5b12bf8bc7bee"}, {file = "ruamel.yaml.clib-0.2.6-cp310-cp310-win_amd64.whl", hash = "sha256:77df077d32921ad46f34816a9a16e6356d8100374579bc35e15bab5d4e9377de"}, @@ -1871,23 +2165,30 @@ rsa = [] {file = "ruamel.yaml.clib-0.2.6-cp35-cp35m-win_amd64.whl", hash = "sha256:de9c6b8a1ba52919ae919f3ae96abb72b994dd0350226e28f3686cb4f142165c"}, {file = "ruamel.yaml.clib-0.2.6-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d67f273097c368265a7b81e152e07fb90ed395df6e552b9fa858c6d2c9f42502"}, {file = "ruamel.yaml.clib-0.2.6-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:72a2b8b2ff0a627496aad76f37a652bcef400fd861721744201ef1b45199ab78"}, + {file = "ruamel.yaml.clib-0.2.6-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:d3c620a54748a3d4cf0bcfe623e388407c8e85a4b06b8188e126302bcab93ea8"}, {file = "ruamel.yaml.clib-0.2.6-cp36-cp36m-win32.whl", hash = "sha256:9efef4aab5353387b07f6b22ace0867032b900d8e91674b5d8ea9150db5cae94"}, {file = "ruamel.yaml.clib-0.2.6-cp36-cp36m-win_amd64.whl", hash = "sha256:846fc8336443106fe23f9b6d6b8c14a53d38cef9a375149d61f99d78782ea468"}, {file = "ruamel.yaml.clib-0.2.6-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0847201b767447fc33b9c235780d3aa90357d20dd6108b92be544427bea197dd"}, {file = "ruamel.yaml.clib-0.2.6-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:78988ed190206672da0f5d50c61afef8f67daa718d614377dcd5e3ed85ab4a99"}, + {file = "ruamel.yaml.clib-0.2.6-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:210c8fcfeff90514b7133010bf14e3bad652c8efde6b20e00c43854bf94fa5a6"}, {file = "ruamel.yaml.clib-0.2.6-cp37-cp37m-win32.whl", hash = "sha256:a49e0161897901d1ac9c4a79984b8410f450565bbad64dbfcbf76152743a0cdb"}, {file = "ruamel.yaml.clib-0.2.6-cp37-cp37m-win_amd64.whl", hash = "sha256:bf75d28fa071645c529b5474a550a44686821decebdd00e21127ef1fd566eabe"}, {file = "ruamel.yaml.clib-0.2.6-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:a32f8d81ea0c6173ab1b3da956869114cae53ba1e9f72374032e33ba3118c233"}, {file = "ruamel.yaml.clib-0.2.6-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7f7ecb53ae6848f959db6ae93bdff1740e651809780822270eab111500842a84"}, + {file = "ruamel.yaml.clib-0.2.6-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:61bc5e5ca632d95925907c569daa559ea194a4d16084ba86084be98ab1cec1c6"}, {file = "ruamel.yaml.clib-0.2.6-cp38-cp38-win32.whl", hash = "sha256:89221ec6d6026f8ae859c09b9718799fea22c0e8da8b766b0b2c9a9ba2db326b"}, {file = "ruamel.yaml.clib-0.2.6-cp38-cp38-win_amd64.whl", hash = "sha256:31ea73e564a7b5fbbe8188ab8b334393e06d997914a4e184975348f204790277"}, {file = "ruamel.yaml.clib-0.2.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:dc6a613d6c74eef5a14a214d433d06291526145431c3b964f5e16529b1842bed"}, {file = "ruamel.yaml.clib-0.2.6-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:1866cf2c284a03b9524a5cc00daca56d80057c5ce3cdc86a52020f4c720856f0"}, + {file = "ruamel.yaml.clib-0.2.6-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:1b4139a6ffbca8ef60fdaf9b33dec05143ba746a6f0ae0f9d11d38239211d335"}, {file = "ruamel.yaml.clib-0.2.6-cp39-cp39-win32.whl", hash = "sha256:3fb9575a5acd13031c57a62cc7823e5d2ff8bc3835ba4d94b921b4e6ee664104"}, {file = "ruamel.yaml.clib-0.2.6-cp39-cp39-win_amd64.whl", hash = "sha256:825d5fccef6da42f3c8eccd4281af399f21c02b32d98e113dbc631ea6a6ecbc7"}, {file = "ruamel.yaml.clib-0.2.6.tar.gz", hash = "sha256:4ff604ce439abb20794f05613c374759ce10e3595d1867764dd1ae675b85acbd"}, ] -rudder-sdk-python = [] +rudder-sdk-python = [ + {file = "rudder-sdk-python-1.0.5.tar.gz", hash = "sha256:fc222fdca9607ddcdb1c1921897acfe3a26385284b03b487528e0d81618d12da"}, + {file = "rudder_sdk_python-1.0.5-py2.py3-none-any.whl", hash = "sha256:5bc7167e37c260748a930027e7446bcb364e23bb3395046a0f996b347c473850"}, +] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, @@ -1964,7 +2265,10 @@ sqlalchemy = [ {file = "SQLAlchemy-1.4.27-cp39-cp39-win_amd64.whl", hash = "sha256:8dbe5f639e6d035778ebf700be6d573f82a13662c3c2c3aa0f1dba303b942806"}, {file = "SQLAlchemy-1.4.27.tar.gz", hash = "sha256:d768359daeb3a86644f3854c6659e4496a3e6bba2b4651ecc87ce7ad415b320c"}, ] -sqlalchemy-bigquery = [] +sqlalchemy-bigquery = [ + {file = "sqlalchemy-bigquery-1.4.4.tar.gz", hash = "sha256:0d4a5fe04723034812a14e849632230eabbab33ca5234c7cae563adfcc506518"}, + {file = "sqlalchemy_bigquery-1.4.4-py2.py3-none-any.whl", hash = "sha256:88f420dafb8119db08293e31cc18266c3158957efc64acb35d39ce79d1d4a32b"}, +] sqlalchemy-redshift = [ {file = "sqlalchemy-redshift-0.8.1.tar.gz", hash = "sha256:588bf1e54ca41a0411c2f8f4a3ca14026b637e867dfdabb60b3572319a5b1ce5"}, {file = "sqlalchemy_redshift-0.8.1-py2.py3-none-any.whl", hash = "sha256:22518011c50f2fbe7e06d804aec90b693175b540152dd4a2c8c7acd78618fafe"}, @@ -1980,6 +2284,9 @@ tabulate = [ termcolor = [ {file = "termcolor-1.1.0.tar.gz", hash = "sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"}, ] +thrift = [ + {file = "thrift-0.13.0.tar.gz", hash = "sha256:9af1c86bf73433afc6010ed376a6c6aca2b54099cc0d61895f640870a9ae7d89"}, +] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, @@ -1988,7 +2295,10 @@ tomli = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -typing-extensions = [] +typing-extensions = [ + {file = "typing_extensions-4.3.0-py3-none-any.whl", hash = "sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02"}, + {file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"}, +] update-checker = [ {file = "update_checker-0.18.0-py3-none-any.whl", hash = "sha256:cbba64760a36fe2640d80d85306e8fe82b6816659190993b7bdabadee4d4bbfd"}, {file = "update_checker-0.18.0.tar.gz", hash = "sha256:6a2d45bb4ac585884a6b03f9eade9161cedd9e8111545141e9aa9058932acb13"}, @@ -2001,4 +2311,6 @@ virtualenv = [ {file = "virtualenv-20.16.4-py3-none-any.whl", hash = "sha256:035ed57acce4ac35c82c9d8802202b0e71adac011a511ff650cbcf9635006a22"}, {file = "virtualenv-20.16.4.tar.gz", hash = "sha256:014f766e4134d0008dcaa1f95bafa0fb0f575795d07cae50b1bee514185d6782"}, ] -yamllint = [] +yamllint = [ + {file = "yamllint-1.27.1.tar.gz", hash = "sha256:e688324b58560ab68a1a3cff2c0a474e3fed371dfe8da5d1b9817b7df55039ce"}, +] diff --git a/pyproject.toml b/pyproject.toml index c1a3570794..3c71e18dc3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ SQLAlchemy = "^1.4.27" snowflake-sqlalchemy = "1.2.3" sqlalchemy-redshift = "0.8.1" numpy = ">=1.22.2" -pandas = "1.2.4" +pandas = "^1.3.0" Jinja2 = ">=2.11.3" PyYAML = "^5.4.1" snowflake-connector-python = ">=2.7.8" @@ -46,6 +46,7 @@ duckdb = "0.3.4" yamllint = "^1.26.3" click = ">=7.1.2" GitPython = "^3.1.27" +databricks-sql-connector = "2.0.3" [tool.poetry.dev-dependencies] pytest-mock = "^3.7.0"