diff --git a/sqlmesh/core/engine_adapter/athena.py b/sqlmesh/core/engine_adapter/athena.py index 338381549b..4d3a9050dc 100644 --- a/sqlmesh/core/engine_adapter/athena.py +++ b/sqlmesh/core/engine_adapter/athena.py @@ -19,7 +19,6 @@ SourceQuery, InsertOverwriteStrategy, ) - if t.TYPE_CHECKING: from sqlmesh.core._typing import SchemaName, TableName from sqlmesh.core.engine_adapter._typing import QueryOrDF @@ -78,10 +77,9 @@ def s3_warehouse_location_or_raise(self) -> str: @property def catalog_support(self) -> CatalogSupport: - # Athena has the concept of catalogs but the current catalog is set in the connection parameters with no way to query or change it after that - # It also cant create new catalogs, you have to configure them in AWS. Typically, catalogs that are not "awsdatacatalog" - # are pointers to the "awsdatacatalog" of other AWS accounts - return CatalogSupport.SINGLE_CATALOG_ONLY + # Athena supports querying and writing to multiple catalogs (e.g. awsdatacatalog and s3tablescatalog) + # without needing a SET CATALOG command. + return CatalogSupport.FULL_SUPPORT def create_state_table( self, @@ -105,6 +103,14 @@ def _get_data_objects( """ schema_name = to_schema(schema_name) schema = schema_name.db + catalog = schema_name.catalog + + # In Athena, information_schema queries spanning catalogs often fail with CATALOG_NOT_FOUND. + # We need to temporarily set the default catalog to the target catalog to execute this query successfully + # or use system views depending on exact driver support. By omitting the catalog from the table explicitly + # and setting it via connection, we ensure it maps to the correct AWS/S3 integration natively. + info_schema_tables = exp.table_("tables", db="information_schema", alias="t") + query = ( exp.select( exp.column("table_catalog").as_("catalog"), @@ -118,13 +124,31 @@ def _get_data_objects( .else_(exp.column("table_type", table="t")) .as_("type"), ) - .from_(exp.to_table("information_schema.tables", alias="t")) + .from_(info_schema_tables) .where(exp.column("table_schema", table="t").eq(schema)) ) if object_names: query = query.where(exp.column("table_name", table="t").isin(*object_names)) - df = self.fetchdf(query) + current_catalog = self.get_current_catalog() + + if catalog and catalog != self._default_catalog: + if current_catalog != catalog: + self.set_current_catalog(catalog) + + try: + df = self.fetchdf(query) + + # For queries that don't return the catalog in the result (some drivers/engines), + # fill it in if it's missing or empty and we explicitly queried for a specific catalog + if catalog and df is not None and not df.empty and "catalog" in df.columns: + df["catalog"] = df["catalog"].fillna(catalog) + # Replace empty strings with the catalog as well + df["catalog"] = df["catalog"].replace("", catalog) + + finally: + if catalog and catalog != self._default_catalog and current_catalog is not None and current_catalog != catalog: + self.set_current_catalog(current_catalog) return [ DataObject( @@ -136,22 +160,121 @@ def _get_data_objects( for row in df.itertuples() ] + def table_exists(self, table_name: TableName) -> bool: + from sqlmesh.core.engine_adapter.base import _get_data_object_cache_key + table = exp.to_table(table_name) + data_object_cache_key = _get_data_object_cache_key(table.catalog, table.db, table.name) + + if data_object_cache_key in self._data_object_cache: + logger.debug("Table existence cache hit: %s", data_object_cache_key) + return self._data_object_cache[data_object_cache_key] is not None + + try: + # We don't use DESCRIBE because it fails with "Unsupported ddl with 2 catalogs" + # for cross-catalog queries in Athena. + # And since table_exists isn't run with the set_catalog decorator (which sets QueryExecutionContext), + # we must fallback to a query that works with fully qualified names or + # uses the information_schema/limit 0. A limit 0 select works with fully qualified names in Athena. + self.execute(exp.select("1").from_(table).limit(0)) + return True + except Exception: + return False + def columns( self, table_name: TableName, include_pseudo_columns: bool = False ) -> t.Dict[str, exp.DataType]: table = exp.to_table(table_name) # note: the data_type column contains the full parameterized type, eg 'varchar(10)' + + catalog = table.catalog + + # Fetching column info across catalogs often fails in Athena (CATALOG_NOT_FOUND) + # So we strip the catalog and set the current catalog dynamically + info_schema_columns = exp.table_("columns", db="information_schema") + query = ( exp.select("column_name", "data_type") - .from_("information_schema.columns") + .from_(info_schema_columns) .where(exp.column("table_schema").eq(table.db), exp.column("table_name").eq(table.name)) .order_by("ordinal_position") ) - result = self.fetchdf(query, quote_identifiers=True) - return { - str(r.column_name): exp.DataType.build(str(r.data_type)) - for r in result.itertuples(index=False) - } + + current_catalog = self.get_current_catalog() + + if catalog and catalog != self._default_catalog: + if current_catalog != catalog: + self.set_current_catalog(catalog) + + try: + result = self.fetchdf(query, quote_identifiers=True) + return { + str(r.column_name): exp.DataType.build(str(r.data_type)) + for r in result.itertuples(index=False) + } + except Exception as e: + # If information_schema query fails, we fallback to DESCRIBE. + # But DESCRIBE with multiple catalogs fails in Athena, so we strip the catalog here + # and rely on the set_current_catalog mechanism (applied at the EngineAdapter method level) + # to set the catalog in the execution context. + describe_table = table.copy() + if catalog and catalog != self._default_catalog: + describe_table.set("catalog", None) + + try: + self.execute(exp.Describe(this=describe_table, kind="TABLE")) + + from sqlmesh.core.engine_adapter.base import _decoded_str + import itertools + describe_output = self.cursor.fetchall() + return { + # Note: MySQL returns the column type as bytes. + column_name: exp.DataType.build(_decoded_str(column_type), dialect=self.dialect) + for column_name, column_type, *_ in itertools.takewhile( + lambda t: not t[0].startswith("#"), + describe_output, + ) + if column_name and column_name.strip() and column_type and column_type.strip() + } + finally: + pass # context reset is handled in outer finally block + finally: + if catalog and catalog != self._default_catalog and current_catalog is not None and current_catalog != catalog: + self.set_current_catalog(current_catalog) + + def _drop_object( + self, + name: TableName | SchemaName, + exists: bool = True, + kind: str = "TABLE", + cascade: bool = False, + **drop_args: t.Any, + ) -> None: + if cascade and kind.upper() in self.SUPPORTED_DROP_CASCADE_OBJECT_KINDS: + drop_args["cascade"] = cascade + + target_table = exp.to_table(name).copy() + is_schema = kind.upper() == "SCHEMA" + catalog = target_table.db if is_schema else target_table.catalog + + if catalog and catalog != self._default_catalog: + if is_schema: + target_table.set("db", None) + else: + target_table.set("catalog", None) + + current_catalog = self.get_current_catalog() + if current_catalog != catalog: + self.set_current_catalog(catalog) + + try: + self.execute(exp.Drop(this=target_table, kind=kind, exists=exists, **drop_args)) + finally: + if current_catalog is not None and current_catalog != catalog: + self.set_current_catalog(current_catalog) + else: + self.execute(exp.Drop(this=target_table, kind=kind, exists=exists, **drop_args)) + + self._clear_data_object_cache(name) def _create_schema( self, @@ -161,11 +284,40 @@ def _create_schema( properties: t.List[exp.Expr], kind: str, ) -> None: + schema = to_schema(schema_name) + if location := self._table_location(table_properties=None, table=exp.to_table(schema_name)): # don't add extra LocationProperty's if one already exists if not any(p for p in properties if isinstance(p, exp.LocationProperty)): properties.append(location) + if schema.catalog: + target_schema = schema.copy() + catalog = target_schema.catalog + target_schema.set("catalog", None) + + current_catalog = self.get_current_catalog() + if current_catalog != catalog: + self.set_current_catalog(catalog) + + try: + self.execute( + exp.Create( + this=target_schema, + kind=kind, + exists=ignore_if_exists, + properties=exp.Properties(expressions=properties), + ) + ) + except Exception as e: + if not warn_on_error: + raise + logger.warning("Failed to create %s '%s': %s", kind.lower(), schema_name, e) + finally: + if current_catalog is not None and current_catalog != catalog: + self.set_current_catalog(current_catalog) + return + return super()._create_schema( schema_name=schema_name, ignore_if_exists=ignore_if_exists, @@ -174,6 +326,76 @@ def _create_schema( kind=kind, ) + def _get_temp_table( + self, table: TableName, table_only: bool = False, quoted: bool = True + ) -> exp.Table: + """ + Returns the name of the temp table that should be used for the given table name. + """ + from sqlmesh.utils import random_id + + table = t.cast(exp.Table, exp.to_table(table).copy()) + + # AWS S3 Tables (and Athena generally) prefer or require table names to start with a letter. + # S3 Tables specifically fail with: "The specified table name is not valid" if it starts with __temp_ + table.set( + "this", exp.to_identifier(f"temp_{table.name}_{random_id(short=True)}", quoted=quoted) + ) + + if table_only: + table.set("db", None) + table.set("catalog", None) + + return table + + def _create_table( + self, + table_name_or_schema: t.Union[exp.Schema, TableName], + expression: t.Optional[exp.Expr], + exists: bool = True, + replace: bool = False, + target_columns_to_types: t.Optional[t.Dict[str, exp.DataType]] = None, + table_description: t.Optional[str] = None, + column_descriptions: t.Optional[t.Dict[str, str]] = None, + table_kind: t.Optional[str] = None, + track_rows_processed: bool = True, + **kwargs: t.Any, + ) -> None: + table: exp.Table + if isinstance(table_name_or_schema, str): + table = exp.to_table(table_name_or_schema) + elif isinstance(table_name_or_schema, exp.Schema): + table = table_name_or_schema.this + else: + table = table_name_or_schema + + catalog = table.catalog + current_catalog = self.get_current_catalog() + + # For non-CTAS CREATE TABLE in a non-default catalog, the catalog is stripped by _build_create_table_exp. + # We need to set the query execution context here. + if not expression and catalog and catalog != self._default_catalog: + if current_catalog != catalog: + self.set_current_catalog(catalog) + + try: + super()._create_table( + table_name_or_schema=table_name_or_schema, + expression=expression, + exists=exists, + replace=replace, + target_columns_to_types=target_columns_to_types, + table_description=table_description, + column_descriptions=column_descriptions, + table_kind=table_kind, + track_rows_processed=track_rows_processed, + **kwargs, + ) + finally: + if not expression and catalog and catalog != self._default_catalog: + if current_catalog is not None and current_catalog != catalog: + self.set_current_catalog(current_catalog) + def _build_create_table_exp( self, table_name_or_schema: t.Union[exp.Schema, TableName], @@ -197,6 +419,11 @@ def _build_create_table_exp( else: table = table_name_or_schema + table_format = kwargs.pop("table_format", None) + if not table_format and table_properties and "table_format" in table_properties: + tf = table_properties.get("table_format") + table_format = tf.name if isinstance(tf, exp.Literal) else str(tf) + properties = self._build_table_properties_exp( table=table, expression=expression, @@ -205,10 +432,11 @@ def _build_create_table_exp( table_properties=table_properties, table_description=table_description, table_kind=table_kind, + table_format=table_format, **kwargs, ) - is_hive = self._table_type(kwargs.get("table_format", None)) == "hive" + is_hive = self._table_type(table_format) == "hive" # Filter any PARTITIONED BY properties from the main column list since they cant be specified in both places # ref: https://docs.aws.amazon.com/athena/latest/ug/partitions.html @@ -221,8 +449,20 @@ def _build_create_table_exp( ] table_name_or_schema.args["expressions"] = filtered_expressions + create_table = table_name_or_schema.copy() + + # When creating a table without AS SELECT, Athena fails with "Unsupported ddl with 2 catalogs" + # if a custom catalog like s3tablescatalog/supply is provided in the CREATE TABLE statement. + # It requires the catalog to be provided via QueryExecutionContext instead. + # The set_catalog decorator (which calls set_current_catalog) passes it to the QueryExecutionContext. + # But we also need to strip it from the generated CREATE TABLE statement. + # Note: We must strip the catalog from the table in the schema if table_name_or_schema is a schema. + target_table = create_table.this if isinstance(create_table, exp.Schema) else create_table + if not expression and target_table.catalog: + target_table.set("catalog", None) + return exp.Create( - this=table_name_or_schema, + this=create_table, kind=table_kind or "TABLE", replace=replace, exists=exists, @@ -247,17 +487,36 @@ def _build_table_properties_exp( **kwargs: t.Any, ) -> t.Optional[exp.Properties]: properties: t.List[exp.Expr] = [] - table_properties = table_properties or {} + table_properties = table_properties.copy() if table_properties else {} + + s3_table_prop = table_properties.pop("s3_table", None) + is_s3_table = False + if s3_table_prop is not None: + if isinstance(s3_table_prop, exp.Boolean): + is_s3_table = s3_table_prop.this + elif isinstance(s3_table_prop, exp.Literal): + is_s3_table = s3_table_prop.name.lower() in ("true", "1") + else: + is_s3_table = str(s3_table_prop).lower() in ("true", "1") + elif table and table.catalog and table.catalog.startswith("s3tablescatalog/"): + is_s3_table = True + + tf = table_properties.pop("table_format", None) + if not table_format and tf: + table_format = tf.name if isinstance(tf, exp.Literal) else str(tf) is_hive = self._table_type(table_format) == "hive" is_iceberg = not is_hive + if is_s3_table and is_hive: + raise SQLMeshError("Amazon S3 Tables only support the Iceberg format") + if is_hive and not expression: # Hive tables are CREATE EXTERNAL TABLE, Iceberg tables are CREATE TABLE # Unless it's a CTAS, those are always CREATE TABLE properties.append(exp.ExternalProperty()) - if table_format: + if table_format and not is_s3_table: properties.append( exp.Property(this=exp.var("table_type"), value=exp.Literal.string(table_format)) ) @@ -279,9 +538,30 @@ def _build_table_properties_exp( else: schema_expressions = partitioned_by - properties.append( - exp.PartitionedByProperty(this=exp.Schema(expressions=schema_expressions)) - ) + if is_hive: + properties.append( + exp.PartitionedByProperty(this=exp.Schema(expressions=schema_expressions)) + ) + else: + if is_s3_table and expression: + array_exprs = [] + for e in schema_expressions: + e_copy = e.copy() + e_copy.transform( + lambda n: n.name if isinstance(n, exp.Identifier) else n, copy=False + ) + expr_sql = e_copy.sql(dialect="athena") + array_exprs.append(exp.Literal.string(expr_sql)) + + properties.append( + exp.Property( + this=exp.var("partitioning"), value=exp.Array(expressions=array_exprs) + ) + ) + else: + properties.append( + exp.PartitionedByProperty(this=exp.Schema(expressions=schema_expressions)) + ) if clustered_by: # Athena itself supports CLUSTERED BY, via the syntax CLUSTERED BY (col) INTO BUCKETS @@ -293,13 +573,16 @@ def _build_table_properties_exp( if storage_format: if is_iceberg: - # TBLPROPERTIES('format'='parquet') - table_properties["format"] = exp.Literal.string(storage_format) + if not is_s3_table or storage_format.lower() == "parquet": + # TBLPROPERTIES('format'='parquet') + table_properties["format"] = exp.Literal.string(storage_format) + elif is_s3_table and storage_format.lower() != "parquet": + raise SQLMeshError("Amazon S3 Tables only support the PARQUET storage format") else: # STORED AS PARQUET properties.append(exp.FileFormatProperty(this=storage_format)) - if table and (location := self._table_location_or_raise(table_properties, table)): + if table and not is_s3_table and (location := self._table_location_or_raise(table_properties, table)): properties.append(location) if is_iceberg and expression: @@ -308,8 +591,28 @@ def _build_table_properties_exp( # ref: https://docs.aws.amazon.com/athena/latest/ug/create-table-as.html#ctas-table-properties properties.append(exp.Property(this=exp.var("is_external"), value="false")) - for name, value in table_properties.items(): - properties.append(exp.Property(this=exp.var(name), value=value)) + if not is_s3_table: + for name, value in table_properties.items(): + properties.append(exp.Property(this=exp.var(name), value=value)) + elif is_s3_table: + # According to AWS documentation for S3 Tables CTAS queries: + # "The `table_type` property defaults to `ICEBERG`, so you don't need to explicitly specify it" + # "If you don't specify a format, the system automatically uses `PARQUET`" + # We explicitly prevent all TBLPROPERTIES because Athena doesn't support them during CTAS + if expression: + # the only property allowed in CTAS for S3 Tables is 'format' (which we captured above) + format_val = table_properties.pop("format", exp.Literal.string("PARQUET")) + # Ensure it's uppercase PARQUET for S3 Tables just to be safe as per AWS examples + if isinstance(format_val, exp.Literal) and format_val.name.lower() == "parquet": + format_val = exp.Literal.string("PARQUET") + properties.append(exp.Property(this=exp.var("format"), value=format_val)) + + if table_properties: + logging.warning(f"Ignoring unsupported table properties for S3 Table CTAS: {list(table_properties.keys())}") + else: + # Standard CREATE TABLE for S3 Tables allows properties + for name, value in table_properties.items(): + properties.append(exp.Property(this=exp.var(name), value=value)) if properties: return exp.Properties(expressions=properties) @@ -364,11 +667,29 @@ def _query_table_type_or_raise(self, table: exp.Table) -> TableType: """ # Note: SHOW TBLPROPERTIES gets parsed by SQLGlot as an exp.Command anyway so we just use a string here # This also means we need to use dialect="hive" instead of dialect="athena" so that the identifiers get the correct quoting (backticks) - for row in self.fetchall(f"SHOW TBLPROPERTIES {table.sql(dialect='hive', identify=True)}"): - # This query returns a single column with values like 'EXTERNAL\tTRUE' - row_lower = row[0].lower() - if "external" in row_lower and "true" in row_lower: - return "hive" + target_table = table.copy() + catalog = target_table.catalog + + current_catalog = self.get_current_catalog() + if catalog and catalog != self._default_catalog: + target_table.set("catalog", None) + if current_catalog != catalog: + self.set_current_catalog(catalog) + + try: + for row in self.fetchall(f"SHOW TBLPROPERTIES {target_table.sql(dialect='hive', identify=True)}"): + # This query returns a single column with values like 'EXTERNAL\tTRUE' + row_lower = row[0].lower() + if "external" in row_lower and "true" in row_lower: + return "hive" + except Exception: + # If SHOW TBLPROPERTIES fails (e.g. S3 Tables might not support it), assume iceberg + # S3 tables are always iceberg anyway + pass + finally: + if catalog and catalog != self._default_catalog and current_catalog is not None and current_catalog != catalog: + self.set_current_catalog(current_catalog) + return "iceberg" def _is_hive_partitioned_table(self, table: exp.Table) -> bool: @@ -618,5 +939,10 @@ def _boto3_client(self, name: str) -> t.Any: **conn._client_kwargs, ) # type: ignore + def set_current_catalog(self, catalog: str) -> None: + self.connection.catalog_name = catalog + if hasattr(self.cursor, "_catalog_name"): + self.cursor._catalog_name = catalog + def get_current_catalog(self) -> t.Optional[str]: return self.connection.catalog_name diff --git a/web/client/openapi.json b/web/client/openapi.json index bf1cef0809..26b5415740 100644 --- a/web/client/openapi.json +++ b/web/client/openapi.json @@ -1,2243 +1 @@ -{ - "openapi": "3.1.0", - "info": { "title": "FastAPI", "version": "0.1.0" }, - "paths": { - "/api/commands/apply": { - "post": { - "summary": "Initiate Apply", - "description": "Apply a plan", - "operationId": "initiate_apply_api_commands_apply_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Body_initiate_apply_api_commands_apply_post" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanApplyStageTracker" }, - { "type": "null" } - ], - "title": "Response Initiate Apply Api Commands Apply Post" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/commands/evaluate": { - "post": { - "summary": "Evaluate", - "description": "Evaluate a model with a default limit of 1000", - "operationId": "evaluate_api_commands_evaluate_post", - "requestBody": { - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/EvaluateInput" } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/commands/fetchdf": { - "post": { - "summary": "Fetchdf", - "description": "Fetches a dataframe given a sql string", - "operationId": "fetchdf_api_commands_fetchdf_post", - "requestBody": { - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/FetchdfInput" } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/commands/render": { - "post": { - "summary": "Render", - "description": "Renders a model's query, optionally expanding referenced models", - "operationId": "render_api_commands_render_post", - "requestBody": { - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/RenderInput" } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Query" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/commands/test": { - "get": { - "summary": "Test", - "description": "Run one or all model tests", - "operationId": "test_api_commands_test_get", - "parameters": [ - { - "name": "test", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Test" - } - }, - { - "name": "verbosity", - "in": "query", - "required": false, - "schema": { "$ref": "#/components/schemas/Verbosity", "default": 0 } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/TestResult" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/files": { - "get": { - "summary": "Get Files", - "description": "Get all project files.", - "operationId": "get_files_api_files_get", - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Directory" } - } - } - } - } - } - }, - "/api/files/{path}": { - "get": { - "summary": "Get File", - "description": "Get a file, including its contents.", - "operationId": "get_file_api_files__path__get", - "parameters": [ - { - "name": "path", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Path" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/File" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - }, - "post": { - "summary": "Write File", - "description": "Create, update, or rename a file.", - "operationId": "write_file_api_files__path__post", - "parameters": [ - { - "name": "path", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Path" } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Body_write_file_api_files__path__post" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { "$ref": "#/components/schemas/File" }, - { "type": "null" } - ], - "title": "Response Write File Api Files Path Post" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - }, - "delete": { - "summary": "Delete File", - "description": "Delete a file.", - "operationId": "delete_file_api_files__path__delete", - "parameters": [ - { - "name": "path", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Path" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "null", - "title": "Response Delete File Api Files Path Delete" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/directories/{path}": { - "post": { - "summary": "Write Directory", - "description": "Create or rename a directory.", - "operationId": "write_directory_api_directories__path__post", - "parameters": [ - { - "name": "path", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Path" } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Body_write_directory_api_directories__path__post" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Directory" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - }, - "delete": { - "summary": "Delete Directory", - "description": "Delete a directory.", - "operationId": "delete_directory_api_directories__path__delete", - "parameters": [ - { - "name": "path", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Path" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/plan": { - "post": { - "summary": "Initiate Plan", - "description": "Get a plan for an environment.", - "operationId": "initiate_plan_api_plan_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Body_initiate_plan_api_plan_post" - } - } - } - }, - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanOverviewStageTracker" }, - { "type": "null" } - ], - "title": "Response Initiate Plan Api Plan Post" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/plan/cancel": { - "post": { - "summary": "Cancel Plan", - "description": "Cancel a plan application", - "operationId": "cancel_plan_api_plan_cancel_post", - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanCancelStageTracker" }, - { "type": "null" } - ], - "title": "Response Cancel Plan Api Plan Cancel Post" - } - } - } - } - } - } - }, - "/api/environments": { - "get": { - "summary": "Get Environments", - "description": "Get the environments", - "operationId": "get_environments_api_environments_get", - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Environments" } - } - } - } - } - } - }, - "/api/environments/{environment}": { - "delete": { - "summary": "Delete Environment", - "description": "Invalidate and delete an environment", - "operationId": "delete_environment_api_environments__environment__delete", - "parameters": [ - { - "name": "environment", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Environment" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/events": { - "get": { - "summary": "Events", - "description": "SQLMesh console server sent events", - "operationId": "events_api_events_get", - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - } - } - } - }, - "/api/lineage/{model_name}/{column_name}": { - "get": { - "summary": "Column Lineage", - "description": "Get a column's lineage", - "operationId": "column_lineage_api_lineage__model_name___column_name__get", - "parameters": [ - { - "name": "model_name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Model Name" } - }, - { - "name": "column_name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Column Name" } - }, - { - "name": "models_only", - "in": "query", - "required": false, - "schema": { - "type": "boolean", - "default": false, - "title": "Models Only" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/LineageColumn" - } - }, - "title": "Response Column Lineage Api Lineage Model Name Column Name Get" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/lineage/{model_name}": { - "get": { - "summary": "Model Lineage", - "description": "Get a model's lineage", - "operationId": "model_lineage_api_lineage__model_name__get", - "parameters": [ - { - "name": "model_name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Model Name" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": { - "type": "array", - "uniqueItems": true, - "items": { "type": "string" } - }, - "title": "Response Model Lineage Api Lineage Model Name Get" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/models": { - "get": { - "summary": "Get Models", - "description": "Get a list of models", - "operationId": "get_models_api_models_get", - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "items": { "$ref": "#/components/schemas/Model" }, - "type": "array" - }, - { "$ref": "#/components/schemas/ApiExceptionPayload" } - ], - "title": "Response Get Models Api Models Get" - } - } - } - } - } - } - }, - "/api/models/{name}": { - "get": { - "summary": "Get Model", - "description": "Get a single model", - "operationId": "get_model_api_models__name__get", - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Name" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Model" } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/api/meta": { - "get": { - "summary": "Get Api Meta", - "description": "Get the metadata", - "operationId": "get_api_meta_api_meta_get", - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/Meta" } - } - } - } - } - } - }, - "/api/modules": { - "get": { - "summary": "Get Api Modules", - "description": "Get the modules", - "operationId": "get_api_modules_api_modules_get", - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "items": { "$ref": "#/components/schemas/Modules" }, - "type": "array", - "title": "Response Get Api Modules Api Modules Get" - } - } - } - } - } - } - }, - "/api/table_diff": { - "get": { - "summary": "Get Table Diff", - "description": "Calculate differences between tables, taking into account schema and row level differences.", - "operationId": "get_table_diff_api_table_diff_get", - "parameters": [ - { - "name": "source", - "in": "query", - "required": true, - "schema": { "type": "string", "title": "Source" } - }, - { - "name": "target", - "in": "query", - "required": true, - "schema": { "type": "string", "title": "Target" } - }, - { - "name": "on", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "On" - } - }, - { - "name": "model_or_snapshot", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Model Or Snapshot" - } - }, - { - "name": "where", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Where" - } - }, - { - "name": "temp_schema", - "in": "query", - "required": false, - "schema": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Temp Schema" - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { "type": "integer", "default": 20, "title": "Limit" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { "$ref": "#/components/schemas/TableDiff" }, - { "type": "null" } - ], - "title": "Response Get Table Diff Api Table Diff Get" - } - } - } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - }, - "/health": { - "get": { - "summary": "Health", - "operationId": "health_health_get", - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "string", - "title": "Response Health Health Get" - } - } - } - } - } - } - }, - "/{full_path}": { - "get": { - "summary": "Index", - "operationId": "index__full_path__get", - "parameters": [ - { - "name": "full_path", - "in": "path", - "required": true, - "schema": { "type": "string", "title": "Full Path" } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": {} } } - }, - "422": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/HTTPValidationError" } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "ApiExceptionPayload": { - "properties": { - "timestamp": { "type": "integer", "title": "Timestamp" }, - "message": { "type": "string", "title": "Message" }, - "origin": { "type": "string", "title": "Origin" }, - "status": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "title": "Status" - }, - "trigger": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Trigger" - }, - "type": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Type" - }, - "description": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Description" - }, - "traceback": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Traceback" - }, - "stack": { - "anyOf": [ - { "items": { "type": "string" }, "type": "array" }, - { "type": "null" } - ], - "title": "Stack" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["timestamp", "message", "origin"], - "title": "ApiExceptionPayload" - }, - "BackfillDetails": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "view_name": { "type": "string", "title": "View Name" }, - "node_type": { - "$ref": "#/components/schemas/NodeType", - "default": "model" - }, - "parents": { - "items": { "type": "string" }, - "type": "array", - "uniqueItems": true, - "title": "Parents", - "default": [] - }, - "interval": { - "items": { "type": "string" }, - "type": "array", - "title": "Interval" - }, - "batches": { "type": "integer", "title": "Batches" } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "view_name", "interval", "batches"], - "title": "BackfillDetails" - }, - "BackfillTask": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "view_name": { "type": "string", "title": "View Name" }, - "node_type": { - "$ref": "#/components/schemas/NodeType", - "default": "model" - }, - "parents": { - "items": { "type": "string" }, - "type": "array", - "uniqueItems": true, - "title": "Parents", - "default": [] - }, - "completed": { "type": "integer", "title": "Completed" }, - "total": { "type": "integer", "title": "Total" }, - "start": { "type": "integer", "title": "Start" }, - "end": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "title": "End" - }, - "interval": { - "anyOf": [ - { "items": { "type": "string" }, "type": "array" }, - { "type": "null" } - ], - "title": "Interval" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "view_name", "completed", "total", "start"], - "title": "BackfillTask" - }, - "Body_initiate_apply_api_commands_apply_post": { - "properties": { - "environment": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Environment" - }, - "plan_dates": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanDates" }, - { "type": "null" } - ] - }, - "plan_options": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanOptions" }, - { "type": "null" } - ] - }, - "categories": { - "anyOf": [ - { - "additionalProperties": { - "$ref": "#/components/schemas/SnapshotChangeCategory" - }, - "type": "object" - }, - { "type": "null" } - ], - "title": "Categories" - } - }, - "type": "object", - "title": "Body_initiate_apply_api_commands_apply_post" - }, - "Body_initiate_plan_api_plan_post": { - "properties": { - "environment": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Environment" - }, - "plan_dates": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanDates" }, - { "type": "null" } - ] - }, - "plan_options": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanOptions" }, - { "type": "null" } - ] - }, - "categories": { - "anyOf": [ - { - "additionalProperties": { - "$ref": "#/components/schemas/SnapshotChangeCategory" - }, - "type": "object" - }, - { "type": "null" } - ], - "title": "Categories" - } - }, - "type": "object", - "title": "Body_initiate_plan_api_plan_post" - }, - "Body_write_directory_api_directories__path__post": { - "properties": { - "new_path": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "New Path" - } - }, - "type": "object", - "title": "Body_write_directory_api_directories__path__post" - }, - "Body_write_file_api_files__path__post": { - "properties": { - "content": { "type": "string", "title": "Content", "default": "" }, - "new_path": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "New Path" - } - }, - "type": "object", - "title": "Body_write_file_api_files__path__post" - }, - "ChangeDirect": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "view_name": { "type": "string", "title": "View Name" }, - "node_type": { - "$ref": "#/components/schemas/NodeType", - "default": "model" - }, - "parents": { - "items": { "type": "string" }, - "type": "array", - "uniqueItems": true, - "title": "Parents", - "default": [] - }, - "diff": { "type": "string", "title": "Diff" }, - "indirect": { - "items": { "$ref": "#/components/schemas/ChangeDisplay" }, - "type": "array", - "title": "Indirect", - "default": [] - }, - "direct": { - "items": { "$ref": "#/components/schemas/ChangeDisplay" }, - "type": "array", - "title": "Direct", - "default": [] - }, - "change_category": { - "anyOf": [ - { "$ref": "#/components/schemas/SnapshotChangeCategory" }, - { "type": "null" } - ] - } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "view_name", "diff"], - "title": "ChangeDirect" - }, - "ChangeDisplay": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "view_name": { "type": "string", "title": "View Name" }, - "node_type": { - "$ref": "#/components/schemas/NodeType", - "default": "model" - }, - "parents": { - "items": { "type": "string" }, - "type": "array", - "uniqueItems": true, - "title": "Parents", - "default": [] - } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "view_name"], - "title": "ChangeDisplay" - }, - "ChangeIndirect": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "view_name": { "type": "string", "title": "View Name" }, - "node_type": { - "$ref": "#/components/schemas/NodeType", - "default": "model" - }, - "parents": { - "items": { "type": "string" }, - "type": "array", - "uniqueItems": true, - "title": "Parents", - "default": [] - } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "view_name"], - "title": "ChangeIndirect" - }, - "Column": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "type": { "type": "string", "title": "Type" }, - "description": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Description" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "type"], - "title": "Column" - }, - "Directory": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "path": { "type": "string", "title": "Path" }, - "directories": { - "items": { "$ref": "#/components/schemas/Directory" }, - "type": "array", - "title": "Directories", - "default": [] - }, - "files": { - "items": { "$ref": "#/components/schemas/File" }, - "type": "array", - "title": "Files", - "default": [] - } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "path"], - "title": "Directory" - }, - "Environment": { - "properties": { - "name": { "type": "string", "title": "Name", "default": "prod" }, - "start_at": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" } - ], - "title": "Start At" - }, - "end_at": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "End At" - }, - "plan_id": { "type": "string", "title": "Plan Id" }, - "previous_plan_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Previous Plan Id" - }, - "expiration_ts": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "title": "Expiration Ts" - }, - "finalized_ts": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "title": "Finalized Ts" - }, - "suffix_target": { - "$ref": "#/components/schemas/EnvironmentSuffixTarget", - "default": "schema" - }, - "catalog_name_override": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Catalog Name Override" - }, - "normalize_name": { - "type": "boolean", - "title": "Normalize Name", - "default": true - }, - "gateway_managed": { - "type": "boolean", - "title": "Gateway Managed", - "default": false - }, - "snapshots": { "items": {}, "type": "array", "title": "Snapshots" }, - "promoted_snapshot_ids": { - "anyOf": [{ "items": {}, "type": "array" }, { "type": "null" }], - "title": "Promoted Snapshot Ids" - }, - "previous_finalized_snapshots": { - "anyOf": [{ "items": {}, "type": "array" }, { "type": "null" }], - "title": "Previous Finalized Snapshots" - }, - "requirements": { - "additionalProperties": { "type": "string" }, - "type": "object", - "title": "Requirements", - "default": {} - } - }, - "additionalProperties": false, - "type": "object", - "required": ["start_at", "plan_id", "snapshots"], - "title": "Environment", - "description": "Represents an isolated environment.\n\nEnvironments are isolated workspaces that hold pointers to physical tables.\n\nArgs:\n snapshots: The snapshots that are part of this environment.\n promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment\n (i.e. for which the views are created). If not specified, all snapshots are promoted.\n previous_finalized_snapshots: Snapshots that were part of this environment last time it was finalized.\n requirements: A mapping of library versions for all the snapshots in this environment." - }, - "EnvironmentSuffixTarget": { - "type": "string", - "enum": ["schema", "table"], - "title": "EnvironmentSuffixTarget" - }, - "Environments": { - "properties": { - "environments": { - "additionalProperties": { - "$ref": "#/components/schemas/Environment" - }, - "type": "object", - "title": "Environments", - "default": {} - }, - "pinned_environments": { - "items": { "type": "string" }, - "type": "array", - "uniqueItems": true, - "title": "Pinned Environments", - "default": [] - }, - "default_target_environment": { - "type": "string", - "title": "Default Target Environment", - "default": "" - } - }, - "additionalProperties": false, - "type": "object", - "title": "Environments" - }, - "EvaluateInput": { - "properties": { - "model": { "type": "string", "title": "Model" }, - "start": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" } - ], - "title": "Start" - }, - "end": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" } - ], - "title": "End" - }, - "execution_time": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" } - ], - "title": "Execution Time" - }, - "limit": { "type": "integer", "title": "Limit", "default": 1000 } - }, - "additionalProperties": false, - "type": "object", - "required": ["model", "start", "end", "execution_time"], - "title": "EvaluateInput" - }, - "FetchdfInput": { - "properties": { - "sql": { "type": "string", "title": "Sql" }, - "limit": { "type": "integer", "title": "Limit", "default": 1000 } - }, - "additionalProperties": false, - "type": "object", - "required": ["sql"], - "title": "FetchdfInput" - }, - "File": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "path": { "type": "string", "title": "Path" }, - "extension": { - "type": "string", - "title": "Extension", - "default": "" - }, - "content": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Content" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "path"], - "title": "File" - }, - "HTTPValidationError": { - "properties": { - "detail": { - "items": { "$ref": "#/components/schemas/ValidationError" }, - "type": "array", - "title": "Detail" - } - }, - "type": "object", - "title": "HTTPValidationError" - }, - "IntervalUnit": { - "type": "string", - "enum": [ - "year", - "month", - "day", - "hour", - "half_hour", - "quarter_hour", - "five_minute" - ], - "title": "IntervalUnit", - "description": "IntervalUnit is the inferred granularity of an incremental node.\n\nIntervalUnit can be one of 5 types, YEAR, MONTH, DAY, HOUR, MINUTE. The unit is inferred\nbased on the cron schedule of a node. The minimum time delta between a sample set of dates\nis used to determine which unit a node's schedule is." - }, - "LineageColumn": { - "properties": { - "source": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Source" - }, - "expression": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Expression" - }, - "models": { - "additionalProperties": { - "items": { "type": "string" }, - "type": "array", - "uniqueItems": true - }, - "type": "object", - "title": "Models" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["models"], - "title": "LineageColumn" - }, - "Meta": { - "properties": { - "version": { "type": "string", "title": "Version" }, - "has_running_task": { - "type": "boolean", - "title": "Has Running Task", - "default": false - } - }, - "additionalProperties": false, - "type": "object", - "required": ["version"], - "title": "Meta" - }, - "Model": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "fqn": { "type": "string", "title": "Fqn" }, - "path": { "type": "string", "title": "Path" }, - "full_path": { "type": "string", "title": "Full Path" }, - "dialect": { "type": "string", "title": "Dialect" }, - "type": { "$ref": "#/components/schemas/ModelType" }, - "columns": { - "items": { "$ref": "#/components/schemas/Column" }, - "type": "array", - "title": "Columns" - }, - "description": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Description" - }, - "details": { - "anyOf": [ - { "$ref": "#/components/schemas/ModelDetails" }, - { "type": "null" } - ] - }, - "sql": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Sql" - }, - "definition": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Definition" - }, - "default_catalog": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Default Catalog" - }, - "hash": { "type": "string", "title": "Hash" } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "name", - "fqn", - "path", - "full_path", - "dialect", - "type", - "columns", - "hash" - ], - "title": "Model" - }, - "ModelDetails": { - "properties": { - "owner": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Owner" - }, - "kind": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Kind" - }, - "batch_size": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "title": "Batch Size" - }, - "cron": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Cron" - }, - "stamp": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Stamp" - }, - "start": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Start" - }, - "retention": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "title": "Retention" - }, - "table_format": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Table Format" - }, - "storage_format": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Storage Format" - }, - "time_column": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Time Column" - }, - "tags": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Tags" - }, - "references": { - "items": { "$ref": "#/components/schemas/Reference" }, - "type": "array", - "title": "References", - "default": [] - }, - "partitioned_by": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Partitioned By" - }, - "clustered_by": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Clustered By" - }, - "lookback": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "title": "Lookback" - }, - "cron_prev": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Cron Prev" - }, - "cron_next": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Cron Next" - }, - "interval_unit": { - "anyOf": [ - { "$ref": "#/components/schemas/IntervalUnit" }, - { "type": "null" } - ] - }, - "annotated": { - "anyOf": [{ "type": "boolean" }, { "type": "null" }], - "title": "Annotated" - } - }, - "additionalProperties": false, - "type": "object", - "title": "ModelDetails" - }, - "ModelType": { - "type": "string", - "enum": ["python", "sql", "seed", "external", "source"], - "title": "ModelType" - }, - "ModelsDiff": { - "properties": { - "direct": { - "items": { "$ref": "#/components/schemas/ChangeDirect" }, - "type": "array", - "title": "Direct", - "default": [] - }, - "indirect": { - "items": { "$ref": "#/components/schemas/ChangeIndirect" }, - "type": "array", - "title": "Indirect", - "default": [] - }, - "metadata": { - "items": { "$ref": "#/components/schemas/ChangeDisplay" }, - "type": "array", - "title": "Metadata", - "default": [] - } - }, - "additionalProperties": false, - "type": "object", - "title": "ModelsDiff" - }, - "Modules": { - "type": "string", - "enum": [ - "editor", - "files", - "data-catalog", - "plans", - "tests", - "audits", - "errors", - "data", - "lineage" - ], - "title": "Modules" - }, - "NodeType": { - "type": "string", - "enum": ["model", "audit"], - "title": "NodeType" - }, - "PlanApplyStageTracker": { - "properties": { - "start": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Start" - }, - "end": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "End" - }, - "meta": { "$ref": "#/components/schemas/TrackableMeta" }, - "environment": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Environment" - }, - "plan_options": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanOptions" }, - { "type": "null" } - ] - }, - "creation": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanStageCreation" }, - { "type": "null" } - ] - }, - "restate": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanStageRestate" }, - { "type": "null" } - ] - }, - "backfill": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanStageBackfill" }, - { "type": "null" } - ] - }, - "promote": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanStagePromote" }, - { "type": "null" } - ] - } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanApplyStageTracker" - }, - "PlanCancelStageTracker": { - "properties": { - "start": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Start" - }, - "end": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "End" - }, - "meta": { "$ref": "#/components/schemas/TrackableMeta" }, - "environment": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Environment" - }, - "plan_options": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanOptions" }, - { "type": "null" } - ] - }, - "cancel": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanStageCancel" }, - { "type": "null" } - ] - } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanCancelStageTracker" - }, - "PlanDates": { - "properties": { - "start": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Start" - }, - "end": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "End" - } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanDates" - }, - "PlanOptions": { - "properties": { - "skip_tests": { - "type": "boolean", - "title": "Skip Tests", - "default": false - }, - "skip_backfill": { - "type": "boolean", - "title": "Skip Backfill", - "default": false - }, - "no_gaps": { - "type": "boolean", - "title": "No Gaps", - "default": false - }, - "forward_only": { - "type": "boolean", - "title": "Forward Only", - "default": false - }, - "no_auto_categorization": { - "type": "boolean", - "title": "No Auto Categorization", - "default": false - }, - "include_unmodified": { - "type": "boolean", - "title": "Include Unmodified", - "default": false - }, - "create_from": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Create From" - }, - "restate_models": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Restate Models" - }, - "auto_apply": { - "type": "boolean", - "title": "Auto Apply", - "default": false - } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanOptions" - }, - "PlanOverviewStageTracker": { - "properties": { - "start": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Start" - }, - "end": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "End" - }, - "meta": { "$ref": "#/components/schemas/TrackableMeta" }, - "environment": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Environment" - }, - "plan_options": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanOptions" }, - { "type": "null" } - ] - }, - "validation": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanStageValidation" }, - { "type": "null" } - ] - }, - "changes": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanStageChanges" }, - { "type": "null" } - ] - }, - "backfills": { - "anyOf": [ - { "$ref": "#/components/schemas/PlanStageBackfills" }, - { "type": "null" } - ] - } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanOverviewStageTracker" - }, - "PlanStageBackfill": { - "properties": { - "meta": { "$ref": "#/components/schemas/TrackableMeta" }, - "queue": { - "items": { "type": "string" }, - "type": "array", - "uniqueItems": true, - "title": "Queue", - "default": [] - }, - "tasks": { - "additionalProperties": { - "$ref": "#/components/schemas/BackfillTask" - }, - "type": "object", - "title": "Tasks", - "default": {} - } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanStageBackfill" - }, - "PlanStageBackfills": { - "properties": { - "meta": { "$ref": "#/components/schemas/TrackableMeta" }, - "models": { - "anyOf": [ - { - "items": { "$ref": "#/components/schemas/BackfillDetails" }, - "type": "array" - }, - { "type": "null" } - ], - "title": "Models" - } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanStageBackfills" - }, - "PlanStageCancel": { - "properties": { - "meta": { "$ref": "#/components/schemas/TrackableMeta" } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanStageCancel" - }, - "PlanStageChanges": { - "properties": { - "added": { - "anyOf": [ - { - "items": { "$ref": "#/components/schemas/ChangeDisplay" }, - "type": "array" - }, - { "type": "null" } - ], - "title": "Added" - }, - "removed": { - "anyOf": [ - { - "items": { "$ref": "#/components/schemas/ChangeDisplay" }, - "type": "array" - }, - { "type": "null" } - ], - "title": "Removed" - }, - "modified": { - "anyOf": [ - { "$ref": "#/components/schemas/ModelsDiff" }, - { "type": "null" } - ] - }, - "meta": { "$ref": "#/components/schemas/TrackableMeta" } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanStageChanges" - }, - "PlanStageCreation": { - "properties": { - "meta": { "$ref": "#/components/schemas/TrackableMeta" }, - "total_tasks": { "type": "integer", "title": "Total Tasks" }, - "num_tasks": { "type": "integer", "title": "Num Tasks" } - }, - "additionalProperties": false, - "type": "object", - "required": ["total_tasks", "num_tasks"], - "title": "PlanStageCreation" - }, - "PlanStagePromote": { - "properties": { - "meta": { "$ref": "#/components/schemas/TrackableMeta" }, - "total_tasks": { "type": "integer", "title": "Total Tasks" }, - "num_tasks": { "type": "integer", "title": "Num Tasks" }, - "target_environment": { - "type": "string", - "title": "Target Environment" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["total_tasks", "num_tasks", "target_environment"], - "title": "PlanStagePromote" - }, - "PlanStageRestate": { - "properties": { - "meta": { "$ref": "#/components/schemas/TrackableMeta" } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanStageRestate" - }, - "PlanStageValidation": { - "properties": { - "meta": { "$ref": "#/components/schemas/TrackableMeta" } - }, - "additionalProperties": false, - "type": "object", - "title": "PlanStageValidation" - }, - "Query": { - "properties": { "sql": { "type": "string", "title": "Sql" } }, - "additionalProperties": false, - "type": "object", - "required": ["sql"], - "title": "Query" - }, - "Reference": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "expression": { "type": "string", "title": "Expression" }, - "unique": { "type": "boolean", "title": "Unique" } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "expression", "unique"], - "title": "Reference" - }, - "RenderInput": { - "properties": { - "model": { "type": "string", "title": "Model" }, - "start": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Start" - }, - "end": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "End" - }, - "execution_time": { - "anyOf": [ - { "type": "string", "format": "date" }, - { "type": "string", "format": "date-time" }, - { "type": "string" }, - { "type": "integer" }, - { "type": "number" }, - { "type": "null" } - ], - "title": "Execution Time" - }, - "expand": { - "anyOf": [ - { "type": "boolean" }, - { "items": { "type": "string" }, "type": "array" } - ], - "title": "Expand", - "default": false - }, - "pretty": { "type": "boolean", "title": "Pretty", "default": true }, - "dialect": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Dialect" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["model"], - "title": "RenderInput" - }, - "RowDiff": { - "properties": { - "source": { "type": "string", "title": "Source" }, - "target": { "type": "string", "title": "Target" }, - "stats": { - "additionalProperties": { "type": "number" }, - "type": "object", - "title": "Stats" - }, - "sample": { - "additionalProperties": true, - "type": "object", - "title": "Sample" - }, - "source_count": { "type": "integer", "title": "Source Count" }, - "target_count": { "type": "integer", "title": "Target Count" }, - "count_pct_change": { "type": "number", "title": "Count Pct Change" } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "source", - "target", - "stats", - "sample", - "source_count", - "target_count", - "count_pct_change" - ], - "title": "RowDiff" - }, - "SchemaDiff": { - "properties": { - "source": { "type": "string", "title": "Source" }, - "target": { "type": "string", "title": "Target" }, - "source_schema": { - "additionalProperties": { "type": "string" }, - "type": "object", - "title": "Source Schema" - }, - "target_schema": { - "additionalProperties": { "type": "string" }, - "type": "object", - "title": "Target Schema" - }, - "added": { - "additionalProperties": { "type": "string" }, - "type": "object", - "title": "Added" - }, - "removed": { - "additionalProperties": { "type": "string" }, - "type": "object", - "title": "Removed" - }, - "modified": { - "additionalProperties": { "type": "string" }, - "type": "object", - "title": "Modified" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "source", - "target", - "source_schema", - "target_schema", - "added", - "removed", - "modified" - ], - "title": "SchemaDiff" - }, - "SnapshotChangeCategory": { - "type": "integer", - "enum": [1, 2, 3, 4, 5, 6], - "title": "SnapshotChangeCategory", - "description": "Values are ordered by decreasing severity and that ordering is required.\n\nBREAKING: The change requires that snapshot modified and downstream dependencies be rebuilt\nNON_BREAKING: The change requires that only the snapshot modified be rebuilt\nFORWARD_ONLY: The change requires no rebuilding\nINDIRECT_BREAKING: The change was caused indirectly and is breaking.\nINDIRECT_NON_BREAKING: The change was caused indirectly by a non-breaking change.\nMETADATA: The change was caused by a metadata update." - }, - "Status": { - "type": "string", - "enum": ["init", "success", "fail"], - "title": "Status", - "description": "An enumeration of statuses." - }, - "TableDiff": { - "properties": { - "schema_diff": { "$ref": "#/components/schemas/SchemaDiff" }, - "row_diff": { "$ref": "#/components/schemas/RowDiff" }, - "on": { - "items": { "items": { "type": "string" }, "type": "array" }, - "type": "array", - "title": "On" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["schema_diff", "row_diff", "on"], - "title": "TableDiff" - }, - "TestCase": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "path": { "type": "string", "format": "path", "title": "Path" } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "path"], - "title": "TestCase" - }, - "TestErrorOrFailure": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "path": { "type": "string", "format": "path", "title": "Path" }, - "tb": { "type": "string", "title": "Tb" } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "path", "tb"], - "title": "TestErrorOrFailure" - }, - "TestResult": { - "properties": { - "tests_run": { "type": "integer", "title": "Tests Run" }, - "failures": { - "items": { "$ref": "#/components/schemas/TestErrorOrFailure" }, - "type": "array", - "title": "Failures" - }, - "errors": { - "items": { "$ref": "#/components/schemas/TestErrorOrFailure" }, - "type": "array", - "title": "Errors" - }, - "skipped": { - "items": { "$ref": "#/components/schemas/TestSkipped" }, - "type": "array", - "title": "Skipped" - }, - "successes": { - "items": { "$ref": "#/components/schemas/TestCase" }, - "type": "array", - "title": "Successes" - } - }, - "additionalProperties": false, - "type": "object", - "required": ["tests_run", "failures", "errors", "skipped", "successes"], - "title": "TestResult" - }, - "TestSkipped": { - "properties": { - "name": { "type": "string", "title": "Name" }, - "path": { "type": "string", "format": "path", "title": "Path" }, - "reason": { "type": "string", "title": "Reason" } - }, - "additionalProperties": false, - "type": "object", - "required": ["name", "path", "reason"], - "title": "TestSkipped" - }, - "TrackableMeta": { - "properties": { - "status": { - "$ref": "#/components/schemas/Status", - "default": "init" - }, - "start": { "type": "integer", "title": "Start" }, - "end": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "title": "End" - }, - "done": { "type": "boolean", "title": "Done", "default": false } - }, - "additionalProperties": false, - "type": "object", - "title": "TrackableMeta" - }, - "ValidationError": { - "properties": { - "loc": { - "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] }, - "type": "array", - "title": "Location" - }, - "msg": { "type": "string", "title": "Message" }, - "type": { "type": "string", "title": "Error Type" } - }, - "type": "object", - "required": ["loc", "msg", "type"], - "title": "ValidationError" - }, - "Verbosity": { - "type": "integer", - "enum": [0, 1, 2], - "title": "Verbosity", - "description": "Verbosity levels for SQLMesh output." - } - } - } -} +{"openapi": "3.1.0", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": {"/api/commands/apply": {"post": {"summary": "Initiate Apply", "description": "Apply a plan", "operationId": "initiate_apply_api_commands_apply_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_initiate_apply_api_commands_apply_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"anyOf": [{"$ref": "#/components/schemas/PlanApplyStageTracker"}, {"type": "null"}], "title": "Response Initiate Apply Api Commands Apply Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/commands/evaluate": {"post": {"summary": "Evaluate", "description": "Evaluate a model with a default limit of 1000", "operationId": "evaluate_api_commands_evaluate_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/EvaluateInput"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/commands/fetchdf": {"post": {"summary": "Fetchdf", "description": "Fetches a dataframe given a sql string", "operationId": "fetchdf_api_commands_fetchdf_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/FetchdfInput"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/commands/render": {"post": {"summary": "Render", "description": "Renders a model's query, optionally expanding referenced models", "operationId": "render_api_commands_render_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/RenderInput"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Query"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/commands/test": {"get": {"summary": "Test", "description": "Run one or all model tests", "operationId": "test_api_commands_test_get", "parameters": [{"name": "test", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Test"}}, {"name": "verbosity", "in": "query", "required": false, "schema": {"$ref": "#/components/schemas/Verbosity", "default": 0}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TestResult"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/files": {"get": {"summary": "Get Files", "description": "Get all project files.", "operationId": "get_files_api_files_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Directory"}}}}}}}, "/api/files/{path}": {"get": {"summary": "Get File", "description": "Get a file, including its contents.", "operationId": "get_file_api_files__path__get", "parameters": [{"name": "path", "in": "path", "required": true, "schema": {"type": "string", "title": "Path"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/File"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "post": {"summary": "Write File", "description": "Create, update, or rename a file.", "operationId": "write_file_api_files__path__post", "parameters": [{"name": "path", "in": "path", "required": true, "schema": {"type": "string", "title": "Path"}}], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_write_file_api_files__path__post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"anyOf": [{"$ref": "#/components/schemas/File"}, {"type": "null"}], "title": "Response Write File Api Files Path Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"summary": "Delete File", "description": "Delete a file.", "operationId": "delete_file_api_files__path__delete", "parameters": [{"name": "path", "in": "path", "required": true, "schema": {"type": "string", "title": "Path"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/directories/{path}": {"post": {"summary": "Write Directory", "description": "Create or rename a directory.", "operationId": "write_directory_api_directories__path__post", "parameters": [{"name": "path", "in": "path", "required": true, "schema": {"type": "string", "title": "Path"}}], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_write_directory_api_directories__path__post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Directory"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"summary": "Delete Directory", "description": "Delete a directory.", "operationId": "delete_directory_api_directories__path__delete", "parameters": [{"name": "path", "in": "path", "required": true, "schema": {"type": "string", "title": "Path"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/plan": {"post": {"summary": "Initiate Plan", "description": "Get a plan for an environment.", "operationId": "initiate_plan_api_plan_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_initiate_plan_api_plan_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"anyOf": [{"$ref": "#/components/schemas/PlanOverviewStageTracker"}, {"type": "null"}], "title": "Response Initiate Plan Api Plan Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/plan/cancel": {"post": {"summary": "Cancel Plan", "description": "Cancel a plan application", "operationId": "cancel_plan_api_plan_cancel_post", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"anyOf": [{"$ref": "#/components/schemas/PlanCancelStageTracker"}, {"type": "null"}], "title": "Response Cancel Plan Api Plan Cancel Post"}}}}}}}, "/api/environments": {"get": {"summary": "Get Environments", "description": "Get the environments", "operationId": "get_environments_api_environments_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Environments"}}}}}}}, "/api/environments/{environment}": {"delete": {"summary": "Delete Environment", "description": "Invalidate and delete an environment", "operationId": "delete_environment_api_environments__environment__delete", "parameters": [{"name": "environment", "in": "path", "required": true, "schema": {"type": "string", "title": "Environment"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/events": {"get": {"summary": "Events", "description": "SQLMesh console server sent events", "operationId": "events_api_events_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/api/lineage/{model_name}/columns/{column_name}": {"get": {"summary": "Column Lineage", "description": "Get a column's lineage", "operationId": "column_lineage_api_lineage__model_name__columns__column_name__get", "parameters": [{"name": "model_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Model Name"}}, {"name": "column_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Column Name"}}, {"name": "models_only", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Models Only"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": {"type": "object", "additionalProperties": {"$ref": "#/components/schemas/LineageColumn"}}, "title": "Response Column Lineage Api Lineage Model Name Columns Column Name Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/lineage/{model_name}": {"get": {"summary": "Model Lineage", "description": "Get a model's lineage", "operationId": "model_lineage_api_lineage__model_name__get", "parameters": [{"name": "model_name", "in": "path", "required": true, "schema": {"type": "string", "title": "Model Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": {"type": "array", "uniqueItems": true, "items": {"type": "string"}}, "title": "Response Model Lineage Api Lineage Model Name Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/models": {"get": {"summary": "Get Models", "description": "Get a list of models", "operationId": "get_models_api_models_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"anyOf": [{"items": {"$ref": "#/components/schemas/Model"}, "type": "array"}, {"$ref": "#/components/schemas/ApiExceptionPayload"}], "title": "Response Get Models Api Models Get"}}}}}}}, "/api/models/{name}": {"get": {"summary": "Get Model", "description": "Get a single model", "operationId": "get_model_api_models__name__get", "parameters": [{"name": "name", "in": "path", "required": true, "schema": {"type": "string", "title": "Name"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Model"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/meta": {"get": {"summary": "Get Api Meta", "description": "Get the metadata", "operationId": "get_api_meta_api_meta_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Meta"}}}}}}}, "/api/modules": {"get": {"summary": "Get Api Modules", "description": "Get the modules", "operationId": "get_api_modules_api_modules_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/Modules"}, "type": "array", "title": "Response Get Api Modules Api Modules Get"}}}}}}}, "/api/table_diff": {"get": {"summary": "Get Table Diff", "description": "Calculate differences between tables, taking into account schema and row level differences.", "operationId": "get_table_diff_api_table_diff_get", "parameters": [{"name": "source", "in": "query", "required": true, "schema": {"type": "string", "title": "Source"}}, {"name": "target", "in": "query", "required": true, "schema": {"type": "string", "title": "Target"}}, {"name": "on", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "On"}}, {"name": "model_or_snapshot", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Model Or Snapshot"}}, {"name": "where", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Where"}}, {"name": "temp_schema", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Temp Schema"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "default": 20, "title": "Limit"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"anyOf": [{"$ref": "#/components/schemas/TableDiff"}, {"type": "null"}], "title": "Response Get Table Diff Api Table Diff Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/health": {"get": {"summary": "Health", "operationId": "health_health_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "string", "title": "Response Health Health Get"}}}}}}}, "/{full_path}": {"get": {"summary": "Index", "operationId": "index__full_path__get", "parameters": [{"name": "full_path", "in": "path", "required": true, "schema": {"type": "string", "title": "Full Path"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}}, "components": {"schemas": {"ApiExceptionPayload": {"properties": {"timestamp": {"type": "integer", "title": "Timestamp"}, "message": {"type": "string", "title": "Message"}, "origin": {"type": "string", "title": "Origin"}, "status": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Status"}, "trigger": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Trigger"}, "type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Type"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "traceback": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Traceback"}, "stack": {"anyOf": [{"items": {"type": "string"}, "type": "array"}, {"type": "null"}], "title": "Stack"}}, "additionalProperties": false, "type": "object", "required": ["timestamp", "message", "origin"], "title": "ApiExceptionPayload"}, "BackfillDetails": {"properties": {"name": {"type": "string", "title": "Name"}, "view_name": {"type": "string", "title": "View Name"}, "node_type": {"$ref": "#/components/schemas/NodeType", "default": "model"}, "parents": {"items": {"type": "string"}, "type": "array", "uniqueItems": true, "title": "Parents", "default": []}, "interval": {"items": {"type": "string"}, "type": "array", "title": "Interval"}, "batches": {"type": "integer", "title": "Batches"}}, "additionalProperties": false, "type": "object", "required": ["name", "view_name", "interval", "batches"], "title": "BackfillDetails"}, "BackfillTask": {"properties": {"name": {"type": "string", "title": "Name"}, "view_name": {"type": "string", "title": "View Name"}, "node_type": {"$ref": "#/components/schemas/NodeType", "default": "model"}, "parents": {"items": {"type": "string"}, "type": "array", "uniqueItems": true, "title": "Parents", "default": []}, "completed": {"type": "integer", "title": "Completed"}, "total": {"type": "integer", "title": "Total"}, "start": {"type": "integer", "title": "Start"}, "end": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "End"}, "interval": {"anyOf": [{"items": {"type": "string"}, "type": "array"}, {"type": "null"}], "title": "Interval"}}, "additionalProperties": false, "type": "object", "required": ["name", "view_name", "completed", "total", "start"], "title": "BackfillTask"}, "Body_initiate_apply_api_commands_apply_post": {"properties": {"environment": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Environment"}, "plan_dates": {"anyOf": [{"$ref": "#/components/schemas/PlanDates"}, {"type": "null"}]}, "plan_options": {"anyOf": [{"$ref": "#/components/schemas/PlanOptions"}, {"type": "null"}]}, "categories": {"anyOf": [{"additionalProperties": {"$ref": "#/components/schemas/SnapshotChangeCategory"}, "type": "object"}, {"type": "null"}], "title": "Categories"}}, "type": "object", "title": "Body_initiate_apply_api_commands_apply_post"}, "Body_initiate_plan_api_plan_post": {"properties": {"environment": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Environment"}, "plan_dates": {"anyOf": [{"$ref": "#/components/schemas/PlanDates"}, {"type": "null"}]}, "plan_options": {"anyOf": [{"$ref": "#/components/schemas/PlanOptions"}, {"type": "null"}]}, "categories": {"anyOf": [{"additionalProperties": {"$ref": "#/components/schemas/SnapshotChangeCategory"}, "type": "object"}, {"type": "null"}], "title": "Categories"}}, "type": "object", "title": "Body_initiate_plan_api_plan_post"}, "Body_write_directory_api_directories__path__post": {"properties": {"new_path": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "New Path"}}, "type": "object", "title": "Body_write_directory_api_directories__path__post"}, "Body_write_file_api_files__path__post": {"properties": {"content": {"type": "string", "title": "Content", "default": ""}, "new_path": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "New Path"}}, "type": "object", "title": "Body_write_file_api_files__path__post"}, "ChangeDirect": {"properties": {"name": {"type": "string", "title": "Name"}, "view_name": {"type": "string", "title": "View Name"}, "node_type": {"$ref": "#/components/schemas/NodeType", "default": "model"}, "parents": {"items": {"type": "string"}, "type": "array", "uniqueItems": true, "title": "Parents", "default": []}, "diff": {"type": "string", "title": "Diff"}, "indirect": {"items": {"$ref": "#/components/schemas/ChangeDisplay"}, "type": "array", "title": "Indirect", "default": []}, "direct": {"items": {"$ref": "#/components/schemas/ChangeDisplay"}, "type": "array", "title": "Direct", "default": []}, "change_category": {"anyOf": [{"$ref": "#/components/schemas/SnapshotChangeCategory"}, {"type": "null"}]}}, "additionalProperties": false, "type": "object", "required": ["name", "view_name", "diff"], "title": "ChangeDirect"}, "ChangeDisplay": {"properties": {"name": {"type": "string", "title": "Name"}, "view_name": {"type": "string", "title": "View Name"}, "node_type": {"$ref": "#/components/schemas/NodeType", "default": "model"}, "parents": {"items": {"type": "string"}, "type": "array", "uniqueItems": true, "title": "Parents", "default": []}}, "additionalProperties": false, "type": "object", "required": ["name", "view_name"], "title": "ChangeDisplay"}, "ChangeIndirect": {"properties": {"name": {"type": "string", "title": "Name"}, "view_name": {"type": "string", "title": "View Name"}, "node_type": {"$ref": "#/components/schemas/NodeType", "default": "model"}, "parents": {"items": {"type": "string"}, "type": "array", "uniqueItems": true, "title": "Parents", "default": []}}, "additionalProperties": false, "type": "object", "required": ["name", "view_name"], "title": "ChangeIndirect"}, "Column": {"properties": {"name": {"type": "string", "title": "Name"}, "type": {"type": "string", "title": "Type"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}}, "additionalProperties": false, "type": "object", "required": ["name", "type"], "title": "Column"}, "Directory": {"properties": {"name": {"type": "string", "title": "Name"}, "path": {"type": "string", "title": "Path"}, "directories": {"items": {"$ref": "#/components/schemas/Directory"}, "type": "array", "title": "Directories", "default": []}, "files": {"items": {"$ref": "#/components/schemas/File"}, "type": "array", "title": "Files", "default": []}}, "additionalProperties": false, "type": "object", "required": ["name", "path"], "title": "Directory"}, "Environment": {"properties": {"name": {"type": "string", "title": "Name", "default": "prod"}, "start_at": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}], "title": "Start At"}, "end_at": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "End At"}, "plan_id": {"type": "string", "title": "Plan Id"}, "previous_plan_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Previous Plan Id"}, "expiration_ts": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Expiration Ts"}, "finalized_ts": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Finalized Ts"}, "suffix_target": {"$ref": "#/components/schemas/EnvironmentSuffixTarget", "default": "schema"}, "catalog_name_override": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Catalog Name Override"}, "normalize_name": {"type": "boolean", "title": "Normalize Name", "default": true}, "gateway_managed": {"type": "boolean", "title": "Gateway Managed", "default": false}, "snapshots": {"items": {}, "type": "array", "title": "Snapshots"}, "promoted_snapshot_ids": {"anyOf": [{"items": {}, "type": "array"}, {"type": "null"}], "title": "Promoted Snapshot Ids"}, "previous_finalized_snapshots": {"anyOf": [{"items": {}, "type": "array"}, {"type": "null"}], "title": "Previous Finalized Snapshots"}, "requirements": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Requirements", "default": {}}}, "additionalProperties": false, "type": "object", "required": ["start_at", "plan_id", "snapshots"], "title": "Environment", "description": "Represents an isolated environment.\n\nEnvironments are isolated workspaces that hold pointers to physical tables.\n\nArgs:\n snapshots: The snapshots that are part of this environment.\n promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment\n (i.e. for which the views are created). If not specified, all snapshots are promoted.\n previous_finalized_snapshots: Snapshots that were part of this environment last time it was finalized.\n requirements: A mapping of library versions for all the snapshots in this environment."}, "EnvironmentSuffixTarget": {"type": "string", "enum": ["schema", "table", "catalog"], "title": "EnvironmentSuffixTarget"}, "Environments": {"properties": {"environments": {"additionalProperties": {"$ref": "#/components/schemas/Environment"}, "type": "object", "title": "Environments", "default": {}}, "pinned_environments": {"items": {"type": "string"}, "type": "array", "uniqueItems": true, "title": "Pinned Environments", "default": []}, "default_target_environment": {"type": "string", "title": "Default Target Environment", "default": ""}}, "additionalProperties": false, "type": "object", "title": "Environments"}, "EvaluateInput": {"properties": {"model": {"type": "string", "title": "Model"}, "start": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}], "title": "Start"}, "end": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}], "title": "End"}, "execution_time": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}], "title": "Execution Time"}, "limit": {"type": "integer", "title": "Limit", "default": 1000}}, "additionalProperties": false, "type": "object", "required": ["model", "start", "end", "execution_time"], "title": "EvaluateInput"}, "FetchdfInput": {"properties": {"sql": {"type": "string", "title": "Sql"}, "limit": {"type": "integer", "title": "Limit", "default": 1000}}, "additionalProperties": false, "type": "object", "required": ["sql"], "title": "FetchdfInput"}, "File": {"properties": {"name": {"type": "string", "title": "Name"}, "path": {"type": "string", "title": "Path"}, "extension": {"type": "string", "title": "Extension", "default": ""}, "content": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Content"}}, "additionalProperties": false, "type": "object", "required": ["name", "path"], "title": "File"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "IntervalUnit": {"type": "string", "enum": ["year", "month", "day", "hour", "half_hour", "quarter_hour", "five_minute"], "title": "IntervalUnit", "description": "IntervalUnit is the inferred granularity of an incremental node.\n\nIntervalUnit can be one of 5 types, YEAR, MONTH, DAY, HOUR, MINUTE. The unit is inferred\nbased on the cron schedule of a node. The minimum time delta between a sample set of dates\nis used to determine which unit a node's schedule is.\n\nIt's designed to align with common partitioning schemes, hence why there is no WEEK unit\nbecause generally tables are not partitioned by week"}, "LineageColumn": {"properties": {"source": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source"}, "expression": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Expression"}, "models": {"additionalProperties": {"items": {"type": "string"}, "type": "array", "uniqueItems": true}, "type": "object", "title": "Models"}}, "additionalProperties": false, "type": "object", "required": ["models"], "title": "LineageColumn"}, "Meta": {"properties": {"version": {"type": "string", "title": "Version"}, "has_running_task": {"type": "boolean", "title": "Has Running Task", "default": false}}, "additionalProperties": false, "type": "object", "required": ["version"], "title": "Meta"}, "Model": {"properties": {"name": {"type": "string", "title": "Name"}, "fqn": {"type": "string", "title": "Fqn"}, "path": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Path"}, "full_path": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Full Path"}, "dialect": {"type": "string", "title": "Dialect"}, "type": {"$ref": "#/components/schemas/ModelType"}, "columns": {"items": {"$ref": "#/components/schemas/Column"}, "type": "array", "title": "Columns"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "details": {"anyOf": [{"$ref": "#/components/schemas/ModelDetails"}, {"type": "null"}]}, "sql": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sql"}, "definition": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Definition"}, "default_catalog": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Default Catalog"}, "hash": {"type": "string", "title": "Hash"}}, "additionalProperties": false, "type": "object", "required": ["name", "fqn", "dialect", "type", "columns", "hash"], "title": "Model"}, "ModelDetails": {"properties": {"owner": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Owner"}, "kind": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Kind"}, "batch_size": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Batch Size"}, "cron": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cron"}, "stamp": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Stamp"}, "start": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Start"}, "retention": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Retention"}, "table_format": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Table Format"}, "storage_format": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Storage Format"}, "time_column": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Time Column"}, "tags": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Tags"}, "references": {"items": {"$ref": "#/components/schemas/Reference"}, "type": "array", "title": "References", "default": []}, "partitioned_by": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Partitioned By"}, "clustered_by": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Clustered By"}, "lookback": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Lookback"}, "cron_prev": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Cron Prev"}, "cron_next": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Cron Next"}, "interval_unit": {"anyOf": [{"$ref": "#/components/schemas/IntervalUnit"}, {"type": "null"}]}, "annotated": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Annotated"}}, "additionalProperties": false, "type": "object", "title": "ModelDetails"}, "ModelType": {"type": "string", "enum": ["python", "sql", "seed", "external", "source"], "title": "ModelType"}, "ModelsDiff": {"properties": {"direct": {"items": {"$ref": "#/components/schemas/ChangeDirect"}, "type": "array", "title": "Direct", "default": []}, "indirect": {"items": {"$ref": "#/components/schemas/ChangeIndirect"}, "type": "array", "title": "Indirect", "default": []}, "metadata": {"items": {"$ref": "#/components/schemas/ChangeDisplay"}, "type": "array", "title": "Metadata", "default": []}}, "additionalProperties": false, "type": "object", "title": "ModelsDiff"}, "Modules": {"type": "string", "enum": ["editor", "files", "data-catalog", "plans", "tests", "audits", "errors", "data", "lineage"], "title": "Modules"}, "NodeType": {"type": "string", "enum": ["model", "audit"], "title": "NodeType"}, "PlanApplyStageTracker": {"properties": {"start": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Start"}, "end": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "End"}, "meta": {"$ref": "#/components/schemas/TrackableMeta"}, "environment": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Environment"}, "plan_options": {"anyOf": [{"$ref": "#/components/schemas/PlanOptions"}, {"type": "null"}]}, "creation": {"anyOf": [{"$ref": "#/components/schemas/PlanStageCreation"}, {"type": "null"}]}, "restate": {"anyOf": [{"$ref": "#/components/schemas/PlanStageRestate"}, {"type": "null"}]}, "backfill": {"anyOf": [{"$ref": "#/components/schemas/PlanStageBackfill"}, {"type": "null"}]}, "promote": {"anyOf": [{"$ref": "#/components/schemas/PlanStagePromote"}, {"type": "null"}]}}, "additionalProperties": false, "type": "object", "title": "PlanApplyStageTracker"}, "PlanCancelStageTracker": {"properties": {"start": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Start"}, "end": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "End"}, "meta": {"$ref": "#/components/schemas/TrackableMeta"}, "environment": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Environment"}, "plan_options": {"anyOf": [{"$ref": "#/components/schemas/PlanOptions"}, {"type": "null"}]}, "cancel": {"anyOf": [{"$ref": "#/components/schemas/PlanStageCancel"}, {"type": "null"}]}}, "additionalProperties": false, "type": "object", "title": "PlanCancelStageTracker"}, "PlanDates": {"properties": {"start": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Start"}, "end": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "End"}}, "additionalProperties": false, "type": "object", "title": "PlanDates"}, "PlanOptions": {"properties": {"skip_tests": {"type": "boolean", "title": "Skip Tests", "default": false}, "skip_backfill": {"type": "boolean", "title": "Skip Backfill", "default": false}, "no_gaps": {"type": "boolean", "title": "No Gaps", "default": false}, "forward_only": {"type": "boolean", "title": "Forward Only", "default": false}, "no_auto_categorization": {"type": "boolean", "title": "No Auto Categorization", "default": false}, "include_unmodified": {"type": "boolean", "title": "Include Unmodified", "default": false}, "create_from": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Create From"}, "restate_models": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Restate Models"}, "auto_apply": {"type": "boolean", "title": "Auto Apply", "default": false}}, "additionalProperties": false, "type": "object", "title": "PlanOptions"}, "PlanOverviewStageTracker": {"properties": {"start": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Start"}, "end": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "End"}, "meta": {"$ref": "#/components/schemas/TrackableMeta"}, "environment": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Environment"}, "plan_options": {"anyOf": [{"$ref": "#/components/schemas/PlanOptions"}, {"type": "null"}]}, "validation": {"anyOf": [{"$ref": "#/components/schemas/PlanStageValidation"}, {"type": "null"}]}, "changes": {"anyOf": [{"$ref": "#/components/schemas/PlanStageChanges"}, {"type": "null"}]}, "backfills": {"anyOf": [{"$ref": "#/components/schemas/PlanStageBackfills"}, {"type": "null"}]}}, "additionalProperties": false, "type": "object", "title": "PlanOverviewStageTracker"}, "PlanStageBackfill": {"properties": {"meta": {"$ref": "#/components/schemas/TrackableMeta"}, "queue": {"items": {"type": "string"}, "type": "array", "uniqueItems": true, "title": "Queue", "default": []}, "tasks": {"additionalProperties": {"$ref": "#/components/schemas/BackfillTask"}, "type": "object", "title": "Tasks", "default": {}}}, "additionalProperties": false, "type": "object", "title": "PlanStageBackfill"}, "PlanStageBackfills": {"properties": {"meta": {"$ref": "#/components/schemas/TrackableMeta"}, "models": {"anyOf": [{"items": {"$ref": "#/components/schemas/BackfillDetails"}, "type": "array"}, {"type": "null"}], "title": "Models"}}, "additionalProperties": false, "type": "object", "title": "PlanStageBackfills"}, "PlanStageCancel": {"properties": {"meta": {"$ref": "#/components/schemas/TrackableMeta"}}, "additionalProperties": false, "type": "object", "title": "PlanStageCancel"}, "PlanStageChanges": {"properties": {"added": {"anyOf": [{"items": {"$ref": "#/components/schemas/ChangeDisplay"}, "type": "array"}, {"type": "null"}], "title": "Added"}, "removed": {"anyOf": [{"items": {"$ref": "#/components/schemas/ChangeDisplay"}, "type": "array"}, {"type": "null"}], "title": "Removed"}, "modified": {"anyOf": [{"$ref": "#/components/schemas/ModelsDiff"}, {"type": "null"}]}, "meta": {"$ref": "#/components/schemas/TrackableMeta"}}, "additionalProperties": false, "type": "object", "title": "PlanStageChanges"}, "PlanStageCreation": {"properties": {"meta": {"$ref": "#/components/schemas/TrackableMeta"}, "total_tasks": {"type": "integer", "title": "Total Tasks"}, "num_tasks": {"type": "integer", "title": "Num Tasks"}}, "additionalProperties": false, "type": "object", "required": ["total_tasks", "num_tasks"], "title": "PlanStageCreation"}, "PlanStagePromote": {"properties": {"meta": {"$ref": "#/components/schemas/TrackableMeta"}, "total_tasks": {"type": "integer", "title": "Total Tasks"}, "num_tasks": {"type": "integer", "title": "Num Tasks"}, "target_environment": {"type": "string", "title": "Target Environment"}}, "additionalProperties": false, "type": "object", "required": ["total_tasks", "num_tasks", "target_environment"], "title": "PlanStagePromote"}, "PlanStageRestate": {"properties": {"meta": {"$ref": "#/components/schemas/TrackableMeta"}}, "additionalProperties": false, "type": "object", "title": "PlanStageRestate"}, "PlanStageValidation": {"properties": {"meta": {"$ref": "#/components/schemas/TrackableMeta"}}, "additionalProperties": false, "type": "object", "title": "PlanStageValidation"}, "ProcessedSampleData": {"properties": {"column_differences": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Column Differences"}, "source_only": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Source Only"}, "target_only": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Target Only"}}, "additionalProperties": false, "type": "object", "required": ["column_differences", "source_only", "target_only"], "title": "ProcessedSampleData"}, "Query": {"properties": {"sql": {"type": "string", "title": "Sql"}}, "additionalProperties": false, "type": "object", "required": ["sql"], "title": "Query"}, "Reference": {"properties": {"name": {"type": "string", "title": "Name"}, "expression": {"type": "string", "title": "Expression"}, "unique": {"type": "boolean", "title": "Unique"}}, "additionalProperties": false, "type": "object", "required": ["name", "expression", "unique"], "title": "Reference"}, "RenderInput": {"properties": {"model": {"type": "string", "title": "Model"}, "start": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Start"}, "end": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "End"}, "execution_time": {"anyOf": [{"type": "string", "format": "date"}, {"type": "string", "format": "date-time"}, {"type": "string"}, {"type": "integer"}, {"type": "number"}, {"type": "null"}], "title": "Execution Time"}, "expand": {"anyOf": [{"type": "boolean"}, {"items": {"type": "string"}, "type": "array"}], "title": "Expand", "default": false}, "pretty": {"type": "boolean", "title": "Pretty", "default": true}, "dialect": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Dialect"}}, "additionalProperties": false, "type": "object", "required": ["model"], "title": "RenderInput"}, "RowDiff": {"properties": {"source": {"type": "string", "title": "Source"}, "target": {"type": "string", "title": "Target"}, "stats": {"additionalProperties": {"type": "number"}, "type": "object", "title": "Stats"}, "sample": {"additionalProperties": true, "type": "object", "title": "Sample"}, "joined_sample": {"additionalProperties": true, "type": "object", "title": "Joined Sample"}, "s_sample": {"additionalProperties": true, "type": "object", "title": "S Sample"}, "t_sample": {"additionalProperties": true, "type": "object", "title": "T Sample"}, "column_stats": {"additionalProperties": true, "type": "object", "title": "Column Stats"}, "source_count": {"type": "integer", "title": "Source Count"}, "target_count": {"type": "integer", "title": "Target Count"}, "count_pct_change": {"type": "number", "title": "Count Pct Change"}, "decimals": {"type": "integer", "title": "Decimals"}, "processed_sample_data": {"anyOf": [{"$ref": "#/components/schemas/ProcessedSampleData"}, {"type": "null"}]}}, "additionalProperties": false, "type": "object", "required": ["source", "target", "stats", "sample", "joined_sample", "s_sample", "t_sample", "column_stats", "source_count", "target_count", "count_pct_change", "decimals"], "title": "RowDiff"}, "SchemaDiff": {"properties": {"source": {"type": "string", "title": "Source"}, "target": {"type": "string", "title": "Target"}, "source_schema": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Source Schema"}, "target_schema": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Target Schema"}, "added": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Added"}, "removed": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Removed"}, "modified": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Modified"}}, "additionalProperties": false, "type": "object", "required": ["source", "target", "source_schema", "target_schema", "added", "removed", "modified"], "title": "SchemaDiff"}, "SnapshotChangeCategory": {"type": "integer", "enum": [1, 2, 3, 4, 5, 6], "title": "SnapshotChangeCategory", "description": "Values are ordered by decreasing severity and that ordering is required.\n\nBREAKING: The change requires that snapshot modified and downstream dependencies be rebuilt\nNON_BREAKING: The change requires that only the snapshot modified be rebuilt\nFORWARD_ONLY: The change requires no rebuilding\nINDIRECT_BREAKING: The change was caused indirectly and is breaking.\nINDIRECT_NON_BREAKING: The change was caused indirectly by a non-breaking change.\nMETADATA: The change was caused by a metadata update."}, "Status": {"type": "string", "enum": ["init", "success", "fail"], "title": "Status", "description": "An enumeration of statuses."}, "TableDiff": {"properties": {"schema_diff": {"$ref": "#/components/schemas/SchemaDiff"}, "row_diff": {"$ref": "#/components/schemas/RowDiff"}, "on": {"items": {"items": {"type": "string"}, "type": "array"}, "type": "array", "title": "On"}}, "additionalProperties": false, "type": "object", "required": ["schema_diff", "row_diff", "on"], "title": "TableDiff"}, "TestCase": {"properties": {"name": {"type": "string", "title": "Name"}, "path": {"type": "string", "title": "Path"}}, "additionalProperties": false, "type": "object", "required": ["name", "path"], "title": "TestCase"}, "TestErrorOrFailure": {"properties": {"name": {"type": "string", "title": "Name"}, "path": {"type": "string", "title": "Path"}, "tb": {"type": "string", "title": "Tb"}}, "additionalProperties": false, "type": "object", "required": ["name", "path", "tb"], "title": "TestErrorOrFailure"}, "TestResult": {"properties": {"tests_run": {"type": "integer", "title": "Tests Run"}, "failures": {"items": {"$ref": "#/components/schemas/TestErrorOrFailure"}, "type": "array", "title": "Failures"}, "errors": {"items": {"$ref": "#/components/schemas/TestErrorOrFailure"}, "type": "array", "title": "Errors"}, "skipped": {"items": {"$ref": "#/components/schemas/TestSkipped"}, "type": "array", "title": "Skipped"}, "successes": {"items": {"$ref": "#/components/schemas/TestCase"}, "type": "array", "title": "Successes"}}, "additionalProperties": false, "type": "object", "required": ["tests_run", "failures", "errors", "skipped", "successes"], "title": "TestResult"}, "TestSkipped": {"properties": {"name": {"type": "string", "title": "Name"}, "path": {"type": "string", "title": "Path"}, "reason": {"type": "string", "title": "Reason"}}, "additionalProperties": false, "type": "object", "required": ["name", "path", "reason"], "title": "TestSkipped"}, "TrackableMeta": {"properties": {"status": {"$ref": "#/components/schemas/Status", "default": "init"}, "start": {"type": "integer", "title": "Start"}, "end": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "End"}, "done": {"type": "boolean", "title": "Done", "default": false}}, "additionalProperties": false, "type": "object", "title": "TrackableMeta"}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}, "Verbosity": {"type": "integer", "enum": [0, 1, 2], "title": "Verbosity", "description": "Verbosity levels for SQLMesh output."}}}} \ No newline at end of file diff --git a/web/client/src/api/index.ts b/web/client/src/api/index.ts index 2cd92b08dd..4d30f0aaad 100644 --- a/web/client/src/api/index.ts +++ b/web/client/src/api/index.ts @@ -26,8 +26,8 @@ import { getModelsApiModelsGet, type ModelLineageApiLineageModelNameGet200, modelLineageApiLineageModelNameGet, - type ColumnLineageApiLineageModelNameColumnNameGet200, - columnLineageApiLineageModelNameColumnNameGet, + type ColumnLineageApiLineageModelNameColumnsColumnNameGet200, + columnLineageApiLineageModelNameColumnsColumnNameGet, fetchdfApiCommandsFetchdfPost, renderApiCommandsRenderPost, type RenderInput, @@ -51,7 +51,7 @@ import { getModelApiModelsNameGet, getApiModulesApiModulesGet, type Modules, - type ColumnLineageApiLineageModelNameColumnNameGetParams, + type ColumnLineageApiLineageModelNameColumnsColumnNameGetParams, } from './client' import { useNotificationCenter, @@ -213,13 +213,13 @@ export function useApiColumnLineage( model: string, column: string, options?: ApiOptions, - params?: ColumnLineageApiLineageModelNameColumnNameGetParams, -): UseQueryWithTimeoutOptions { + params?: ColumnLineageApiLineageModelNameColumnsColumnNameGetParams, +): UseQueryWithTimeoutOptions { return useQueryWithTimeout( { queryKey: ['/api/lineage', model, column], queryFn: async ({ signal }) => - await columnLineageApiLineageModelNameColumnNameGet( + await columnLineageApiLineageModelNameColumnsColumnNameGet( model, column, params, diff --git a/web/client/src/library/components/graph/ModelColumns.tsx b/web/client/src/library/components/graph/ModelColumns.tsx index 640d3f8832..78cbc49400 100644 --- a/web/client/src/library/components/graph/ModelColumns.tsx +++ b/web/client/src/library/components/graph/ModelColumns.tsx @@ -29,7 +29,7 @@ import clsx from 'clsx' import { type ColumnDescription, type Column, - type ColumnLineageApiLineageModelNameColumnNameGet200, + type ColumnLineageApiLineageModelNameColumnsColumnNameGet200, type LineageColumn, type LineageColumnSource, type LineageColumnExpression, @@ -391,7 +391,7 @@ function ModelColumn({ expression?: LineageColumnExpression withDescription?: boolean updateColumnLineage: ( - lineage: ColumnLineageApiLineageModelNameColumnNameGet200, + lineage: ColumnLineageApiLineageModelNameColumnsColumnNameGet200, ) => void removeEdges: (columnId: string) => void selectManually?: React.Dispatch< diff --git a/web/client/src/models/sqlmesh-model.ts b/web/client/src/models/sqlmesh-model.ts index 0d5be3ecd0..ee125fadd1 100644 --- a/web/client/src/models/sqlmesh-model.ts +++ b/web/client/src/models/sqlmesh-model.ts @@ -24,8 +24,8 @@ export class ModelSQLMeshModel< name: string fqn: string - path: string - full_path: string + path: string = '' + full_path: string = '' dialect: string type: ModelType columns: Column[] @@ -50,8 +50,8 @@ export class ModelSQLMeshModel< this.name = encodeURI(this.initial.name) this.fqn = encodeURI(this.initial.fqn) this.default_catalog = this.initial.default_catalog - this.path = this.initial.path - this.full_path = this.initial.full_path + this.path = this.initial.path ?? '' + this.full_path = this.initial.full_path ?? '' this.dialect = this.initial.dialect this.description = this.initial.description this.sql = this.initial.sql diff --git a/web/server/api/endpoints/environments.py b/web/server/api/endpoints/environments.py index 1598e02cc4..3bc1fa033d 100644 --- a/web/server/api/endpoints/environments.py +++ b/web/server/api/endpoints/environments.py @@ -45,7 +45,7 @@ async def get_environments( ) -@router.delete("/{environment:str}") +@router.delete("/{environment:path}") async def delete_environment( response: Response, environment: str, diff --git a/web/server/api/endpoints/lineage.py b/web/server/api/endpoints/lineage.py index 5bef4601fd..b020f579fd 100644 --- a/web/server/api/endpoints/lineage.py +++ b/web/server/api/endpoints/lineage.py @@ -130,7 +130,7 @@ def create_models_only_lineage_adjacency_list( return graph -@router.get("/{model_name:str}/{column_name:str}") +@router.get("/{model_name:path}/columns/{column_name:str}") def column_lineage( model_name: str, column_name: str, @@ -150,7 +150,7 @@ def column_lineage( ) -@router.get("/{model_name:str}") +@router.get("/{model_name:path}") def model_lineage( model_name: str, context: Context = Depends(get_loaded_context), diff --git a/web/server/api/endpoints/models.py b/web/server/api/endpoints/models.py index 21a7b93eb0..a0eff28ff2 100644 --- a/web/server/api/endpoints/models.py +++ b/web/server/api/endpoints/models.py @@ -29,7 +29,7 @@ def get_models(context: Context = Depends(get_loaded_context)) -> t.List[models. @router.get( - "/{name:str}", + "/{name:path}", response_model=models.Model, response_model_exclude_unset=True, response_model_exclude_none=True,