diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml index 6b98d7909a..169b1dc00b 100644 --- a/.github/workflows/gen.yml +++ b/.github/workflows/gen.yml @@ -104,3 +104,89 @@ jobs: path: internal/engine/sqlite/dialect - name: Fail if the committed dialect differs run: git add -N internal/engine/sqlite && git diff --exit-code --stat -- internal/engine/sqlite + + mssql: + name: generate mssql dialect + runs-on: ubuntu-24.04 + services: + mssql: + image: mcr.microsoft.com/mssql/server:2025-latest + env: + ACCEPT_EULA: Y + MSSQL_SA_PASSWORD: Mysecretpassword1! + ports: + - 1433:1433 + options: --health-cmd "/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P 'Mysecretpassword1!' -Q 'SELECT 1'" --health-interval 10s --health-timeout 5s --health-retries 10 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + - run: go run ./cmd/goldeneye generate mssql + working-directory: internal/goldeneye + env: + MSSQL_SERVER_URI: sqlserver://sa:Mysecretpassword1!@localhost:${{ job.services.mssql.ports['1433'] }}?encrypt=disable + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-mssql + path: internal/engine/mssql/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/mssql && git diff --exit-code --stat -- internal/engine/mssql + + spanner: + name: generate googlesql dialect + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + # Spanner Omni is run the way its quickstart runs it, on the host + # network, since a service container cannot be given a command. + - name: Start Spanner Omni + run: | + docker run -d --name spanneromni --network host us-docker.pkg.dev/spanner-omni/images/spanner-omni:2026.r2.1-beta start-single-server + for i in $(seq 1 60); do + if docker exec spanneromni /google/spanner/bin/spanner databases list >/dev/null 2>&1; then exit 0; fi + sleep 5 + done + docker logs spanneromni + exit 1 + - run: go run ./cmd/goldeneye generate spanner + working-directory: internal/goldeneye + env: + SPANNER_SERVER_URI: localhost:15000 + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-googlesql + path: internal/engine/googlesql/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/googlesql && git diff --exit-code --stat -- internal/engine/googlesql + + duckdb: + name: generate duckdb dialect + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + go-version-file: internal/goldeneye/go.mod + check-latest: true + # The current build of DuckDB's v2.0 preview channel, until 2.0 is + # released: a later build than the dialect was generated from shows up + # as a difference. + - run: go run ./cmd/goldeneye install duckdb + working-directory: internal/goldeneye + - run: go run ./cmd/goldeneye generate duckdb + working-directory: internal/goldeneye + - name: Save results + uses: actions/upload-artifact@v7 + with: + name: dialect-duckdb + path: internal/engine/duckdb/dialect + - name: Fail if the committed dialect differs + run: git add -N internal/engine/duckdb && git diff --exit-code --stat -- internal/engine/duckdb diff --git a/CLAUDE.md b/CLAUDE.md index 37bad99dbe..fb53dbb230 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -150,15 +150,19 @@ from a live database by `/internal/goldeneye`, a nested module, and its tests verify the committed files against one byte for byte. The same module checks the `analyze_*` cases under `/internal/endtoend/testdata/` against what the database itself reports for them, so a `fixture.sql` next to a case's schema -gives the queries rows to run against. ClickHouse, MySQL and SQLite have the -check today; engines whose database is not available skip. +gives the queries rows to run against. ClickHouse, DuckDB, MySQL, SQLite, +SQL Server and Spanner have the check today; engines whose database is not +available skip. ```bash cd internal/goldeneye go run ./cmd/goldeneye install clickhouse # download the pinned clickhouse binary once +go run ./cmd/goldeneye install duckdb # download the current DuckDB 2.0 preview build once go run ./cmd/goldeneye install sqlite # build the pinned sqlite3 shells once; needs a C compiler POSTGRESQL_SERVER_URI="postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable" \ -MYSQL_SERVER_URI="root:mysecretpassword@tcp(127.0.0.1:3306)/mysql" go test ./... +MYSQL_SERVER_URI="root:mysecretpassword@tcp(127.0.0.1:3306)/mysql" \ +MSSQL_SERVER_URI="sqlserver://sa:Mysecretpassword1!@127.0.0.1:1433?encrypt=disable" \ +SPANNER_SERVER_URI="localhost:15000" go test ./... go run ./cmd/goldeneye generate postgresql # rewrite the files after a change ``` diff --git a/docker-compose.yml b/docker-compose.yml index 8025855ec2..2af58e1958 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,3 +19,21 @@ services: POSTGRES_DB: postgres POSTGRES_PASSWORD: mysecretpassword POSTGRES_USER: postgres + + mssql: + image: "mcr.microsoft.com/mssql/server:2025-latest" + ports: + - "1433:1433" + restart: always + environment: + ACCEPT_EULA: "Y" + MSSQL_SA_PASSWORD: "Mysecretpassword1!" + + # Spanner Omni, the downloadable Spanner, serves plaintext gRPC on port + # 15000 and its console on 15026; its quickstart runs it on the host + # network. + spanner: + image: "us-docker.pkg.dev/spanner-omni/images/spanner-omni:2026.r2.1-beta" + command: start-single-server + network_mode: host + restart: always diff --git a/internal/endtoend/testdata/analyze_basic/googlesql/schema.sql b/internal/endtoend/testdata/analyze_basic/googlesql/schema.sql index 1f45153b37..ff91a9af24 100644 --- a/internal/endtoend/testdata/analyze_basic/googlesql/schema.sql +++ b/internal/endtoend/testdata/analyze_basic/googlesql/schema.sql @@ -1,5 +1,5 @@ CREATE TABLE users ( id INT64 NOT NULL, - name STRING NOT NULL, - bio STRING, + name STRING(MAX) NOT NULL, + bio STRING(MAX), ) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_basic/googlesql/stdout.json b/internal/endtoend/testdata/analyze_basic/googlesql/stdout.json index b14d4a249e..bcc63771e5 100644 --- a/internal/endtoend/testdata/analyze_basic/googlesql/stdout.json +++ b/internal/endtoend/testdata/analyze_basic/googlesql/stdout.json @@ -13,7 +13,12 @@ { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } diff --git a/internal/endtoend/testdata/analyze_dml/googlesql/schema.sql b/internal/endtoend/testdata/analyze_dml/googlesql/schema.sql index 1f45153b37..ff91a9af24 100644 --- a/internal/endtoend/testdata/analyze_dml/googlesql/schema.sql +++ b/internal/endtoend/testdata/analyze_dml/googlesql/schema.sql @@ -1,5 +1,5 @@ CREATE TABLE users ( id INT64 NOT NULL, - name STRING NOT NULL, - bio STRING, + name STRING(MAX) NOT NULL, + bio STRING(MAX), ) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_dml/googlesql/stdout.json b/internal/endtoend/testdata/analyze_dml/googlesql/stdout.json index 4e696578c2..f2ee81de89 100644 --- a/internal/endtoend/testdata/analyze_dml/googlesql/stdout.json +++ b/internal/endtoend/testdata/analyze_dml/googlesql/stdout.json @@ -19,7 +19,12 @@ "column": { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } @@ -30,7 +35,12 @@ "name": "bio", "type": { "name": "string", - "nullable": true + "nullable": true, + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } @@ -51,7 +61,12 @@ { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } @@ -72,7 +87,12 @@ "column": { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } @@ -90,7 +110,12 @@ "name": "bio", "type": { "name": "string", - "nullable": true + "nullable": true, + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } @@ -121,7 +146,12 @@ { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } @@ -132,7 +162,12 @@ "column": { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } diff --git a/internal/endtoend/testdata/analyze_select/googlesql/schema.sql b/internal/endtoend/testdata/analyze_select/googlesql/schema.sql index 18ef00e682..0c5bc523f9 100644 --- a/internal/endtoend/testdata/analyze_select/googlesql/schema.sql +++ b/internal/endtoend/testdata/analyze_select/googlesql/schema.sql @@ -1,7 +1,7 @@ CREATE TABLE users ( id INT64 NOT NULL, - name STRING NOT NULL, - bio STRING, + name STRING(MAX) NOT NULL, + bio STRING(MAX), ) PRIMARY KEY (id); CREATE TABLE posts ( diff --git a/internal/endtoend/testdata/analyze_select/googlesql/stdout.json b/internal/endtoend/testdata/analyze_select/googlesql/stdout.json index 7f112f964b..919d31369c 100644 --- a/internal/endtoend/testdata/analyze_select/googlesql/stdout.json +++ b/internal/endtoend/testdata/analyze_select/googlesql/stdout.json @@ -13,7 +13,12 @@ { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" }, @@ -21,7 +26,12 @@ "name": "bio", "type": { "name": "string", - "nullable": true + "nullable": true, + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } @@ -48,7 +58,12 @@ { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" }, @@ -93,7 +108,12 @@ "column": { "name": "name", "type": { - "name": "string" + "name": "string", + "args": [ + { + "ident": "max" + } + ] }, "table": "users" } diff --git a/internal/endtoend/testdata/analyze_types/bigquery/exec.json b/internal/endtoend/testdata/analyze_types/bigquery/exec.json new file mode 100644 index 0000000000..a53ddddc6d --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/bigquery/exec.json @@ -0,0 +1,5 @@ +{ + "command": "analyze", + "args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"], + "contexts": ["base"] +} diff --git a/internal/endtoend/testdata/analyze_types/bigquery/query.sql b/internal/endtoend/testdata/analyze_types/bigquery/query.sql new file mode 100644 index 0000000000..c798e56371 --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/bigquery/query.sql @@ -0,0 +1,16 @@ +-- name: AllTypes :many +SELECT * FROM things; + +-- name: Casts :one +SELECT + CAST(@a AS NUMERIC(5,2)) AS a, + CAST(@b AS ARRAY) AS b, + CAST(@c AS STRUCT) AS c, + CAST(@d AS STRING(5)) AS d, + SAFE_CAST(@e AS BIGNUMERIC) AS e, + [1, 2] AS f +FROM things; + +-- name: Params :one +SELECT id FROM things +WHERE s = @s AND ai = @ai AND n = @n AND st = @st AND smax = @smax; diff --git a/internal/endtoend/testdata/analyze_types/bigquery/schema.sql b/internal/endtoend/testdata/analyze_types/bigquery/schema.sql new file mode 100644 index 0000000000..feb846800a --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/bigquery/schema.sql @@ -0,0 +1,21 @@ +CREATE TABLE things ( + id INT64 NOT NULL, + s STRING(10), + smax STRING(MAX), + n NUMERIC(10,2), + bn BIGNUMERIC, + byt BYTES(MAX), + ai ARRAY, + as2 ARRAY, + st STRUCT, + ast ARRAY>, + ts TIMESTAMP, + d DATE, + j JSON, + g GEOGRAPHY, + iv INTERVAL, + b BOOL, + f FLOAT64, + f32 FLOAT32, + tl TOKENLIST +) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_types/bigquery/stdout.json b/internal/endtoend/testdata/analyze_types/bigquery/stdout.json new file mode 100644 index 0000000000..bae5a9082a --- /dev/null +++ b/internal/endtoend/testdata/analyze_types/bigquery/stdout.json @@ -0,0 +1,482 @@ +[ + { + "name": "AllTypes", + "cmd": ":many", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "things" + }, + { + "name": "s", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + }, + { + "name": "smax", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + }, + { + "name": "n", + "type": { + "name": "numeric", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + }, + { + "name": "bn", + "type": { + "name": "bignumeric", + "nullable": true + }, + "table": "things" + }, + { + "name": "byt", + "type": { + "name": "bytes", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + }, + { + "name": "ai", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "int64" + } + } + ] + }, + "table": "things" + }, + { + "name": "as2", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "string", + "args": [ + { + "ident": "max" + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "st", + "type": { + "name": "struct", + "nullable": true, + "args": [ + { + "label": "a", + "type": { + "name": "int64" + } + }, + { + "label": "b", + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + }, + { + "name": "ast", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "struct", + "args": [ + { + "label": "x", + "type": { + "name": "int64" + } + } + ] + } + } + ] + }, + "table": "things" + }, + { + "name": "ts", + "type": { + "name": "timestamp", + "nullable": true + }, + "table": "things" + }, + { + "name": "d", + "type": { + "name": "date", + "nullable": true + }, + "table": "things" + }, + { + "name": "j", + "type": { + "name": "json", + "nullable": true + }, + "table": "things" + }, + { + "name": "g", + "type": { + "name": "geography", + "nullable": true + }, + "table": "things" + }, + { + "name": "iv", + "type": { + "name": "interval", + "nullable": true + }, + "table": "things" + }, + { + "name": "b", + "type": { + "name": "bool", + "nullable": true + }, + "table": "things" + }, + { + "name": "f", + "type": { + "name": "float64", + "nullable": true + }, + "table": "things" + }, + { + "name": "f32", + "type": { + "name": "float32", + "nullable": true + }, + "table": "things" + }, + { + "name": "tl", + "type": { + "name": "tokenlist", + "nullable": true + }, + "table": "things" + } + ], + "params": [] + }, + { + "name": "Casts", + "cmd": ":one", + "columns": [ + { + "name": "a", + "type": { + "name": "numeric", + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + }, + { + "name": "b", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + }, + { + "name": "c", + "type": { + "name": "struct", + "args": [ + { + "label": "x", + "type": { + "name": "int64" + } + } + ] + } + }, + { + "name": "d", + "type": { + "name": "string", + "args": [ + { + "int": 5 + } + ] + } + }, + { + "name": "e", + "type": { + "name": "bignumeric" + } + }, + { + "name": "f" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "", + "type": { + "name": "numeric", + "args": [ + { + "int": 5 + }, + { + "int": 2 + } + ] + } + } + }, + { + "number": 2, + "column": { + "name": "", + "type": { + "name": "array", + "args": [ + { + "type": { + "name": "int64" + } + } + ] + } + } + }, + { + "number": 3, + "column": { + "name": "", + "type": { + "name": "struct", + "args": [ + { + "label": "x", + "type": { + "name": "int64" + } + } + ] + } + } + }, + { + "number": 4, + "column": { + "name": "", + "type": { + "name": "string", + "args": [ + { + "int": 5 + } + ] + } + } + }, + { + "number": 5, + "column": { + "name": "", + "type": { + "name": "bignumeric" + } + } + } + ] + }, + { + "name": "Params", + "cmd": ":one", + "columns": [ + { + "name": "id", + "type": { + "name": "int64" + }, + "table": "things" + } + ], + "params": [ + { + "number": 1, + "column": { + "name": "s", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "int": 10 + } + ] + }, + "table": "things" + } + }, + { + "number": 2, + "column": { + "name": "ai", + "type": { + "name": "array", + "nullable": true, + "args": [ + { + "type": { + "name": "int64" + } + } + ] + }, + "table": "things" + } + }, + { + "number": 3, + "column": { + "name": "n", + "type": { + "name": "numeric", + "nullable": true, + "args": [ + { + "int": 10 + }, + { + "int": 2 + } + ] + }, + "table": "things" + } + }, + { + "number": 4, + "column": { + "name": "st", + "type": { + "name": "struct", + "nullable": true, + "args": [ + { + "label": "a", + "type": { + "name": "int64" + } + }, + { + "label": "b", + "type": { + "name": "string" + } + } + ] + }, + "table": "things" + } + }, + { + "number": 5, + "column": { + "name": "smax", + "type": { + "name": "string", + "nullable": true, + "args": [ + { + "ident": "max" + } + ] + }, + "table": "things" + } + } + ] + } +] diff --git a/internal/endtoend/testdata/analyze_types/googlesql/query.sql b/internal/endtoend/testdata/analyze_types/googlesql/query.sql index c798e56371..06cca17706 100644 --- a/internal/endtoend/testdata/analyze_types/googlesql/query.sql +++ b/internal/endtoend/testdata/analyze_types/googlesql/query.sql @@ -3,14 +3,12 @@ SELECT * FROM things; -- name: Casts :one SELECT - CAST(@a AS NUMERIC(5,2)) AS a, + CAST(@a AS NUMERIC) AS a, CAST(@b AS ARRAY) AS b, - CAST(@c AS STRUCT) AS c, - CAST(@d AS STRING(5)) AS d, - SAFE_CAST(@e AS BIGNUMERIC) AS e, - [1, 2] AS f + CAST(@d AS STRING) AS d, + SAFE_CAST(@e AS FLOAT64) AS e FROM things; -- name: Params :one SELECT id FROM things -WHERE s = @s AND ai = @ai AND n = @n AND st = @st AND smax = @smax; +WHERE s = @s AND n = @n AND smax = @smax AND f32 = @f32; diff --git a/internal/endtoend/testdata/analyze_types/googlesql/schema.sql b/internal/endtoend/testdata/analyze_types/googlesql/schema.sql index feb846800a..176f055732 100644 --- a/internal/endtoend/testdata/analyze_types/googlesql/schema.sql +++ b/internal/endtoend/testdata/analyze_types/googlesql/schema.sql @@ -2,20 +2,15 @@ CREATE TABLE things ( id INT64 NOT NULL, s STRING(10), smax STRING(MAX), - n NUMERIC(10,2), - bn BIGNUMERIC, + n NUMERIC, byt BYTES(MAX), ai ARRAY, as2 ARRAY, - st STRUCT, - ast ARRAY>, ts TIMESTAMP, d DATE, j JSON, - g GEOGRAPHY, - iv INTERVAL, b BOOL, f FLOAT64, f32 FLOAT32, - tl TOKENLIST + u UUID ) PRIMARY KEY (id); diff --git a/internal/endtoend/testdata/analyze_types/googlesql/stdout.json b/internal/endtoend/testdata/analyze_types/googlesql/stdout.json index bae5a9082a..2871cba269 100644 --- a/internal/endtoend/testdata/analyze_types/googlesql/stdout.json +++ b/internal/endtoend/testdata/analyze_types/googlesql/stdout.json @@ -40,22 +40,6 @@ "name": "n", "type": { "name": "numeric", - "nullable": true, - "args": [ - { - "int": 10 - }, - { - "int": 2 - } - ] - }, - "table": "things" - }, - { - "name": "bn", - "type": { - "name": "bignumeric", "nullable": true }, "table": "things" @@ -108,51 +92,6 @@ }, "table": "things" }, - { - "name": "st", - "type": { - "name": "struct", - "nullable": true, - "args": [ - { - "label": "a", - "type": { - "name": "int64" - } - }, - { - "label": "b", - "type": { - "name": "string" - } - } - ] - }, - "table": "things" - }, - { - "name": "ast", - "type": { - "name": "array", - "nullable": true, - "args": [ - { - "type": { - "name": "struct", - "args": [ - { - "label": "x", - "type": { - "name": "int64" - } - } - ] - } - } - ] - }, - "table": "things" - }, { "name": "ts", "type": { @@ -177,22 +116,6 @@ }, "table": "things" }, - { - "name": "g", - "type": { - "name": "geography", - "nullable": true - }, - "table": "things" - }, - { - "name": "iv", - "type": { - "name": "interval", - "nullable": true - }, - "table": "things" - }, { "name": "b", "type": { @@ -218,9 +141,9 @@ "table": "things" }, { - "name": "tl", + "name": "u", "type": { - "name": "tokenlist", + "name": "uuid", "nullable": true }, "table": "things" @@ -235,15 +158,7 @@ { "name": "a", "type": { - "name": "numeric", - "args": [ - { - "int": 5 - }, - { - "int": 2 - } - ] + "name": "numeric" } }, { @@ -259,39 +174,17 @@ ] } }, - { - "name": "c", - "type": { - "name": "struct", - "args": [ - { - "label": "x", - "type": { - "name": "int64" - } - } - ] - } - }, { "name": "d", "type": { - "name": "string", - "args": [ - { - "int": 5 - } - ] + "name": "string" } }, { "name": "e", "type": { - "name": "bignumeric" + "name": "float64" } - }, - { - "name": "f" } ], "params": [ @@ -300,15 +193,7 @@ "column": { "name": "", "type": { - "name": "numeric", - "args": [ - { - "int": 5 - }, - { - "int": 2 - } - ] + "name": "numeric" } } }, @@ -333,15 +218,7 @@ "column": { "name": "", "type": { - "name": "struct", - "args": [ - { - "label": "x", - "type": { - "name": "int64" - } - } - ] + "name": "string" } } }, @@ -350,21 +227,7 @@ "column": { "name": "", "type": { - "name": "string", - "args": [ - { - "int": 5 - } - ] - } - } - }, - { - "number": 5, - "column": { - "name": "", - "type": { - "name": "bignumeric" + "name": "float64" } } } @@ -401,60 +264,25 @@ }, { "number": 2, - "column": { - "name": "ai", - "type": { - "name": "array", - "nullable": true, - "args": [ - { - "type": { - "name": "int64" - } - } - ] - }, - "table": "things" - } - }, - { - "number": 3, "column": { "name": "n", "type": { "name": "numeric", - "nullable": true, - "args": [ - { - "int": 10 - }, - { - "int": 2 - } - ] + "nullable": true }, "table": "things" } }, { - "number": 4, + "number": 3, "column": { - "name": "st", + "name": "smax", "type": { - "name": "struct", + "name": "string", "nullable": true, "args": [ { - "label": "a", - "type": { - "name": "int64" - } - }, - { - "label": "b", - "type": { - "name": "string" - } + "ident": "max" } ] }, @@ -462,17 +290,12 @@ } }, { - "number": 5, + "number": 4, "column": { - "name": "smax", + "name": "f32", "type": { - "name": "string", - "nullable": true, - "args": [ - { - "ident": "max" - } - ] + "name": "float32", + "nullable": true }, "table": "things" } diff --git a/internal/endtoend/testdata/analyze_types/mssql/query.sql b/internal/endtoend/testdata/analyze_types/mssql/query.sql index 98d4e849db..e2075d7abd 100644 --- a/internal/endtoend/testdata/analyze_types/mssql/query.sql +++ b/internal/endtoend/testdata/analyze_types/mssql/query.sql @@ -3,15 +3,22 @@ SELECT * FROM things; -- name: Casts :one SELECT - CAST(@a AS DECIMAL(5,2)) AS a, - CAST(@b AS NVARCHAR(MAX)) AS b, - CAST(@c AS VARCHAR(10)) AS c, - CONVERT(DATETIME2(3), @d) AS d, - CAST(@e AS dbo.PhoneNumber) AS e, - TRY_CAST(@f AS FLOAT(24)) AS f, - CAST(@g AS dbo.Code) AS g -FROM things; + CAST(amount AS DECIMAL(5,2)) AS a, + CAST(title AS NVARCHAR(MAX)) AS b, + CAST(body AS VARCHAR(10)) AS c, + CONVERT(DATETIME2(3), updated) AS d, + CAST(amount AS MONEY) AS e, + CAST(f53 AS FLOAT(24)) AS f, + CAST(code AS CHAR(3)) AS g +FROM things +WHERE CAST(@a AS DECIMAL(5,2)) > 0 + AND CAST(@b AS NVARCHAR(MAX)) <> N'' + AND CAST(@c AS VARCHAR(10)) <> '' + AND CONVERT(DATETIME2(3), @d) > '2000-01-01' + AND CAST(@e AS MONEY) > 0 + AND TRY_CAST(@f AS FLOAT(24)) > 0 + AND CAST(@g AS CHAR(3)) <> ''; -- name: Params :one SELECT id FROM things -WHERE price = @price AND body = @body AND phone = @phone AND vec = @vec AND offset_at = @offset_at; +WHERE price = @price AND body = @body AND phone = @phone AND offset_at = @offset_at; diff --git a/internal/endtoend/testdata/analyze_types/mssql/stdout.json b/internal/endtoend/testdata/analyze_types/mssql/stdout.json index e5cad94250..e52bc1c756 100644 --- a/internal/endtoend/testdata/analyze_types/mssql/stdout.json +++ b/internal/endtoend/testdata/analyze_types/mssql/stdout.json @@ -262,8 +262,7 @@ { "name": "rv", "type": { - "name": "rowversion", - "nullable": true + "name": "rowversion" }, "table": "things" }, @@ -300,7 +299,6 @@ "name": "sn", "type": { "name": "nvarchar", - "nullable": true, "args": [ { "int": 128 @@ -356,6 +354,7 @@ "name": "a", "type": { "name": "decimal", + "nullable": true, "args": [ { "int": 5 @@ -370,6 +369,7 @@ "name": "b", "type": { "name": "nvarchar", + "nullable": true, "args": [ { "ident": "max" @@ -381,6 +381,7 @@ "name": "c", "type": { "name": "varchar", + "nullable": true, "args": [ { "int": 10 @@ -392,6 +393,7 @@ "name": "d", "type": { "name": "datetime2", + "nullable": true, "args": [ { "int": 3 @@ -402,19 +404,27 @@ { "name": "e", "type": { - "name": "phonenumber" + "name": "money", + "nullable": true } }, { "name": "f", "type": { - "name": "real" + "name": "real", + "nullable": true } }, { "name": "g", "type": { - "name": "code" + "name": "char", + "nullable": true, + "args": [ + { + "int": 3 + } + ] } } ], @@ -483,7 +493,7 @@ "column": { "name": "", "type": { - "name": "phonenumber" + "name": "money" } } }, @@ -501,7 +511,12 @@ "column": { "name": "", "type": { - "name": "code" + "name": "char", + "args": [ + { + "int": 3 + } + ] } } } @@ -566,22 +581,6 @@ }, { "number": 4, - "column": { - "name": "vec", - "type": { - "name": "vector", - "nullable": true, - "args": [ - { - "int": 3 - } - ] - }, - "table": "things" - } - }, - { - "number": 5, "column": { "name": "offset_at", "type": { diff --git a/internal/engine/duckdb/dialect/functions.jsonl b/internal/engine/duckdb/dialect/functions.jsonl index c7e85c7c7c..84ac52aa49 100644 --- a/internal/engine/duckdb/dialect/functions.jsonl +++ b/internal/engine/duckdb/dialect/functions.jsonl @@ -1,5 +1,6 @@ {"name":"__between","args":[{"type":"any"},{"type":"any"},{"type":"any"}],"returns":"boolean"} {"name":"__cast","args":[{"type":"any"}],"returns":"any"} +{"name":"__internal_barrier","args":[{"type":"any"}],"returns":"any"} {"name":"__internal_compress_geometry_point","args":[{"type":"geometry"}],"returns":"uhugeint"} {"name":"__internal_compress_integral_ubigint","args":[{"type":"hugeint"},{"type":"hugeint"}],"returns":"ubigint"} {"name":"__internal_compress_integral_ubigint","args":[{"type":"uhugeint"},{"type":"uhugeint"}],"returns":"ubigint"} @@ -2198,6 +2199,7 @@ {"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar"} {"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"integer"},{"type":"varchar"}],"returns":"varchar"} {"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"integer"}],"returns":"varchar"} +{"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} {"name":"regexp_extract","args":[{"type":"varchar"},{"type":"varchar"}],"returns":"varchar"} {"name":"regexp_extract_all","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar[]"},{"type":"varchar"}],"returns":"varchar[]"} {"name":"regexp_extract_all","args":[{"type":"varchar"},{"type":"varchar"},{"type":"varchar[]"}],"returns":"varchar[]"} @@ -2278,6 +2280,22 @@ {"name":"round","args":[{"type":"smallint"}],"returns":"smallint"} {"name":"round","args":[{"type":"tinyint"},{"type":"integer"}],"returns":"tinyint"} {"name":"round","args":[{"type":"tinyint"}],"returns":"tinyint"} +{"name":"round_even","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"round_even","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal"} +{"name":"round_even","args":[{"type":"double"},{"type":"integer"}],"returns":"double"} +{"name":"round_even","args":[{"type":"float"},{"type":"integer"}],"returns":"float"} +{"name":"round_even","args":[{"type":"hugeint"},{"type":"integer"}],"returns":"hugeint"} +{"name":"round_even","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"round_even","args":[{"type":"smallint"},{"type":"integer"}],"returns":"smallint"} +{"name":"round_even","args":[{"type":"tinyint"},{"type":"integer"}],"returns":"tinyint"} +{"name":"roundbankers","args":[{"type":"bigint"},{"type":"integer"}],"returns":"bigint"} +{"name":"roundbankers","args":[{"type":"decimal"},{"type":"integer"}],"returns":"decimal"} +{"name":"roundbankers","args":[{"type":"double"},{"type":"integer"}],"returns":"double"} +{"name":"roundbankers","args":[{"type":"float"},{"type":"integer"}],"returns":"float"} +{"name":"roundbankers","args":[{"type":"hugeint"},{"type":"integer"}],"returns":"hugeint"} +{"name":"roundbankers","args":[{"type":"integer"},{"type":"integer"}],"returns":"integer"} +{"name":"roundbankers","args":[{"type":"smallint"},{"type":"integer"}],"returns":"smallint"} +{"name":"roundbankers","args":[{"type":"tinyint"},{"type":"integer"}],"returns":"tinyint"} {"name":"row","args":[{"type":"any","mode":"v"}],"returns":"tuple"} {"name":"row_number","kind":"w","returns":"bigint"} {"name":"row_to_json","args":[{"type":"any","mode":"v"}],"returns":"json"} @@ -2457,7 +2475,9 @@ {"name":"timezone","args":[{"type":"time_ns"}],"returns":"bigint"} {"name":"timezone","args":[{"type":"varchar"},{"type":"time with time zone"}],"returns":"time with time zone"} {"name":"timezone","args":[{"type":"varchar"},{"type":"timestamp with time zone"}],"returns":"timestamp"} +{"name":"timezone","args":[{"type":"varchar"},{"type":"timestamptz_ns"}],"returns":"timestamp_ns"} {"name":"timezone","args":[{"type":"varchar"},{"type":"timestamp"}],"returns":"timestamp with time zone"} +{"name":"timezone","args":[{"type":"varchar"},{"type":"timestamp_ns"}],"returns":"timestamptz_ns"} {"name":"timezone_hour","args":[{"type":"date"}],"returns":"bigint"} {"name":"timezone_hour","args":[{"type":"interval"}],"returns":"bigint"} {"name":"timezone_hour","args":[{"type":"time with time zone"}],"returns":"bigint"} @@ -2580,6 +2600,7 @@ {"name":"variant_extract","args":[{"type":"variant"},{"type":"varchar"}],"returns":"variant"} {"name":"variant_extract_string","args":[{"type":"variant"},{"type":"varchar[]"}],"returns":"varchar[]"} {"name":"variant_extract_string","args":[{"type":"variant"},{"type":"varchar"}],"returns":"varchar"} +{"name":"variant_group_object","kind":"a","args":[{"type":"varchar"},{"type":"variant"}],"returns":"variant","nullable":true} {"name":"variant_keys","args":[{"type":"variant"},{"type":"varchar[]"}],"returns":"varchar[][]"} {"name":"variant_keys","args":[{"type":"variant"},{"type":"varchar"}],"returns":"varchar[]"} {"name":"variant_keys","args":[{"type":"variant"}],"returns":"varchar[]"} diff --git a/internal/engine/googlesql/dialect/relations.jsonl b/internal/engine/googlesql/dialect/relations.jsonl new file mode 100644 index 0000000000..03e4e78e1e --- /dev/null +++ b/internal/engine/googlesql/dialect/relations.jsonl @@ -0,0 +1,98 @@ +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAMS","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"ALL","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAM_COLUMNS","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAM_OPTIONS","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAM_PRIVILEGES","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHANGE_STREAM_TABLES","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"ALL_COLUMNS","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CHECK_CONSTRAINTS","kind":"v","columns":[{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true},{"name":"CHECK_CLAUSE","type":"string(max)","not_null":true},{"name":"SPANNER_STATE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"COLUMNS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64","not_null":true},{"name":"COLUMN_DEFAULT","type":"string(max)"},{"name":"DATA_TYPE","type":"string(max)"},{"name":"IS_NULLABLE","type":"string(max)"},{"name":"SPANNER_TYPE","type":"string(max)"},{"name":"IS_GENERATED","type":"string(max)","not_null":true},{"name":"GENERATION_EXPRESSION","type":"string(max)"},{"name":"IS_STORED","type":"string(max)"},{"name":"IS_HIDDEN","type":"bool","not_null":true},{"name":"SPANNER_STATE","type":"string(max)"},{"name":"IS_IDENTITY","type":"string(max)"},{"name":"IDENTITY_GENERATION","type":"string(max)"},{"name":"IDENTITY_KIND","type":"string(max)"},{"name":"IDENTITY_START_WITH_COUNTER","type":"string(max)"},{"name":"IDENTITY_SKIP_RANGE_MIN","type":"string(max)"},{"name":"IDENTITY_SKIP_RANGE_MAX","type":"string(max)"},{"name":"ON_UPDATE_EXPRESSION","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"COLUMN_COLUMN_USAGE","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"DEPENDENT_COLUMN","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"COLUMN_OPTIONS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"COLUMN_PRIVILEGES","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CONSTRAINT_COLUMN_USAGE","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"CONSTRAINT_TABLE_USAGE","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"DATABASE_OPTIONS","kind":"v","columns":[{"name":"CATALOG_NAME","type":"string(max)","not_null":true},{"name":"SCHEMA_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"INDEXES","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"INDEX_NAME","type":"string(max)","not_null":true},{"name":"INDEX_TYPE","type":"string(max)","not_null":true},{"name":"PARENT_TABLE_NAME","type":"string(max)","not_null":true},{"name":"IS_UNIQUE","type":"bool","not_null":true},{"name":"IS_NULL_FILTERED","type":"bool","not_null":true},{"name":"INDEX_STATE","type":"string(100)","not_null":true},{"name":"FILTER","type":"string(max)"},{"name":"SPANNER_IS_MANAGED","type":"bool","not_null":true},{"name":"SEARCH_PARTITION_BY","type":"string(max)","array":true},{"name":"SEARCH_ORDER_BY","type":"string(max)","array":true},{"name":"SEARCH_UNNEST","type":"string(max)","array":true}]} +{"schema":"INFORMATION_SCHEMA","name":"INDEX_COLUMNS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"INDEX_NAME","type":"string(max)","not_null":true},{"name":"INDEX_TYPE","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64"},{"name":"COLUMN_ORDERING","type":"string(max)"},{"name":"IS_NULLABLE","type":"string(max)"},{"name":"SPANNER_TYPE","type":"string(max)"},{"name":"EXPRESSION","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"INDEX_OPTIONS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"INDEX_NAME","type":"string(max)","not_null":true},{"name":"INDEX_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"KEY_COLUMN_USAGE","kind":"v","columns":[{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64","not_null":true},{"name":"POSITION_IN_UNIQUE_CONSTRAINT","type":"int64"}]} +{"schema":"INFORMATION_SCHEMA","name":"LOCALITY_GROUP_OPTIONS","kind":"v","columns":[{"name":"LOCALITY_GROUP_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"MODELS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"IS_REMOTE","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"MODEL_COLUMNS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_KIND","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64","not_null":true},{"name":"DATA_TYPE","type":"string(max)","not_null":true},{"name":"IS_EXPLICIT","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"MODEL_COLUMN_OPTIONS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_KIND","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"MODEL_OPTIONS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"MODEL_PRIVILEGES","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"PARAMETERS","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"ORDINAL_POSITION","type":"int64","not_null":true},{"name":"PARAMETER_NAME","type":"string(max)","not_null":true},{"name":"DATA_TYPE","type":"string(max)","not_null":true},{"name":"PARAMETER_DEFAULT","type":"string(max)"},{"name":"SPANNER_TYPE","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"PLACEMENTS","kind":"v","columns":[{"name":"PLACEMENT_NAME","type":"string(max)","not_null":true},{"name":"IS_DEFAULT","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"PLACEMENT_OPTIONS","kind":"v","columns":[{"name":"PLACEMENT_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"PROPERTY_GRAPHS","kind":"v","columns":[{"name":"PROPERTY_GRAPH_CATALOG","type":"string(max)","not_null":true},{"name":"PROPERTY_GRAPH_SCHEMA","type":"string(max)","not_null":true},{"name":"PROPERTY_GRAPH_NAME","type":"string(max)","not_null":true},{"name":"PROPERTY_GRAPH_METADATA_JSON","type":"json"}]} +{"schema":"INFORMATION_SCHEMA","name":"REFERENTIAL_CONSTRAINTS","kind":"v","columns":[{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true},{"name":"UNIQUE_CONSTRAINT_CATALOG","type":"string(max)"},{"name":"UNIQUE_CONSTRAINT_SCHEMA","type":"string(max)"},{"name":"UNIQUE_CONSTRAINT_NAME","type":"string(max)"},{"name":"MATCH_OPTION","type":"string(max)","not_null":true},{"name":"UPDATE_RULE","type":"string(max)","not_null":true},{"name":"DELETE_RULE","type":"string(max)","not_null":true},{"name":"SPANNER_STATE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLES","kind":"v","columns":[{"name":"ROLE_NAME","type":"string(max)","not_null":true},{"name":"IS_SYSTEM","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_CHANGE_STREAM_GRANTS","kind":"v","columns":[{"name":"CHANGE_STREAM_CATALOG","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_SCHEMA","type":"string(max)","not_null":true},{"name":"CHANGE_STREAM_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_COLUMN_GRANTS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"COLUMN_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_GRANTEES","kind":"v","columns":[{"name":"ROLE_NAME","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_MODEL_GRANTS","kind":"v","columns":[{"name":"MODEL_CATALOG","type":"string(max)","not_null":true},{"name":"MODEL_SCHEMA","type":"string(max)","not_null":true},{"name":"MODEL_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_ROUTINE_GRANTS","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROLE_TABLE_GRANTS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROUTINES","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"ROUTINE_CATALOG","type":"string(max)","not_null":true},{"name":"ROUTINE_SCHEMA","type":"string(max)","not_null":true},{"name":"ROUTINE_NAME","type":"string(max)","not_null":true},{"name":"ROUTINE_TYPE","type":"string(max)","not_null":true},{"name":"DATA_TYPE","type":"string(max)","not_null":true},{"name":"ROUTINE_BODY","type":"string(max)","not_null":true},{"name":"ROUTINE_DEFINITION","type":"string(max)","not_null":true},{"name":"SECURITY_TYPE","type":"string(max)","not_null":true},{"name":"SPANNER_TYPE","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"ROUTINE_OPTIONS","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"ROUTINE_PRIVILEGES","kind":"v","columns":[{"name":"SPECIFIC_CATALOG","type":"string(max)","not_null":true},{"name":"SPECIFIC_SCHEMA","type":"string(max)","not_null":true},{"name":"SPECIFIC_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"SCHEMATA","kind":"v","columns":[{"name":"CATALOG_NAME","type":"string(max)","not_null":true},{"name":"SCHEMA_NAME","type":"string(max)","not_null":true},{"name":"EFFECTIVE_TIMESTAMP","type":"int64"},{"name":"PROTO_BUNDLE","type":"proto('proto2.FileDescriptorSet')"},{"name":"SCHEMA_OWNER","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"SEQUENCES","kind":"v","columns":[{"name":"CATALOG","type":"string(max)","not_null":true},{"name":"SCHEMA","type":"string(max)","not_null":true},{"name":"NAME","type":"string(max)","not_null":true},{"name":"DATA_TYPE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"SEQUENCE_OPTIONS","kind":"v","columns":[{"name":"CATALOG","type":"string(max)","not_null":true},{"name":"SCHEMA","type":"string(max)","not_null":true},{"name":"NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"SPANNER_STATISTICS","kind":"v","columns":[{"name":"CATALOG_NAME","type":"string(max)","not_null":true},{"name":"SCHEMA_NAME","type":"string(max)","not_null":true},{"name":"PACKAGE_NAME","type":"string(max)","not_null":true},{"name":"ALLOW_GC","type":"bool","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLES","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"PARENT_TABLE_NAME","type":"string(max)"},{"name":"ON_DELETE_ACTION","type":"string(max)"},{"name":"TABLE_TYPE","type":"string(32)","not_null":true},{"name":"SPANNER_STATE","type":"string(max)"},{"name":"INTERLEAVE_TYPE","type":"string(max)"},{"name":"ROW_DELETION_POLICY_EXPRESSION","type":"string(max)"}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLE_CONSTRAINTS","kind":"v","columns":[{"name":"CONSTRAINT_CATALOG","type":"string(max)","not_null":true},{"name":"CONSTRAINT_SCHEMA","type":"string(max)","not_null":true},{"name":"CONSTRAINT_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"CONSTRAINT_TYPE","type":"string(max)","not_null":true},{"name":"IS_DEFERRABLE","type":"string(max)","not_null":true},{"name":"INITIALLY_DEFERRED","type":"string(max)","not_null":true},{"name":"ENFORCED","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLE_OPTIONS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"OPTION_NAME","type":"string(max)","not_null":true},{"name":"OPTION_TYPE","type":"string(max)","not_null":true},{"name":"OPTION_VALUE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLE_PRIVILEGES","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"PRIVILEGE_TYPE","type":"string(max)","not_null":true},{"name":"GRANTEE","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"TABLE_SYNONYMS","kind":"v","columns":[{"name":"SYNONYM_CATALOG","type":"string(max)","not_null":true},{"name":"SYNONYM_SCHEMA","type":"string(max)","not_null":true},{"name":"SYNONYM_NAME","type":"string(max)","not_null":true},{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true}]} +{"schema":"INFORMATION_SCHEMA","name":"VIEWS","kind":"v","columns":[{"name":"TABLE_CATALOG","type":"string(max)","not_null":true},{"name":"TABLE_SCHEMA","type":"string(max)","not_null":true},{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"VIEW_DEFINITION","type":"string(max)"},{"name":"SECURITY_TYPE","type":"string(max)","not_null":true}]} +{"schema":"SPANNER_SYS","name":"ACTIVE_PARTITIONED_DMLS","kind":"v","columns":[{"name":"TEXT","type":"string(max)"},{"name":"TEXT_FINGERPRINT","type":"string(max)"},{"name":"SESSION_ID","type":"string(max)"},{"name":"NUM_PARTITIONS_TOTAL","type":"int64"},{"name":"NUM_PARTITIONS_COMPLETE","type":"int64"},{"name":"NUM_TRIVIAL_PARTITIONS_COMPLETE","type":"int64"},{"name":"PROGRESS","type":"string(max)"},{"name":"ROWS_PROCESSED","type":"int64"},{"name":"START_TIMESTAMP","type":"timestamp"},{"name":"LAST_UPDATE_TIMESTAMP","type":"timestamp"}]} +{"schema":"SPANNER_SYS","name":"ACTIVE_QUERIES_SUMMARY","kind":"v","columns":[{"name":"ACTIVE_COUNT","type":"int64"},{"name":"OLDEST_START_TIME","type":"timestamp"},{"name":"COUNT_OLDER_THAN_1S","type":"int64"},{"name":"COUNT_OLDER_THAN_10S","type":"int64"},{"name":"COUNT_OLDER_THAN_100S","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"COLUMN_OPERATIONS_STATS_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"COLUMN_NAME","type":"string(max)"},{"name":"QUERY_COUNT","type":"int64"},{"name":"READ_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"IS_QUERY_CACHE_MEMORY_CAPPED","type":"bool"}]} +{"schema":"SPANNER_SYS","name":"COLUMN_OPERATIONS_STATS_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"COLUMN_NAME","type":"string(max)"},{"name":"QUERY_COUNT","type":"int64"},{"name":"READ_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"IS_QUERY_CACHE_MEMORY_CAPPED","type":"bool"}]} +{"schema":"SPANNER_SYS","name":"COLUMN_OPERATIONS_STATS_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"COLUMN_NAME","type":"string(max)"},{"name":"QUERY_COUNT","type":"int64"},{"name":"READ_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"IS_QUERY_CACHE_MEMORY_CAPPED","type":"bool"}]} +{"schema":"SPANNER_SYS","name":"GRAPH_OPERATION_EXECUTION_STATUS","kind":"v","columns":[{"name":"QUERY_ID","type":"string(max)"},{"name":"QUERY_TEXT","type":"string(max)"},{"name":"START_TIMESTAMP","type":"timestamp"},{"name":"LAST_UPDATE_TIMESTAMP","type":"timestamp"},{"name":"PROGRESS","type":"float64"},{"name":"STATUS","type":"string(max)"},{"name":"ERROR_MESSAGE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"ROW_RANGE_START_KEY","type":"bytes(max)"},{"name":"LOCK_WAIT_SECONDS","type":"float64"},{"name":"SAMPLE_LOCK_REQUESTS","type":"struct(COLUMN: string(max), LOCK_MODE: string(max), TRANSACTION_TAG: string(max))","array":true},{"name":"SAMPLE_LOCK_REQUESTS_JSON_STRING","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"ROW_RANGE_START_KEY","type":"bytes(max)"},{"name":"LOCK_WAIT_SECONDS","type":"float64"},{"name":"SAMPLE_LOCK_REQUESTS","type":"struct(COLUMN: string(max), LOCK_MODE: string(max), TRANSACTION_TAG: string(max))","array":true},{"name":"SAMPLE_LOCK_REQUESTS_JSON_STRING","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"ROW_RANGE_START_KEY","type":"bytes(max)"},{"name":"LOCK_WAIT_SECONDS","type":"float64"},{"name":"SAMPLE_LOCK_REQUESTS","type":"struct(COLUMN: string(max), LOCK_MODE: string(max), TRANSACTION_TAG: string(max))","array":true},{"name":"SAMPLE_LOCK_REQUESTS_JSON_STRING","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOTAL_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TOTAL_LOCK_WAIT_SECONDS","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOTAL_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TOTAL_LOCK_WAIT_SECONDS","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"LOCK_STATS_TOTAL_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TOTAL_LOCK_WAIT_SECONDS","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"OLDEST_ACTIVE_QUERIES","kind":"v","columns":[{"name":"START_TIME","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"TEXT","type":"string(max)"},{"name":"TEXT_TRUNCATED","type":"bool"},{"name":"SESSION_ID","type":"string(max)"},{"name":"QUERY_ID","type":"string(max)"},{"name":"CLIENT_IP_ADDRESS","type":"string(max)"},{"name":"API_CLIENT_HEADER","type":"string(max)"},{"name":"USER_AGENT_HEADER","type":"string(max)"},{"name":"SERVER_REGION","type":"string(max)"},{"name":"PRIORITY","type":"string(max)"},{"name":"TRANSACTION_TYPE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_PROFILES_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"LATENCY_SECONDS","type":"float64"},{"name":"QUERY_PROFILE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_PROFILES_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"LATENCY_SECONDS","type":"float64"},{"name":"QUERY_PROFILE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_PROFILES_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"LATENCY_SECONDS","type":"float64"},{"name":"QUERY_PROFILE","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_RECOMMENDATIONS","kind":"v","columns":[{"name":"GENERATION_TIME","type":"timestamp"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"QUERY_RECOMMENDATIONS","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT","type":"string(max)"},{"name":"TEXT_TRUNCATED","type":"bool"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"STATEMENT_COUNT","type":"int64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"QUERY_TYPE","type":"string(max)"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"},{"name":"QUERY_OPTIMIZER_VERSIONS","type":"int64","array":true},{"name":"STATISTICS_PACKAGE_NAMES","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT","type":"string(max)"},{"name":"TEXT_TRUNCATED","type":"bool"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"STATEMENT_COUNT","type":"int64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"QUERY_TYPE","type":"string(max)"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"},{"name":"QUERY_OPTIMIZER_VERSIONS","type":"int64","array":true},{"name":"STATISTICS_PACKAGE_NAMES","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TEXT","type":"string(max)"},{"name":"TEXT_TRUNCATED","type":"bool"},{"name":"TEXT_FINGERPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"STATEMENT_COUNT","type":"int64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"QUERY_TYPE","type":"string(max)"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"},{"name":"QUERY_OPTIMIZER_VERSIONS","type":"int64","array":true},{"name":"STATISTICS_PACKAGE_NAMES","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOTAL_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOTAL_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"QUERY_STATS_TOTAL_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_ROWS_SCANNED","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"CANCELLED_OR_DISCONNECTED_EXECUTION_COUNT","type":"int64"},{"name":"TIMED_OUT_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_EXECUTION_COUNT","type":"int64"},{"name":"ALL_FAILED_AVG_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES_WRITTEN","type":"float64"},{"name":"AVG_ROWS_WRITTEN","type":"float64"},{"name":"LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_MEMORY_PEAK_USAGE_BYTES","type":"float64"},{"name":"AVG_MEMORY_USAGE_PERCENTAGE","type":"float64"},{"name":"AVG_QUERY_PLAN_CREATION_TIME_SECS","type":"float64"},{"name":"AVG_FILESYSTEM_DELAY_SECS","type":"float64"},{"name":"AVG_REMOTE_SERVER_CALLS","type":"float64"},{"name":"AVG_ROWS_SPOOLED","type":"float64"},{"name":"AVG_DISK_IO_COST","type":"float64"},{"name":"LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"AVG_COLUMNAR_READ_SHARE","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"FPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"READ_TYPE","type":"string(max)"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"FPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"READ_TYPE","type":"string(max)"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"FPRINT","type":"int64"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"REQUEST_TAG","type":"string(max)"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"READ_TYPE","type":"string(max)"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOTAL_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOTAL_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"READ_STATS_TOTAL_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"EXECUTION_COUNT","type":"int64"},{"name":"AVG_ROWS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"AVG_CPU_SECONDS","type":"float64"},{"name":"AVG_LOCKING_DELAY_SECONDS","type":"float64"},{"name":"AVG_CLIENT_WAIT_SECONDS","type":"float64"},{"name":"AVG_LEADER_REFRESH_DELAY_SECONDS","type":"float64"},{"name":"RUN_IN_RW_TRANSACTION_EXECUTION_COUNT","type":"int64"},{"name":"AVG_DISK_IO_COST","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"ROW_DELETION_POLICIES","kind":"v","columns":[{"name":"TABLE_NAME","type":"string(max)","not_null":true},{"name":"PROCESSED_WATERMARK","type":"timestamp"},{"name":"UNDELETABLE_ROWS","type":"int64","not_null":true},{"name":"MIN_UNDELETABLE_TIMESTAMP","type":"timestamp"}]} +{"schema":"SPANNER_SYS","name":"SCHEMA_RECOMMENDATIONS","kind":"v","columns":[{"name":"GENERATION_TIME","type":"timestamp"},{"name":"FINGERPRINT","type":"string(max)"},{"name":"SCHEMA_RECOMMENDATIONS","type":"string(max)"}]} +{"schema":"SPANNER_SYS","name":"SPLIT_HOTNESS_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"SPLIT_START","type":"string(max)"},{"name":"SPLIT_LIMIT","type":"string(max)"},{"name":"AFFECTED_TABLES","type":"string(max)","array":true},{"name":"HOTNESS","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"SPLIT_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"SPLIT_START","type":"string(max)"},{"name":"SPLIT_LIMIT","type":"string(max)"},{"name":"AFFECTED_TABLES","type":"string(max)","array":true},{"name":"CPU_USAGE_SCORE","type":"int64"},{"name":"UNSPLITTABLE_REASONS","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"SPLIT_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"SPLIT_START","type":"string(max)"},{"name":"SPLIT_LIMIT","type":"string(max)"},{"name":"AFFECTED_TABLES","type":"string(max)","array":true},{"name":"CPU_USAGE_SCORE","type":"int64"},{"name":"UNSPLITTABLE_REASONS","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"SPLIT_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"SPLIT_START","type":"string(max)"},{"name":"SPLIT_LIMIT","type":"string(max)"},{"name":"AFFECTED_TABLES","type":"string(max)","array":true},{"name":"CPU_USAGE_SCORE","type":"int64"},{"name":"UNSPLITTABLE_REASONS","type":"string(max)","array":true}]} +{"schema":"SPANNER_SYS","name":"SUPPORTED_OPTIMIZER_VERSIONS","kind":"v","columns":[{"name":"VERSION","type":"int64","not_null":true},{"name":"RELEASE_DATE","type":"date","not_null":true},{"name":"IS_DEFAULT","type":"bool","not_null":true}]} +{"schema":"SPANNER_SYS","name":"TABLE_OPERATIONS_STATS_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"READ_QUERY_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"DELETE_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TABLE_OPERATIONS_STATS_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"READ_QUERY_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"DELETE_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TABLE_OPERATIONS_STATS_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"READ_QUERY_COUNT","type":"int64"},{"name":"WRITE_COUNT","type":"int64"},{"name":"DELETE_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TABLE_SIZES_STATS_1HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"USED_BYTES","type":"float64"},{"name":"USED_SSD_BYTES","type":"float64"},{"name":"USED_HDD_BYTES","type":"float64"},{"name":"COLUMNAR_USED_BYTES","type":"float64"},{"name":"COLUMNAR_USED_SSD_BYTES","type":"float64"},{"name":"COLUMNAR_USED_HDD_BYTES","type":"float64"},{"name":"COLUMNAR_COVERAGE_RATIO","type":"float64"},{"name":"COLUMNAR_SSD_COVERAGE_RATIO","type":"float64"},{"name":"COLUMNAR_HDD_COVERAGE_RATIO","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"TABLE_SIZES_STATS_PER_LOCALITY_GROUP_1HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"TABLE_NAME","type":"string(max)"},{"name":"LOCALITY_GROUP","type":"string(max)"},{"name":"USED_SSD_BYTES","type":"float64"},{"name":"USED_HDD_BYTES","type":"float64"}]} +{"schema":"SPANNER_SYS","name":"TASKS","kind":"v","columns":[{"name":"TASK_NAME","type":"string(max)","not_null":true},{"name":"PROCESSED_WATERMARK","type":"timestamp"},{"name":"LAST_RUN_STATUS","type":"string(max)"},{"name":"UNDELETABLE_ROWS","type":"int64","not_null":true}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOP_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"FPRINT","type":"int64"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_CONSTRUCTIVE_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_DELETE_TABLES","type":"string(max)","array":true},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"TRANSACTION_TAG","type":"string(max)"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOP_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"FPRINT","type":"int64"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_CONSTRUCTIVE_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_DELETE_TABLES","type":"string(max)","array":true},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"TRANSACTION_TAG","type":"string(max)"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOP_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"FPRINT","type":"int64"},{"name":"READ_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_CONSTRUCTIVE_COLUMNS","type":"string(max)","array":true},{"name":"WRITE_DELETE_TABLES","type":"string(max)","array":true},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"TRANSACTION_TAG","type":"string(max)"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOTAL_10MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOTAL_HOUR","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"TXN_STATS_TOTAL_MINUTE","kind":"v","columns":[{"name":"INTERVAL_END","type":"timestamp"},{"name":"COMMIT_ATTEMPT_COUNT","type":"int64"},{"name":"COMMIT_FAILED_PRECONDITION_COUNT","type":"int64"},{"name":"COMMIT_ABORT_COUNT","type":"int64"},{"name":"AVG_PARTICIPANTS","type":"float64"},{"name":"AVG_TOTAL_LATENCY_SECONDS","type":"float64"},{"name":"AVG_COMMIT_LATENCY_SECONDS","type":"float64"},{"name":"AVG_BYTES","type":"float64"},{"name":"COMMIT_RETRY_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE","type":"struct(TABLE_NAME: string(max), INSERT_OR_UPDATE_COUNT: int64, INSERT_OR_UPDATE_BYTES: int64)","array":true},{"name":"TOTAL_LATENCY_DISTRIBUTION","type":"struct(COUNT: int64, MEAN: float64, SUM_OF_SQUARED_DEVIATION: float64, NUM_FINITE_BUCKETS: int64, GROWTH_FACTOR: float64, SCALE: float64, BUCKET_COUNTS: int64[])","array":true},{"name":"ATTEMPT_COUNT","type":"int64"},{"name":"SERIALIZABLE_PESSIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"OPERATIONS_BY_TABLE_JSON_STRING","type":"string(max)"},{"name":"TOTAL_LATENCY_DISTRIBUTION_JSON_STRING","type":"string(max)"},{"name":"SERIALIZABLE_OPTIMISTIC_TXN_COUNT","type":"int64"},{"name":"REPEATABLE_READ_PESSIMISTIC_TXN_COUNT","type":"int64"}]} +{"schema":"SPANNER_SYS","name":"USER_SPLIT_POINTS","kind":"v","columns":[{"name":"TABLE_NAME","type":"string(max)"},{"name":"INDEX_NAME","type":"string(max)"},{"name":"INITIATOR","type":"string(max)"},{"name":"SPLIT_KEY","type":"string(max)"},{"name":"EXPIRE_TIME","type":"timestamp"}]} +{"schema":"SPANNER_SYS","name":"VECTOR_INDEX_METRICS_HISTORY","kind":"v","columns":[{"name":"VECTOR_INDEX_NAME","type":"string(max)"},{"name":"START_TIME","type":"timestamp"},{"name":"COMPLETION_TIME","type":"timestamp"},{"name":"ROWS_SCANNED","type":"int64"},{"name":"CLUSTERS_SAMPLED","type":"int64"},{"name":"ZERO_SIZE_CLUSTERS_SAMPLED","type":"int64"},{"name":"MIN_CLUSTER_SIZE","type":"int64"},{"name":"MAX_CLUSTER_SIZE","type":"int64"},{"name":"CLUSTER_SIZE_PERCENTILES","type":"struct(percentile: int64, value_at_percentile: int64)","array":true},{"name":"CLUSTER_AVERAGE_DISTANCE_TO_CENTROID_PERCENTILES","type":"struct(percentile: int64, value_at_percentile: float64)","array":true},{"name":"NUM_LEAVES","type":"int64"},{"name":"NUM_BRANCHES","type":"int64"}]} diff --git a/internal/engine/googlesql/dialect/types.jsonl b/internal/engine/googlesql/dialect/types.jsonl index c6d189461e..8c6dac4005 100644 --- a/internal/engine/googlesql/dialect/types.jsonl +++ b/internal/engine/googlesql/dialect/types.jsonl @@ -16,6 +16,7 @@ {"name": "geography", "category": "U"} {"name": "struct", "category": "U"} {"name": "enum", "category": "U"} +{"name": "proto", "category": "U"} {"name": "tokenlist", "category": "U"} {"name": "array", "category": "A"} {"name": "range", "category": "U"} diff --git a/internal/engine/mssql/convert.go b/internal/engine/mssql/convert.go index 45b3c8a498..dc0ac7181b 100644 --- a/internal/engine/mssql/convert.go +++ b/internal/engine/mssql/convert.go @@ -1064,10 +1064,18 @@ func (c *cc) convertColumnDefinition(n *tsql.ColumnDefinition, tablePrimaryKey m Location: c.loc(n), } - // T-SQL columns are nullable unless declared otherwise. + // T-SQL columns are nullable unless declared otherwise, except that a + // rowversion column is NOT NULL unless declared nullable, and sysname + // is defined as nvarchar(128) NOT NULL. if n.Nullable != nil && !n.Nullable.Nullable { colDef.IsNotNull = true } + if n.Nullable == nil { + switch strings.TrimPrefix(colDef.TypeName.Name, "sys.") { + case "rowversion", "timestamp", "sysname": + colDef.IsNotNull = true + } + } // IDENTITY columns are always NOT NULL. if n.IdentityOptions != nil { colDef.IsNotNull = true diff --git a/internal/engine/mssql/dialect/relations.jsonl b/internal/engine/mssql/dialect/relations.jsonl new file mode 100644 index 0000000000..d3b250f005 --- /dev/null +++ b/internal/engine/mssql/dialect/relations.jsonl @@ -0,0 +1,630 @@ +{"schema":"sys","name":"all_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_computed","type":"bit"},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_sparse","type":"bit"},{"name":"is_column_set","type":"bit"},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit"},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"all_objects","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"}]} +{"schema":"sys","name":"all_parameters","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"is_output","type":"bit","not_null":true},{"name":"is_cursor_ref","type":"bit","not_null":true},{"name":"has_default_value","type":"bit","not_null":true},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"default_value","type":"sql_variant"},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"is_readonly","type":"bit","not_null":true},{"name":"is_nullable","type":"bit"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"all_sql_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"uses_quoted_identifier","type":"bit"},{"name":"is_schema_bound","type":"bit"},{"name":"uses_database_collation","type":"bit"},{"name":"is_recompiled","type":"bit"},{"name":"null_on_null_input","type":"bit"},{"name":"execute_as_principal_id","type":"int"},{"name":"uses_native_compilation","type":"bit"},{"name":"inline_type","type":"bit"},{"name":"is_inlineable","type":"bit"}]} +{"schema":"sys","name":"all_views","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"},{"name":"is_replicated","type":"bit"},{"name":"has_replication_filter","type":"bit"},{"name":"has_opaque_metadata","type":"bit"},{"name":"has_unchecked_assembly_data","type":"bit"},{"name":"with_check_option","type":"bit"},{"name":"is_date_correlation_view","type":"bit"},{"name":"is_tracked_by_cdc","type":"bit"},{"name":"has_snapshot","type":"bit"},{"name":"ledger_view_type","type":"tinyint"},{"name":"ledger_view_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_view","type":"bit"}]} +{"schema":"sys","name":"allocation_units","kind":"v","columns":[{"name":"allocation_unit_id","type":"bigint","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"container_id","type":"bigint","not_null":true},{"name":"data_space_id","type":"int"},{"name":"total_pages","type":"bigint","not_null":true},{"name":"used_pages","type":"bigint","not_null":true},{"name":"data_pages","type":"bigint","not_null":true}]} +{"schema":"sys","name":"assemblies","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int"},{"name":"assembly_id","type":"int","not_null":true},{"name":"clr_name","type":"nvarchar(4000)"},{"name":"permission_set","type":"tinyint"},{"name":"permission_set_desc","type":"nvarchar(60)"},{"name":"is_visible","type":"bit","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_user_defined","type":"bit"}]} +{"schema":"sys","name":"assembly_files","kind":"v","columns":[{"name":"assembly_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(260)"},{"name":"file_id","type":"int","not_null":true},{"name":"content","type":"varbinary(max)"},{"name":"sha2_256","type":"varbinary(8000)"},{"name":"sha2_512","type":"varbinary(8000)"}]} +{"schema":"sys","name":"assembly_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true},{"name":"assembly_class","type":"nvarchar(128)"},{"name":"assembly_method","type":"nvarchar(128)"},{"name":"null_on_null_input","type":"bit"},{"name":"execute_as_principal_id","type":"int"}]} +{"schema":"sys","name":"assembly_references","kind":"v","columns":[{"name":"assembly_id","type":"int","not_null":true},{"name":"referenced_assembly_id","type":"int","not_null":true}]} +{"schema":"sys","name":"assembly_types","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_user_defined","type":"bit","not_null":true},{"name":"is_assembly_type","type":"bit","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true},{"name":"assembly_class","type":"nvarchar(128)"},{"name":"is_binary_ordered","type":"bit"},{"name":"is_fixed_length","type":"bit"},{"name":"prog_id","type":"nvarchar(40)"},{"name":"assembly_qualified_name","type":"nvarchar(4000)"},{"name":"is_table_type","type":"bit","not_null":true}]} +{"schema":"sys","name":"asymmetric_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int"},{"name":"asymmetric_key_id","type":"int","not_null":true},{"name":"pvt_key_encryption_type","type":"char(2)","not_null":true},{"name":"pvt_key_encryption_type_desc","type":"nvarchar(60)"},{"name":"thumbprint","type":"varbinary(64)","not_null":true},{"name":"algorithm","type":"char(2)","not_null":true},{"name":"algorithm_desc","type":"nvarchar(60)"},{"name":"key_length","type":"int","not_null":true},{"name":"sid","type":"varbinary(85)"},{"name":"string_sid","type":"nvarchar(128)"},{"name":"public_key","type":"varbinary(max)","not_null":true},{"name":"attested_by","type":"nvarchar(260)"},{"name":"provider_type","type":"nvarchar(60)"},{"name":"cryptographic_provider_guid","type":"uniqueidentifier"},{"name":"cryptographic_provider_algid","type":"sql_variant"}]} +{"schema":"sys","name":"availability_databases_cluster","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"group_database_id","type":"uniqueidentifier","not_null":true},{"name":"database_name","type":"nvarchar(128)"},{"name":"truncation_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"availability_group_listener_ip_addresses","kind":"v","columns":[{"name":"listener_id","type":"nvarchar(36)"},{"name":"ip_address","type":"nvarchar(48)"},{"name":"ip_subnet_mask","type":"nvarchar(15)"},{"name":"is_dhcp","type":"bit","not_null":true},{"name":"network_subnet_ip","type":"nvarchar(48)"},{"name":"network_subnet_prefix_length","type":"int"},{"name":"network_subnet_ipv4_mask","type":"nvarchar(48)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"availability_group_listeners","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"listener_id","type":"nvarchar(36)"},{"name":"dns_name","type":"nvarchar(63)"},{"name":"port","type":"int"},{"name":"is_conformant","type":"bit","not_null":true},{"name":"ip_configuration_string_from_cluster","type":"nvarchar(4000)"},{"name":"is_distributed_network_name","type":"bit","not_null":true}]} +{"schema":"sys","name":"availability_groups","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"resource_id","type":"nvarchar(40)"},{"name":"resource_group_id","type":"nvarchar(40)"},{"name":"failure_condition_level","type":"int"},{"name":"health_check_timeout","type":"int"},{"name":"automated_backup_preference","type":"tinyint"},{"name":"automated_backup_preference_desc","type":"nvarchar(60)"},{"name":"version","type":"smallint"},{"name":"basic_features","type":"bit"},{"name":"dtc_support","type":"bit"},{"name":"db_failover","type":"bit"},{"name":"is_distributed","type":"bit"},{"name":"cluster_type","type":"tinyint"},{"name":"cluster_type_desc","type":"nvarchar(60)"},{"name":"required_synchronized_secondaries_to_commit","type":"int"},{"name":"sequence_number","type":"bigint"},{"name":"is_contained","type":"bit"},{"name":"cluster_connection_options","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"availability_groups_cluster","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"resource_id","type":"nvarchar(40)"},{"name":"resource_group_id","type":"nvarchar(40)"},{"name":"failure_condition_level","type":"int"},{"name":"health_check_timeout","type":"int"},{"name":"automated_backup_preference","type":"tinyint"},{"name":"automated_backup_preference_desc","type":"nvarchar(60)"},{"name":"cluster_connection_options","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"availability_read_only_routing_lists","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"routing_priority","type":"int","not_null":true},{"name":"read_only_replica_id","type":"uniqueidentifier","not_null":true}]} +{"schema":"sys","name":"availability_replicas","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier"},{"name":"group_id","type":"uniqueidentifier"},{"name":"replica_metadata_id","type":"int"},{"name":"replica_server_name","type":"nvarchar(256)"},{"name":"owner_sid","type":"varbinary(85)"},{"name":"endpoint_url","type":"nvarchar(256)"},{"name":"availability_mode","type":"tinyint"},{"name":"availability_mode_desc","type":"nvarchar(60)"},{"name":"failover_mode","type":"tinyint"},{"name":"failover_mode_desc","type":"nvarchar(60)"},{"name":"session_timeout","type":"int"},{"name":"primary_role_allow_connections","type":"tinyint"},{"name":"primary_role_allow_connections_desc","type":"nvarchar(60)"},{"name":"secondary_role_allow_connections","type":"tinyint"},{"name":"secondary_role_allow_connections_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime"},{"name":"modify_date","type":"datetime"},{"name":"backup_priority","type":"int"},{"name":"read_only_routing_url","type":"nvarchar(256)"},{"name":"seeding_mode","type":"tinyint"},{"name":"seeding_mode_desc","type":"nvarchar(60)"},{"name":"read_write_routing_url","type":"nvarchar(256)"}]} +{"schema":"sys","name":"backup_devices","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"type","type":"tinyint"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"physical_name","type":"nvarchar(260)"}]} +{"schema":"sys","name":"certificates","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"certificate_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"pvt_key_encryption_type","type":"char(2)","not_null":true},{"name":"pvt_key_encryption_type_desc","type":"nvarchar(60)"},{"name":"is_active_for_begin_dialog","type":"bit"},{"name":"issuer_name","type":"nvarchar(442)"},{"name":"cert_serial_number","type":"nvarchar(64)"},{"name":"sid","type":"varbinary(85)"},{"name":"string_sid","type":"nvarchar(128)"},{"name":"subject","type":"nvarchar(4000)"},{"name":"expiry_date","type":"datetime"},{"name":"start_date","type":"datetime"},{"name":"thumbprint","type":"varbinary(64)","not_null":true},{"name":"attested_by","type":"nvarchar(260)"},{"name":"pvt_key_last_backup_date","type":"datetime"},{"name":"key_length","type":"int"}]} +{"schema":"sys","name":"change_tracking_databases","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"is_auto_cleanup_on","type":"tinyint"},{"name":"retention_period","type":"int"},{"name":"retention_period_units","type":"tinyint"},{"name":"retention_period_units_desc","type":"nvarchar(60)"},{"name":"max_cleanup_version","type":"bigint"}]} +{"schema":"sys","name":"change_tracking_tables","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"is_track_columns_updated_on","type":"bit","not_null":true},{"name":"min_valid_version","type":"bigint"},{"name":"begin_version","type":"bigint"},{"name":"cleanup_version","type":"bigint"}]} +{"schema":"sys","name":"check_constraints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"is_disabled","type":"bit","not_null":true},{"name":"is_not_for_replication","type":"bit","not_null":true},{"name":"is_not_trusted","type":"bit","not_null":true},{"name":"parent_column_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_database_collation","type":"bit"},{"name":"is_system_named","type":"bit","not_null":true}]} +{"schema":"sys","name":"column_encryption_key_values","kind":"v","columns":[{"name":"column_encryption_key_id","type":"int","not_null":true},{"name":"column_master_key_id","type":"int","not_null":true},{"name":"encrypted_value","type":"varbinary(8000)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"}]} +{"schema":"sys","name":"column_encryption_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"column_encryption_key_id","type":"int","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"column_master_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"column_master_key_id","type":"int","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"key_store_provider_name","type":"nvarchar(128)"},{"name":"key_path","type":"nvarchar(4000)"},{"name":"allow_enclave_computations","type":"int","not_null":true},{"name":"signature","type":"varbinary(8000)"}]} +{"schema":"sys","name":"column_store_dictionaries","kind":"v","columns":[{"name":"partition_id","type":"bigint"},{"name":"hobt_id","type":"bigint"},{"name":"column_id","type":"int"},{"name":"dictionary_id","type":"int"},{"name":"version","type":"int"},{"name":"type","type":"int"},{"name":"last_id","type":"int"},{"name":"entry_count","type":"bigint"},{"name":"on_disk_size","type":"bigint"}]} +{"schema":"sys","name":"column_store_row_groups","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_number","type":"int"},{"name":"row_group_id","type":"int"},{"name":"delta_store_hobt_id","type":"bigint"},{"name":"state","type":"tinyint"},{"name":"state_description","type":"nvarchar(60)","not_null":true},{"name":"total_rows","type":"bigint"},{"name":"deleted_rows","type":"bigint"},{"name":"size_in_bytes","type":"bigint"}]} +{"schema":"sys","name":"column_store_segments","kind":"v","columns":[{"name":"partition_id","type":"bigint"},{"name":"hobt_id","type":"bigint"},{"name":"column_id","type":"int"},{"name":"segment_id","type":"int"},{"name":"version","type":"int"},{"name":"encoding_type","type":"int"},{"name":"row_count","type":"int"},{"name":"has_nulls","type":"int"},{"name":"base_id","type":"bigint"},{"name":"magnitude","type":"float"},{"name":"primary_dictionary_id","type":"int"},{"name":"secondary_dictionary_id","type":"int"},{"name":"min_data_id","type":"bigint"},{"name":"max_data_id","type":"bigint"},{"name":"null_value","type":"bigint"},{"name":"on_disk_size","type":"bigint"},{"name":"collation_id","type":"int"},{"name":"min_deep_data","type":"varbinary(18)"},{"name":"max_deep_data","type":"varbinary(18)"}]} +{"schema":"sys","name":"column_type_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"user_type_id","type":"int","not_null":true}]} +{"schema":"sys","name":"column_xml_schema_collection_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true}]} +{"schema":"sys","name":"columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_computed","type":"bit"},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_sparse","type":"bit"},{"name":"is_column_set","type":"bit"},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit"},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"computed_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_database_collation","type":"bit","not_null":true},{"name":"is_persisted","type":"bit","not_null":true},{"name":"is_computed","type":"bit"},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_column_set","type":"bit","not_null":true},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit"},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"},{"name":"is_index_column_expression","type":"bit"}]} +{"schema":"sys","name":"configurations","kind":"v","columns":[{"name":"configuration_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(35)","not_null":true},{"name":"value","type":"sql_variant"},{"name":"minimum","type":"sql_variant"},{"name":"maximum","type":"sql_variant"},{"name":"value_in_use","type":"sql_variant"},{"name":"description","type":"nvarchar(255)","not_null":true},{"name":"is_dynamic","type":"bit","not_null":true},{"name":"is_advanced","type":"bit","not_null":true}]} +{"schema":"sys","name":"conversation_endpoints","kind":"v","columns":[{"name":"conversation_handle","type":"uniqueidentifier","not_null":true},{"name":"conversation_id","type":"uniqueidentifier","not_null":true},{"name":"is_initiator","type":"bit","not_null":true},{"name":"service_contract_id","type":"int","not_null":true},{"name":"conversation_group_id","type":"uniqueidentifier","not_null":true},{"name":"service_id","type":"int","not_null":true},{"name":"lifetime","type":"datetime","not_null":true},{"name":"state","type":"char(2)","not_null":true},{"name":"state_desc","type":"nvarchar(60)"},{"name":"far_service","type":"nvarchar(256)","not_null":true},{"name":"far_broker_instance","type":"nvarchar(128)"},{"name":"principal_id","type":"int","not_null":true},{"name":"far_principal_id","type":"int","not_null":true},{"name":"outbound_session_key_identifier","type":"uniqueidentifier","not_null":true},{"name":"inbound_session_key_identifier","type":"uniqueidentifier","not_null":true},{"name":"security_timestamp","type":"datetime","not_null":true},{"name":"dialog_timer","type":"datetime","not_null":true},{"name":"send_sequence","type":"bigint","not_null":true},{"name":"last_send_tran_id","type":"binary(6)","not_null":true},{"name":"end_dialog_sequence","type":"bigint","not_null":true},{"name":"receive_sequence","type":"bigint","not_null":true},{"name":"receive_sequence_frag","type":"int","not_null":true},{"name":"system_sequence","type":"bigint","not_null":true},{"name":"first_out_of_order_sequence","type":"bigint","not_null":true},{"name":"last_out_of_order_sequence","type":"bigint","not_null":true},{"name":"last_out_of_order_frag","type":"int","not_null":true},{"name":"is_system","type":"bit","not_null":true},{"name":"priority","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"conversation_groups","kind":"v","columns":[{"name":"conversation_group_id","type":"uniqueidentifier","not_null":true},{"name":"service_id","type":"int","not_null":true},{"name":"is_system","type":"bit"}]} +{"schema":"sys","name":"conversation_priorities","kind":"v","columns":[{"name":"priority_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"service_contract_id","type":"int"},{"name":"local_service_id","type":"int"},{"name":"remote_service_name","type":"nvarchar(256)"},{"name":"priority","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"credentials","kind":"v","columns":[{"name":"credential_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"credential_identity","type":"nvarchar(4000)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"target_type","type":"nvarchar(60)"},{"name":"target_id","type":"int"}]} +{"schema":"sys","name":"crypt_properties","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"thumbprint","type":"varbinary(32)","not_null":true},{"name":"crypt_type","type":"char(4)","not_null":true},{"name":"crypt_type_desc","type":"nvarchar(60)"},{"name":"crypt_property","type":"varbinary(max)","not_null":true}]} +{"schema":"sys","name":"cryptographic_providers","kind":"v","columns":[{"name":"provider_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"guid","type":"uniqueidentifier"},{"name":"version","type":"nvarchar(24)"},{"name":"dll_path","type":"nvarchar(520)"},{"name":"is_enabled","type":"bit","not_null":true}]} +{"schema":"sys","name":"data_spaces","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"data_space_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_default","type":"bit","not_null":true},{"name":"is_system","type":"bit"}]} +{"schema":"sys","name":"database_audit_specification_details","kind":"v","columns":[{"name":"database_specification_id","type":"int","not_null":true},{"name":"audit_action_id","type":"char(4)","not_null":true},{"name":"audit_action_name","type":"nvarchar(60)"},{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"audited_principal_id","type":"int","not_null":true},{"name":"audited_result","type":"nvarchar(60)"},{"name":"is_group","type":"bit"}]} +{"schema":"sys","name":"database_audit_specifications","kind":"v","columns":[{"name":"database_specification_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"audit_guid","type":"uniqueidentifier"},{"name":"is_state_enabled","type":"bit"},{"name":"is_session_context_enabled","type":"bit"},{"name":"session_context_keys","type":"nvarchar(max)"}]} +{"schema":"sys","name":"database_automatic_tuning_configurations","kind":"v","columns":[{"name":"option","type":"nvarchar(60)"},{"name":"option_value","type":"nvarchar(60)"},{"name":"type","type":"nvarchar(60)"},{"name":"type_value","type":"sql_variant"},{"name":"details","type":"nvarchar(4000)"},{"name":"state","type":"int","not_null":true}]} +{"schema":"sys","name":"database_automatic_tuning_mode","kind":"v","columns":[{"name":"desired_state","type":"smallint"},{"name":"desired_state_desc","type":"nvarchar(60)"},{"name":"actual_state","type":"smallint"},{"name":"actual_state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_automatic_tuning_options","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"desired_state","type":"smallint"},{"name":"desired_state_desc","type":"nvarchar(60)"},{"name":"actual_state","type":"smallint"},{"name":"actual_state_desc","type":"nvarchar(60)"},{"name":"reason","type":"smallint"},{"name":"reason_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_credentials","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"credential_id","type":"int","not_null":true},{"name":"credential_identity","type":"nvarchar(4000)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"target_type","type":"nvarchar(60)"},{"name":"target_id","type":"int"}]} +{"schema":"sys","name":"database_files","kind":"v","columns":[{"name":"file_id","type":"int","not_null":true},{"name":"file_guid","type":"uniqueidentifier"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"data_space_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"physical_name","type":"nvarchar(260)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"size","type":"int","not_null":true},{"name":"max_size","type":"int","not_null":true},{"name":"growth","type":"int","not_null":true},{"name":"is_media_read_only","type":"bit","not_null":true},{"name":"is_read_only","type":"bit","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_percent_growth","type":"bit","not_null":true},{"name":"is_name_reserved","type":"bit","not_null":true},{"name":"is_persistent_log_buffer","type":"bit","not_null":true},{"name":"create_lsn","type":"numeric(25,0)"},{"name":"drop_lsn","type":"numeric(25,0)"},{"name":"read_only_lsn","type":"numeric(25,0)"},{"name":"read_write_lsn","type":"numeric(25,0)"},{"name":"differential_base_lsn","type":"numeric(25,0)"},{"name":"differential_base_guid","type":"uniqueidentifier"},{"name":"differential_base_time","type":"datetime"},{"name":"redo_start_lsn","type":"numeric(25,0)"},{"name":"redo_start_fork_guid","type":"uniqueidentifier"},{"name":"redo_target_lsn","type":"numeric(25,0)"},{"name":"redo_target_fork_guid","type":"uniqueidentifier"},{"name":"backup_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"database_filestream_options","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"non_transacted_access","type":"tinyint","not_null":true},{"name":"non_transacted_access_desc","type":"nvarchar(60)","not_null":true},{"name":"directory_name","type":"nvarchar(256)"}]} +{"schema":"sys","name":"database_ledger_blocks","kind":"v","columns":[{"name":"block_id","type":"bigint","not_null":true},{"name":"transactions_root_hash","type":"varbinary(32)"},{"name":"block_size","type":"int","not_null":true},{"name":"previous_block_hash","type":"varbinary(32)"}]} +{"schema":"sys","name":"database_ledger_digest_locations","kind":"v","columns":[{"name":"path","type":"nvarchar(4000)"},{"name":"last_digest_block_id","type":"bigint"},{"name":"is_current","type":"bit","not_null":true}]} +{"schema":"sys","name":"database_ledger_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint","not_null":true},{"name":"block_id","type":"bigint","not_null":true},{"name":"transaction_ordinal","type":"int","not_null":true},{"name":"commit_time","type":"datetime2(7)","not_null":true},{"name":"principal_name","type":"nvarchar(128)","not_null":true},{"name":"table_hashes","type":"varbinary(max)"}]} +{"schema":"sys","name":"database_mirroring","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"mirroring_guid","type":"uniqueidentifier"},{"name":"mirroring_state","type":"tinyint"},{"name":"mirroring_state_desc","type":"nvarchar(60)"},{"name":"mirroring_role","type":"tinyint"},{"name":"mirroring_role_desc","type":"nvarchar(60)"},{"name":"mirroring_role_sequence","type":"int"},{"name":"mirroring_safety_level","type":"tinyint"},{"name":"mirroring_safety_level_desc","type":"nvarchar(60)"},{"name":"mirroring_safety_sequence","type":"int"},{"name":"mirroring_partner_name","type":"nvarchar(128)"},{"name":"mirroring_partner_instance","type":"nvarchar(128)"},{"name":"mirroring_witness_name","type":"nvarchar(128)"},{"name":"mirroring_witness_state","type":"tinyint"},{"name":"mirroring_witness_state_desc","type":"nvarchar(60)"},{"name":"mirroring_failover_lsn","type":"numeric(25,0)"},{"name":"mirroring_connection_timeout","type":"int"},{"name":"mirroring_redo_queue","type":"int"},{"name":"mirroring_redo_queue_type","type":"nvarchar(60)"},{"name":"mirroring_end_of_log_lsn","type":"numeric(25,0)"},{"name":"mirroring_replication_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"database_mirroring_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"role","type":"tinyint"},{"name":"role_desc","type":"nvarchar(60)"},{"name":"is_encryption_enabled","type":"bit","not_null":true},{"name":"connection_auth","type":"tinyint","not_null":true},{"name":"connection_auth_desc","type":"nvarchar(60)"},{"name":"certificate_id","type":"int","not_null":true},{"name":"encryption_algorithm","type":"tinyint","not_null":true},{"name":"encryption_algorithm_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_mirroring_witnesses","kind":"v","columns":[{"name":"database_name","type":"nvarchar(128)","not_null":true},{"name":"principal_server_name","type":"nvarchar(128)"},{"name":"mirror_server_name","type":"nvarchar(128)"},{"name":"safety_level","type":"tinyint","not_null":true},{"name":"safety_level_desc","type":"nvarchar(60)"},{"name":"safety_sequence_number","type":"int","not_null":true},{"name":"role_sequence_number","type":"int","not_null":true},{"name":"mirroring_guid","type":"uniqueidentifier","not_null":true},{"name":"family_guid","type":"uniqueidentifier","not_null":true},{"name":"is_suspended","type":"bit"},{"name":"is_suspended_sequence_number","type":"int","not_null":true},{"name":"partner_sync_state","type":"tinyint"},{"name":"partner_sync_state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_permissions","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"grantee_principal_id","type":"int","not_null":true},{"name":"grantor_principal_id","type":"int","not_null":true},{"name":"type","type":"char(4)","not_null":true},{"name":"permission_name","type":"nvarchar(128)"},{"name":"state","type":"char(1)","not_null":true},{"name":"state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"database_principals","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"type","type":"char(1)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"default_schema_name","type":"nvarchar(128)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"owning_principal_id","type":"int"},{"name":"sid","type":"varbinary(85)"},{"name":"is_fixed_role","type":"bit","not_null":true},{"name":"authentication_type","type":"int","not_null":true},{"name":"authentication_type_desc","type":"nvarchar(60)"},{"name":"default_language_name","type":"nvarchar(128)"},{"name":"default_language_lcid","type":"int"},{"name":"allow_encrypted_value_modifications","type":"bit","not_null":true},{"name":"tenant_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"database_query_store_internal_state","kind":"v","columns":[{"name":"pending_message_count","type":"bigint","not_null":true},{"name":"messaging_memory_used_mb","type":"bigint","not_null":true}]} +{"schema":"sys","name":"database_query_store_options","kind":"v","columns":[{"name":"desired_state","type":"smallint","not_null":true},{"name":"desired_state_desc","type":"nvarchar(60)"},{"name":"actual_state","type":"smallint","not_null":true},{"name":"actual_state_desc","type":"nvarchar(60)"},{"name":"readonly_reason","type":"int"},{"name":"current_storage_size_mb","type":"bigint"},{"name":"flush_interval_seconds","type":"bigint"},{"name":"interval_length_minutes","type":"bigint"},{"name":"max_storage_size_mb","type":"bigint"},{"name":"stale_query_threshold_days","type":"bigint"},{"name":"max_plans_per_query","type":"bigint"},{"name":"query_capture_mode","type":"smallint","not_null":true},{"name":"query_capture_mode_desc","type":"nvarchar(60)"},{"name":"capture_policy_execution_count","type":"int"},{"name":"capture_policy_total_compile_cpu_time_ms","type":"bigint"},{"name":"capture_policy_total_execution_cpu_time_ms","type":"bigint"},{"name":"capture_policy_stale_threshold_hours","type":"int"},{"name":"size_based_cleanup_mode","type":"smallint","not_null":true},{"name":"size_based_cleanup_mode_desc","type":"nvarchar(60)"},{"name":"wait_stats_capture_mode","type":"smallint","not_null":true},{"name":"wait_stats_capture_mode_desc","type":"nvarchar(60)"},{"name":"actual_state_additional_info","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"database_recovery_status","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"database_guid","type":"uniqueidentifier"},{"name":"family_guid","type":"uniqueidentifier"},{"name":"last_log_backup_lsn","type":"numeric(25,0)"},{"name":"recovery_fork_guid","type":"uniqueidentifier"},{"name":"first_recovery_fork_guid","type":"uniqueidentifier"},{"name":"fork_point_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"database_role_members","kind":"v","columns":[{"name":"role_principal_id","type":"int","not_null":true},{"name":"member_principal_id","type":"int","not_null":true}]} +{"schema":"sys","name":"database_scoped_configurations","kind":"v","columns":[{"name":"configuration_id","type":"int"},{"name":"name","type":"nvarchar(60)"},{"name":"value","type":"sql_variant"},{"name":"value_for_secondary","type":"sql_variant"},{"name":"is_value_default","type":"bit"}]} +{"schema":"sys","name":"database_scoped_credentials","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"credential_id","type":"int","not_null":true},{"name":"credential_identity","type":"nvarchar(4000)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"target_type","type":"nvarchar(60)"},{"name":"target_id","type":"int"}]} +{"schema":"sys","name":"databases","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"source_database_id","type":"int"},{"name":"owner_sid","type":"varbinary(85)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"compatibility_level","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"user_access","type":"tinyint"},{"name":"user_access_desc","type":"nvarchar(60)"},{"name":"is_read_only","type":"bit"},{"name":"is_auto_close_on","type":"bit","not_null":true},{"name":"is_auto_shrink_on","type":"bit"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_in_standby","type":"bit"},{"name":"is_cleanly_shutdown","type":"bit"},{"name":"is_supplemental_logging_enabled","type":"bit"},{"name":"snapshot_isolation_state","type":"tinyint"},{"name":"snapshot_isolation_state_desc","type":"nvarchar(60)"},{"name":"is_read_committed_snapshot_on","type":"bit"},{"name":"recovery_model","type":"tinyint"},{"name":"recovery_model_desc","type":"nvarchar(60)"},{"name":"page_verify_option","type":"tinyint"},{"name":"page_verify_option_desc","type":"nvarchar(60)"},{"name":"is_auto_create_stats_on","type":"bit"},{"name":"is_auto_create_stats_incremental_on","type":"bit"},{"name":"is_auto_update_stats_on","type":"bit"},{"name":"is_auto_update_stats_async_on","type":"bit"},{"name":"is_ansi_null_default_on","type":"bit"},{"name":"is_ansi_nulls_on","type":"bit"},{"name":"is_ansi_padding_on","type":"bit"},{"name":"is_ansi_warnings_on","type":"bit"},{"name":"is_arithabort_on","type":"bit"},{"name":"is_concat_null_yields_null_on","type":"bit"},{"name":"is_numeric_roundabort_on","type":"bit"},{"name":"is_quoted_identifier_on","type":"bit"},{"name":"is_recursive_triggers_on","type":"bit"},{"name":"is_cursor_close_on_commit_on","type":"bit"},{"name":"is_local_cursor_default","type":"bit"},{"name":"is_fulltext_enabled","type":"bit"},{"name":"is_trustworthy_on","type":"bit"},{"name":"is_db_chaining_on","type":"bit"},{"name":"is_parameterization_forced","type":"bit"},{"name":"is_master_key_encrypted_by_server","type":"bit","not_null":true},{"name":"is_query_store_on","type":"bit"},{"name":"is_published","type":"bit","not_null":true},{"name":"is_subscribed","type":"bit","not_null":true},{"name":"is_merge_published","type":"bit","not_null":true},{"name":"is_distributor","type":"bit","not_null":true},{"name":"is_sync_with_backup","type":"bit","not_null":true},{"name":"service_broker_guid","type":"uniqueidentifier","not_null":true},{"name":"is_broker_enabled","type":"bit","not_null":true},{"name":"log_reuse_wait","type":"tinyint"},{"name":"log_reuse_wait_desc","type":"nvarchar(60)"},{"name":"is_date_correlation_on","type":"bit","not_null":true},{"name":"is_cdc_enabled","type":"bit","not_null":true},{"name":"is_encrypted","type":"bit"},{"name":"is_honor_broker_priority_on","type":"bit"},{"name":"replica_id","type":"uniqueidentifier"},{"name":"group_database_id","type":"uniqueidentifier"},{"name":"resource_pool_id","type":"int"},{"name":"default_language_lcid","type":"smallint"},{"name":"default_language_name","type":"nvarchar(128)"},{"name":"default_fulltext_language_lcid","type":"int"},{"name":"default_fulltext_language_name","type":"nvarchar(128)"},{"name":"is_nested_triggers_on","type":"bit"},{"name":"is_transform_noise_words_on","type":"bit"},{"name":"two_digit_year_cutoff","type":"smallint"},{"name":"containment","type":"tinyint"},{"name":"containment_desc","type":"nvarchar(60)"},{"name":"target_recovery_time_in_seconds","type":"int"},{"name":"delayed_durability","type":"int"},{"name":"delayed_durability_desc","type":"nvarchar(60)"},{"name":"is_memory_optimized_elevate_to_snapshot_on","type":"bit"},{"name":"is_federation_member","type":"bit"},{"name":"is_remote_data_archive_enabled","type":"bit"},{"name":"is_mixed_page_allocation_on","type":"bit"},{"name":"is_temporal_history_retention_enabled","type":"bit"},{"name":"catalog_collation_type","type":"int","not_null":true},{"name":"catalog_collation_type_desc","type":"nvarchar(60)"},{"name":"physical_database_name","type":"nvarchar(128)"},{"name":"is_result_set_caching_on","type":"bit"},{"name":"is_accelerated_database_recovery_on","type":"bit"},{"name":"is_tempdb_spill_to_remote_store","type":"bit"},{"name":"is_stale_page_detection_on","type":"bit"},{"name":"is_memory_optimized_enabled","type":"bit"},{"name":"is_data_retention_enabled","type":"bit"},{"name":"is_ledger_on","type":"bit"},{"name":"is_change_feed_enabled","type":"bit"},{"name":"is_data_lake_replication_enabled","type":"bit"},{"name":"is_event_stream_enabled","type":"bit"},{"name":"data_compaction","type":"tinyint"},{"name":"data_compaction_desc","type":"nvarchar(60)"},{"name":"data_lake_log_publishing","type":"tinyint"},{"name":"data_lake_log_publishing_desc","type":"nvarchar(60)"},{"name":"is_vorder_enabled","type":"bit"},{"name":"is_proactive_statistics_refresh_on","type":"bit"},{"name":"is_optimized_locking_on","type":"bit"}]} +{"schema":"sys","name":"default_constraints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"parent_column_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"is_system_named","type":"bit","not_null":true}]} +{"schema":"sys","name":"destination_data_spaces","kind":"v","columns":[{"name":"partition_scheme_id","type":"int","not_null":true},{"name":"destination_id","type":"int","not_null":true},{"name":"data_space_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_audit_actions","kind":"v","columns":[{"name":"action_id","type":"varchar(4)"},{"name":"name","type":"nvarchar(128)"},{"name":"class_desc","type":"nvarchar(35)"},{"name":"covering_action_name","type":"nvarchar(128)"},{"name":"parent_class_desc","type":"nvarchar(35)"},{"name":"covering_parent_action_name","type":"nvarchar(128)"},{"name":"configuration_level","type":"nvarchar(128)"},{"name":"containing_group_name","type":"nvarchar(128)"},{"name":"action_in_log","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_audit_class_type_map","kind":"v","columns":[{"name":"class_type","type":"varchar(2)"},{"name":"class_type_desc","type":"nvarchar(35)"},{"name":"securable_class_desc","type":"nvarchar(35)"}]} +{"schema":"sys","name":"dm_broker_activated_tasks","kind":"v","columns":[{"name":"spid","type":"int"},{"name":"database_id","type":"smallint"},{"name":"queue_id","type":"int"},{"name":"procedure_name","type":"nvarchar(325)"},{"name":"execute_as","type":"int"}]} +{"schema":"sys","name":"dm_broker_connections","kind":"v","columns":[{"name":"connection_id","type":"uniqueidentifier"},{"name":"transport_stream_id","type":"uniqueidentifier"},{"name":"state","type":"smallint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"connect_time","type":"datetime"},{"name":"login_time","type":"datetime"},{"name":"authentication_method","type":"nvarchar(128)"},{"name":"principal_name","type":"nvarchar(128)"},{"name":"remote_user_name","type":"nvarchar(128)"},{"name":"last_activity_time","type":"datetime"},{"name":"is_accept","type":"bit"},{"name":"login_state","type":"smallint"},{"name":"login_state_desc","type":"nvarchar(60)"},{"name":"peer_certificate_id","type":"int"},{"name":"encryption_algorithm","type":"smallint"},{"name":"encryption_algorithm_desc","type":"nvarchar(60)"},{"name":"receives_posted","type":"smallint"},{"name":"is_receive_flow_controlled","type":"bit"},{"name":"sends_posted","type":"smallint"},{"name":"is_send_flow_controlled","type":"bit"},{"name":"total_bytes_sent","type":"bigint"},{"name":"total_bytes_received","type":"bigint"},{"name":"total_fragments_sent","type":"bigint"},{"name":"total_fragments_received","type":"bigint"},{"name":"total_sends","type":"bigint"},{"name":"total_receives","type":"bigint"},{"name":"peer_arbitration_id","type":"uniqueidentifier"},{"name":"address","type":"nvarchar(256)"},{"name":"encryption_key_bit_length","type":"int"},{"name":"encryption_protocol_version","type":"nvarchar(16)"}]} +{"schema":"sys","name":"dm_broker_forwarded_messages","kind":"v","columns":[{"name":"conversation_id","type":"uniqueidentifier"},{"name":"is_initiator","type":"bit"},{"name":"to_service_name","type":"nvarchar(256)"},{"name":"to_broker_instance","type":"nvarchar(256)"},{"name":"from_service_name","type":"nvarchar(256)"},{"name":"from_broker_instance","type":"nvarchar(256)"},{"name":"adjacent_broker_address","type":"nvarchar(256)"},{"name":"message_sequence_number","type":"bigint"},{"name":"message_fragment_number","type":"int"},{"name":"hops_remaining","type":"tinyint"},{"name":"time_to_live","type":"int"},{"name":"time_consumed","type":"int"},{"name":"message_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_broker_queue_monitors","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"queue_id","type":"int"},{"name":"state","type":"nvarchar(32)"},{"name":"last_empty_rowset_time","type":"datetime"},{"name":"last_activated_time","type":"datetime"},{"name":"tasks_waiting","type":"int"}]} +{"schema":"sys","name":"dm_cache_hit_stats","kind":"v","columns":[{"name":"distribution_id","type":"smallint"},{"name":"cache_hit","type":"bigint"},{"name":"remote_hit","type":"bigint"},{"name":"collection_start_time","type":"datetime"}]} +{"schema":"sys","name":"dm_cache_size","kind":"v","columns":[{"name":"distribution_id","type":"smallint"},{"name":"cache_used","type":"bigint"},{"name":"cache_available","type":"bigint"},{"name":"cache_capacity","type":"bigint"}]} +{"schema":"sys","name":"dm_cache_stats","kind":"v","columns":[{"name":"distribution_id","type":"smallint"},{"name":"cache_hit","type":"bigint"},{"name":"remote_hit","type":"bigint"},{"name":"collection_start_time","type":"datetime"},{"name":"cache_used","type":"bigint"},{"name":"cache_available","type":"bigint"},{"name":"cache_capacity","type":"bigint"}]} +{"schema":"sys","name":"dm_cdc_errors","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"phase_number","type":"int"},{"name":"entry_time","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"},{"name":"error_message","type":"nvarchar(1025)"},{"name":"start_lsn","type":"nvarchar(24)"},{"name":"begin_lsn","type":"nvarchar(24)"},{"name":"sequence_value","type":"nvarchar(24)"}]} +{"schema":"sys","name":"dm_cdc_log_scan_sessions","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"duration","type":"int"},{"name":"scan_phase","type":"nvarchar(200)"},{"name":"error_count","type":"int"},{"name":"start_lsn","type":"nvarchar(24)"},{"name":"current_lsn","type":"nvarchar(24)"},{"name":"end_lsn","type":"nvarchar(24)"},{"name":"tran_count","type":"bigint"},{"name":"last_commit_lsn","type":"nvarchar(24)"},{"name":"last_commit_time","type":"datetime"},{"name":"log_record_count","type":"bigint"},{"name":"schema_change_count","type":"int"},{"name":"command_count","type":"bigint"},{"name":"first_begin_cdc_lsn","type":"nvarchar(24)"},{"name":"last_commit_cdc_lsn","type":"nvarchar(24)"},{"name":"last_commit_cdc_time","type":"datetime"},{"name":"latency","type":"int"},{"name":"empty_scan_count","type":"int"},{"name":"failed_sessions_count","type":"int"}]} +{"schema":"sys","name":"dm_change_event_stream_errors","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"source_task","type":"tinyint"},{"name":"stream_group_id","type":"uniqueidentifier"},{"name":"table_id","type":"int"},{"name":"capture_phase_number","type":"int"},{"name":"entry_time","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"},{"name":"error_message","type":"nvarchar(1025)"},{"name":"batch_start_lsn","type":"nvarchar(24)"},{"name":"batch_end_lsn","type":"nvarchar(24)"},{"name":"tran_begin_lsn","type":"nvarchar(24)"},{"name":"tran_commit_lsn","type":"nvarchar(24)"},{"name":"sequence_value","type":"nvarchar(24)"},{"name":"command_id","type":"int"}]} +{"schema":"sys","name":"dm_change_event_stream_log_scan_sessions","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"duration","type":"int"},{"name":"batch_processing_phase","type":"nvarchar(200)"},{"name":"error_count","type":"int"},{"name":"batch_start_lsn","type":"nvarchar(24)"},{"name":"currently_processed_lsn","type":"nvarchar(24)"},{"name":"batch_end_lsn","type":"nvarchar(24)"},{"name":"tran_count","type":"bigint"},{"name":"currently_processed_commit_lsn","type":"nvarchar(24)"},{"name":"currently_processed_commit_time","type":"datetime"},{"name":"log_record_count","type":"bigint"},{"name":"schema_change_count","type":"int"},{"name":"command_count","type":"bigint"},{"name":"latency","type":"int"},{"name":"rows_left_to_publish","type":"bigint"},{"name":"empty_scan_count","type":"int"},{"name":"failed_sessions_count","type":"int"}]} +{"schema":"sys","name":"dm_change_feed_errors","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"source_task","type":"tinyint"},{"name":"table_group_id","type":"uniqueidentifier"},{"name":"table_id","type":"int"},{"name":"capture_phase_number","type":"int"},{"name":"entry_time","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"},{"name":"error_message","type":"nvarchar(1025)"},{"name":"batch_start_lsn","type":"nvarchar(24)"},{"name":"batch_end_lsn","type":"nvarchar(24)"},{"name":"tran_begin_lsn","type":"nvarchar(24)"},{"name":"tran_commit_lsn","type":"nvarchar(24)"},{"name":"sequence_value","type":"nvarchar(24)"},{"name":"command_id","type":"int"}]} +{"schema":"sys","name":"dm_change_feed_log_scan_sessions","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"duration","type":"int"},{"name":"batch_processing_phase","type":"nvarchar(200)"},{"name":"error_count","type":"int"},{"name":"batch_start_lsn","type":"nvarchar(24)"},{"name":"currently_processed_lsn","type":"nvarchar(24)"},{"name":"batch_end_lsn","type":"nvarchar(24)"},{"name":"tran_count","type":"bigint"},{"name":"currently_processed_commit_lsn","type":"nvarchar(24)"},{"name":"currently_processed_commit_time","type":"datetime"},{"name":"log_record_count","type":"bigint"},{"name":"schema_change_count","type":"int"},{"name":"command_count","type":"bigint"},{"name":"latency","type":"int"},{"name":"rows_left_to_publish","type":"bigint"},{"name":"table_groups_to_commit","type":"int"},{"name":"empty_scan_count","type":"int"},{"name":"failed_sessions_count","type":"int"}]} +{"schema":"sys","name":"dm_clr_appdomains","kind":"v","columns":[{"name":"appdomain_address","type":"varbinary(8)"},{"name":"appdomain_id","type":"int"},{"name":"appdomain_name","type":"nvarchar(386)"},{"name":"creation_time","type":"datetime"},{"name":"db_id","type":"int"},{"name":"user_id","type":"int"},{"name":"state","type":"nvarchar(128)"},{"name":"strong_refcount","type":"int"},{"name":"weak_refcount","type":"int"},{"name":"cost","type":"int"},{"name":"value","type":"int"},{"name":"compatibility_level","type":"int"},{"name":"total_processor_time_ms","type":"bigint"},{"name":"total_allocated_memory_kb","type":"bigint"},{"name":"survived_memory_kb","type":"bigint"}]} +{"schema":"sys","name":"dm_clr_loaded_assemblies","kind":"v","columns":[{"name":"assembly_id","type":"int"},{"name":"appdomain_address","type":"varbinary(8)"},{"name":"load_time","type":"datetime"}]} +{"schema":"sys","name":"dm_clr_properties","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"value","type":"nvarchar(128)"}]} +{"schema":"sys","name":"dm_clr_tasks","kind":"v","columns":[{"name":"task_address","type":"varbinary(8)"},{"name":"sos_task_address","type":"varbinary(8)"},{"name":"appdomain_address","type":"varbinary(8)"},{"name":"state","type":"nvarchar(128)"},{"name":"abort_state","type":"nvarchar(128)"},{"name":"type","type":"nvarchar(128)"},{"name":"affinity_count","type":"int"},{"name":"forced_yield_count","type":"int"}]} +{"schema":"sys","name":"dm_cluster_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"description","type":"nvarchar(4000)","not_null":true},{"name":"endpoint","type":"nvarchar(256)","not_null":true},{"name":"protocol_desc","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_column_encryption_enclave","kind":"v","columns":[{"name":"current_enclave_session_count","type":"int"},{"name":"current_column_encryption_key_count","type":"int"},{"name":"current_memory_size_kb","type":"bigint"},{"name":"total_evicted_session_count","type":"bigint"}]} +{"schema":"sys","name":"dm_column_encryption_enclave_operation_stats","kind":"v","columns":[{"name":"operation_type","type":"nvarchar(128)"},{"name":"total_operation_count","type":"bigint"}]} +{"schema":"sys","name":"dm_column_encryption_enclave_properties","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"value","type":"sql_variant"}]} +{"schema":"sys","name":"dm_column_store_object_pool","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"column_id","type":"int"},{"name":"row_group_id","type":"int","not_null":true},{"name":"object_type","type":"int","not_null":true},{"name":"object_type_desc","type":"nvarchar(60)","not_null":true},{"name":"access_count","type":"bigint","not_null":true},{"name":"memory_used_in_bytes","type":"bigint","not_null":true},{"name":"object_load_time","type":"datetime2(7)","not_null":true}]} +{"schema":"sys","name":"dm_cryptographic_provider_properties","kind":"v","columns":[{"name":"provider_id","type":"int"},{"name":"guid","type":"uniqueidentifier"},{"name":"provider_version","type":"nvarchar(128)"},{"name":"sqlcrypt_version","type":"nvarchar(128)"},{"name":"friendly_name","type":"nvarchar(1024)"},{"name":"authentication_type","type":"nvarchar(128)"},{"name":"symmetric_key_support","type":"tinyint"},{"name":"symmetric_key_persistance","type":"tinyint"},{"name":"symmetric_key_export","type":"tinyint"},{"name":"symmetric_key_import","type":"tinyint"},{"name":"asymmetric_key_support","type":"tinyint"},{"name":"asymmetric_key_persistance","type":"tinyint"},{"name":"asymmetric_key_export","type":"tinyint"},{"name":"asymmetric_key_import","type":"tinyint"}]} +{"schema":"sys","name":"dm_database_backup_lineage","kind":"v","columns":[{"name":"backup_file_id","type":"uniqueidentifier","not_null":true},{"name":"logical_database_id","type":"uniqueidentifier"},{"name":"logical_server_name","type":"nvarchar(128)"},{"name":"logical_database_name","type":"nvarchar(128)"},{"name":"backup_start_date","type":"datetime2(7)","not_null":true},{"name":"backup_finish_date","type":"datetime2(7)","not_null":true},{"name":"backup_type","type":"char(1)","not_null":true},{"name":"database_allocated_storage_mb","type":"numeric(31,11)"}]} +{"schema":"sys","name":"dm_database_backups","kind":"v","columns":[{"name":"backup_file_id","type":"uniqueidentifier","not_null":true},{"name":"logical_database_id","type":"uniqueidentifier"},{"name":"physical_database_name","type":"nvarchar(128)","not_null":true},{"name":"logical_server_name","type":"nvarchar(128)"},{"name":"logical_database_name","type":"nvarchar(128)"},{"name":"backup_start_date","type":"datetime2(7)","not_null":true},{"name":"backup_finish_date","type":"datetime2(7)","not_null":true},{"name":"backup_type","type":"char(1)","not_null":true},{"name":"in_retention","type":"bit"}]} +{"schema":"sys","name":"dm_database_encryption_keys","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"encryption_state","type":"int"},{"name":"create_date","type":"datetime"},{"name":"regenerate_date","type":"datetime"},{"name":"modify_date","type":"datetime"},{"name":"set_date","type":"datetime"},{"name":"opened_date","type":"datetime"},{"name":"key_algorithm","type":"nvarchar(128)"},{"name":"key_length","type":"int"},{"name":"encryptor_thumbprint","type":"varbinary(20)"},{"name":"encryptor_type","type":"nvarchar(128)"},{"name":"percent_complete","type":"real"},{"name":"encryption_state_desc","type":"nvarchar(128)"},{"name":"encryption_scan_state","type":"int"},{"name":"encryption_scan_state_desc","type":"nvarchar(128)"},{"name":"encryption_scan_modify_date","type":"datetime"}]} +{"schema":"sys","name":"dm_database_external_governance_sync_state","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"sync_scope","type":"smallint"},{"name":"sync_scope_desc","type":"nvarchar(60)"},{"name":"sync_state","type":"smallint"},{"name":"sync_state_desc","type":"nvarchar(60)"},{"name":"user_initiated_sync","type":"smallint"},{"name":"sync_percent_complete","type":"smallint"},{"name":"current_sync_token","type":"nvarchar(128)"},{"name":"next_sync_token","type":"nvarchar(128)"},{"name":"last_reference_fetch_success_time_utc","type":"datetime"},{"name":"last_reference_fetch_attempt_time_utc","type":"datetime"},{"name":"last_reference_fetch_error","type":"int"},{"name":"last_blob_fetch_success_time_utc","type":"datetime"},{"name":"last_blob_fetch_attempt_time_utc","type":"datetime"},{"name":"last_blob_fetch_error","type":"int"},{"name":"last_sync_success_time_utc","type":"datetime"},{"name":"last_synchronizing_success_time_utc","type":"datetime"},{"name":"last_synchronizing_attempt_time_utc","type":"datetime"},{"name":"last_synchronizing_error","type":"int"}]} +{"schema":"sys","name":"dm_database_external_policy_actions","kind":"v","columns":[{"name":"sql_action_id","type":"int"},{"name":"action_namespace","type":"nvarchar(256)"},{"name":"action_type","type":"nvarchar(32)"},{"name":"action_provider_string","type":"nvarchar(20)"}]} +{"schema":"sys","name":"dm_database_external_policy_principal_assigned_actions","kind":"v","columns":[{"name":"principal_sid","type":"varbinary(85)"},{"name":"principal_aad_object_id","type":"nvarchar(36)"},{"name":"action_namespace","type":"nvarchar(256)"},{"name":"action_type","type":"nvarchar(32)"},{"name":"role_name","type":"nvarchar(128)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"role_assignment_scope","type":"nvarchar(4000)"},{"name":"role_assignment_type","type":"int"},{"name":"role_assignment_type_desc","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_database_external_policy_principals","kind":"v","columns":[{"name":"sid","type":"varbinary(85)"},{"name":"aad_object_id","type":"nvarchar(36)"},{"name":"type","type":"nvarchar(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"authentication_type","type":"int"},{"name":"authentication_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_database_external_policy_role_actions","kind":"v","columns":[{"name":"role_guid","type":"nvarchar(128)"},{"name":"sql_action_id","type":"int"}]} +{"schema":"sys","name":"dm_database_external_policy_role_members","kind":"v","columns":[{"name":"principal_aad_object_id","type":"nvarchar(36)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"assignment_scope","type":"nvarchar(4000)"},{"name":"assignment_type","type":"int"},{"name":"assignment_type_desc","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_database_external_policy_roles","kind":"v","columns":[{"name":"role_name","type":"nvarchar(128)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"modify_date","type":"datetime2(7)"}]} +{"schema":"sys","name":"dm_db_column_store_row_group_operational_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"row_group_id","type":"int","not_null":true},{"name":"index_scan_count","type":"bigint","not_null":true},{"name":"scan_count","type":"bigint","not_null":true},{"name":"delete_buffer_scan_count","type":"bigint","not_null":true},{"name":"row_group_lock_count","type":"bigint","not_null":true},{"name":"row_group_lock_wait_count","type":"bigint","not_null":true},{"name":"row_group_lock_wait_in_ms","type":"bigint","not_null":true},{"name":"returned_row_count","type":"bigint","not_null":true},{"name":"returned_aggregate_count","type":"bigint","not_null":true},{"name":"returned_group_count","type":"bigint","not_null":true},{"name":"input_groupby_row_count","type":"bigint","not_null":true},{"name":"row_group_elimination_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_db_column_store_row_group_physical_stats","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_number","type":"int"},{"name":"row_group_id","type":"int"},{"name":"delta_store_hobt_id","type":"bigint"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)","not_null":true},{"name":"total_rows","type":"bigint"},{"name":"deleted_rows","type":"bigint"},{"name":"size_in_bytes","type":"bigint"},{"name":"trim_reason","type":"tinyint"},{"name":"trim_reason_desc","type":"nvarchar(60)"},{"name":"transition_to_compressed_state","type":"tinyint"},{"name":"transition_to_compressed_state_desc","type":"nvarchar(60)"},{"name":"has_vertipaq_optimization","type":"bit"},{"name":"generation","type":"bigint"},{"name":"created_time","type":"datetime"},{"name":"closed_time","type":"datetime"}]} +{"schema":"sys","name":"dm_db_data_pool_nodes","kind":"v","columns":[{"name":"data_pool_id","type":"int","not_null":true},{"name":"data_pool_node_name","type":"nvarchar(256)","not_null":true},{"name":"address","type":"nvarchar(256)","not_null":true},{"name":"state","type":"nvarchar(256)","not_null":true},{"name":"health_status","type":"nvarchar(256)","not_null":true},{"name":"health_error_message","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_db_data_pools","kind":"v","columns":[{"name":"data_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)"},{"name":"location","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_db_external_language_stats","kind":"v","columns":[{"name":"external_language_id","type":"int","not_null":true},{"name":"is_installed","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_db_external_script_execution_stats","kind":"v","columns":[{"name":"external_language_id","type":"int","not_null":true},{"name":"counter_name","type":"nvarchar(256)","not_null":true},{"name":"counter_value","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_db_file_space_usage","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"file_id","type":"smallint"},{"name":"filegroup_id","type":"smallint"},{"name":"total_page_count","type":"bigint"},{"name":"allocated_extent_page_count","type":"bigint"},{"name":"unallocated_extent_page_count","type":"bigint"},{"name":"version_store_reserved_page_count","type":"bigint"},{"name":"user_object_reserved_page_count","type":"bigint"},{"name":"internal_object_reserved_page_count","type":"bigint"},{"name":"mixed_extent_page_count","type":"bigint"},{"name":"modified_extent_page_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_fts_index_physical_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"fulltext_index_page_count","type":"bigint"},{"name":"keyphrase_index_page_count","type":"bigint"},{"name":"similarity_index_page_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_index_usage_stats","kind":"v","columns":[{"name":"database_id","type":"smallint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"user_seeks","type":"bigint","not_null":true},{"name":"user_scans","type":"bigint","not_null":true},{"name":"user_lookups","type":"bigint","not_null":true},{"name":"user_updates","type":"bigint","not_null":true},{"name":"last_user_seek","type":"datetime"},{"name":"last_user_scan","type":"datetime"},{"name":"last_user_lookup","type":"datetime"},{"name":"last_user_update","type":"datetime"},{"name":"system_seeks","type":"bigint","not_null":true},{"name":"system_scans","type":"bigint","not_null":true},{"name":"system_lookups","type":"bigint","not_null":true},{"name":"system_updates","type":"bigint","not_null":true},{"name":"last_system_seek","type":"datetime"},{"name":"last_system_scan","type":"datetime"},{"name":"last_system_lookup","type":"datetime"},{"name":"last_system_update","type":"datetime"}]} +{"schema":"sys","name":"dm_db_information_protection_label_properties","kind":"v","columns":[{"name":"label_id","type":"nvarchar(36)"},{"name":"name","type":"nvarchar(128)"}]} +{"schema":"sys","name":"dm_db_internal_auto_tuning_create_index_recommendations","kind":"v","columns":[{"name":"id","type":"bigint","not_null":true},{"name":"state","type":"int","not_null":true},{"name":"state_name","type":"nvarchar(128)","not_null":true},{"name":"type_id","type":"int","not_null":true},{"name":"recommendation_timestamp_utc","type":"datetime","not_null":true},{"name":"last_refresh_timestamp_utc","type":"datetime","not_null":true},{"name":"archived","type":"bit","not_null":true},{"name":"extended_properties","type":"nvarchar(max)"},{"name":"index_type","type":"tinyint","not_null":true},{"name":"schema","type":"nvarchar(128)","not_null":true},{"name":"table","type":"nvarchar(128)","not_null":true},{"name":"index_columns","type":"nvarchar(4000)","not_null":true},{"name":"included_columns","type":"nvarchar(max)"},{"name":"index_name","type":"nvarchar(128)","not_null":true},{"name":"estimated_space_change_cached","type":"float"},{"name":"estimated_action_duration_cached","type":"float"},{"name":"reported_number_of_queries_with_improved_performance_cached","type":"int"},{"name":"reported_number_of_queries_with_regressed_performance_cached","type":"int"},{"name":"reported_cpu_utilization_change_absolute_cached","type":"float"},{"name":"reported_cpu_utilization_change_relative_cached","type":"float"},{"name":"reported_logical_reads_change_absolute_cached","type":"float"},{"name":"reported_logical_reads_change_relative_cached","type":"float"},{"name":"reported_logical_writes_change_absolute_cached","type":"float"},{"name":"reported_logical_writes_change_relative_cached","type":"float"},{"name":"index_size_kb_before_action","type":"bigint"},{"name":"index_size_kb_after_action","type":"bigint"},{"name":"recommendation_source","type":"smallint"},{"name":"baseline_data_collecting_start_time_utc","type":"datetime"},{"name":"score","type":"int"},{"name":"group_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_db_internal_auto_tuning_recommendation_impact_query_metrics","kind":"v","columns":[{"name":"recommendation_id","type":"bigint","not_null":true},{"name":"query_hash","type":"binary(8)","not_null":true},{"name":"metric","type":"smallint","not_null":true},{"name":"metric_name","type":"nvarchar(29)","not_null":true},{"name":"avg_metric_before_action","type":"float"},{"name":"avg_metric_after_action","type":"float"}]} +{"schema":"sys","name":"dm_db_internal_auto_tuning_recommendation_metrics","kind":"v","columns":[{"name":"recommendation_id","type":"bigint","not_null":true},{"name":"dimension_id","type":"smallint","not_null":true},{"name":"dimension_name","type":"nvarchar(31)","not_null":true},{"name":"impact_type_id","type":"tinyint","not_null":true},{"name":"impact_type_name","type":"nvarchar(9)","not_null":true},{"name":"unit_type_id","type":"smallint"},{"name":"unit_type_name","type":"nvarchar(15)","not_null":true},{"name":"absolute_value","type":"float"},{"name":"change_value_absolute","type":"float"},{"name":"change_value_relative","type":"float"}]} +{"schema":"sys","name":"dm_db_internal_auto_tuning_workflows","kind":"v","columns":[{"name":"execution_id","type":"uniqueidentifier","not_null":true},{"name":"current_state","type":"int","not_null":true},{"name":"create_date_utc","type":"datetime","not_null":true},{"name":"last_update_date_utc","type":"datetime","not_null":true},{"name":"workflow_type_id","type":"int","not_null":true},{"name":"retry_count","type":"int","not_null":true},{"name":"derived_from_id","type":"uniqueidentifier"},{"name":"properties","type":"nvarchar(max)"},{"name":"recommendation_id","type":"bigint"}]} +{"schema":"sys","name":"dm_db_internal_automatic_tuning_version","kind":"v","columns":[{"name":"version_code","type":"bigint"}]} +{"schema":"sys","name":"dm_db_log_space_usage","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"total_log_size_in_bytes","type":"bigint"},{"name":"used_log_space_in_bytes","type":"bigint"},{"name":"used_log_space_in_percent","type":"real"},{"name":"log_space_in_bytes_since_last_backup","type":"bigint"}]} +{"schema":"sys","name":"dm_db_logical_index_corruptions","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"entry_time","type":"datetime"},{"name":"row_handle","type":"varbinary(8000)"},{"name":"operation_type","type":"tinyint","not_null":true},{"name":"operation_type_desc","type":"nvarchar(60)","not_null":true}]} +{"schema":"sys","name":"dm_db_mirroring_auto_page_repair","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"file_id","type":"int","not_null":true},{"name":"page_id","type":"bigint","not_null":true},{"name":"error_type","type":"smallint","not_null":true},{"name":"page_status","type":"tinyint","not_null":true},{"name":"modification_time","type":"datetime","not_null":true}]} +{"schema":"sys","name":"dm_db_mirroring_connections","kind":"v","columns":[{"name":"connection_id","type":"uniqueidentifier"},{"name":"transport_stream_id","type":"uniqueidentifier"},{"name":"state","type":"smallint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"connect_time","type":"datetime"},{"name":"login_time","type":"datetime"},{"name":"authentication_method","type":"nvarchar(128)"},{"name":"principal_name","type":"nvarchar(128)"},{"name":"remote_user_name","type":"nvarchar(128)"},{"name":"last_activity_time","type":"datetime"},{"name":"is_accept","type":"bit"},{"name":"login_state","type":"smallint"},{"name":"login_state_desc","type":"nvarchar(60)"},{"name":"peer_certificate_id","type":"int"},{"name":"encryption_algorithm","type":"smallint"},{"name":"encryption_algorithm_desc","type":"nvarchar(60)"},{"name":"receives_posted","type":"smallint"},{"name":"is_receive_flow_controlled","type":"bit"},{"name":"sends_posted","type":"smallint"},{"name":"is_send_flow_controlled","type":"bit"},{"name":"total_bytes_sent","type":"bigint"},{"name":"total_bytes_received","type":"bigint"},{"name":"total_fragments_sent","type":"bigint"},{"name":"total_fragments_received","type":"bigint"},{"name":"total_sends","type":"bigint"},{"name":"total_receives","type":"bigint"},{"name":"peer_arbitration_id","type":"uniqueidentifier"},{"name":"address","type":"nvarchar(256)"},{"name":"encryption_key_bit_length","type":"int"},{"name":"encryption_protocol_version","type":"nvarchar(16)"}]} +{"schema":"sys","name":"dm_db_mirroring_past_actions","kind":"v","columns":[{"name":"mirroring_guid","type":"uniqueidentifier"},{"name":"state_machine_name","type":"nvarchar(60)"},{"name":"action_type","type":"nvarchar(60)"},{"name":"name","type":"nvarchar(60)"},{"name":"current_state","type":"nvarchar(60)"},{"name":"action_sequence","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_db_missing_index_details","kind":"v","columns":[{"name":"index_handle","type":"int","not_null":true},{"name":"database_id","type":"smallint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"equality_columns","type":"nvarchar(4000)"},{"name":"inequality_columns","type":"nvarchar(4000)"},{"name":"included_columns","type":"nvarchar(4000)"},{"name":"statement","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_db_missing_index_group_stats","kind":"v","columns":[{"name":"group_handle","type":"int","not_null":true},{"name":"unique_compiles","type":"bigint"},{"name":"user_seeks","type":"bigint"},{"name":"user_scans","type":"bigint"},{"name":"last_user_seek","type":"datetime"},{"name":"last_user_scan","type":"datetime"},{"name":"avg_total_user_cost","type":"float"},{"name":"avg_user_impact","type":"float"},{"name":"system_seeks","type":"bigint"},{"name":"system_scans","type":"bigint"},{"name":"last_system_seek","type":"datetime"},{"name":"last_system_scan","type":"datetime"},{"name":"avg_total_system_cost","type":"float"},{"name":"avg_system_impact","type":"float"}]} +{"schema":"sys","name":"dm_db_missing_index_group_stats_query","kind":"v","columns":[{"name":"group_handle","type":"int","not_null":true},{"name":"query_hash","type":"binary(8)","not_null":true},{"name":"query_plan_hash","type":"binary(8)","not_null":true},{"name":"last_sql_handle","type":"varbinary(64)","not_null":true},{"name":"last_statement_start_offset","type":"int","not_null":true},{"name":"last_statement_end_offset","type":"int","not_null":true},{"name":"last_statement_sql_handle","type":"varbinary(64)"},{"name":"user_seeks","type":"bigint","not_null":true},{"name":"user_scans","type":"bigint","not_null":true},{"name":"last_user_seek","type":"datetime"},{"name":"last_user_scan","type":"datetime"},{"name":"avg_total_user_cost","type":"float"},{"name":"avg_user_impact","type":"float","not_null":true},{"name":"system_seeks","type":"bigint","not_null":true},{"name":"system_scans","type":"bigint","not_null":true},{"name":"last_system_seek","type":"datetime"},{"name":"last_system_scan","type":"datetime"},{"name":"avg_total_system_cost","type":"float"},{"name":"avg_system_impact","type":"float","not_null":true}]} +{"schema":"sys","name":"dm_db_missing_index_groups","kind":"v","columns":[{"name":"index_group_handle","type":"int","not_null":true},{"name":"index_handle","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_db_partition_stats","kind":"v","columns":[{"name":"partition_id","type":"bigint"},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"in_row_data_page_count","type":"bigint"},{"name":"in_row_used_page_count","type":"bigint"},{"name":"in_row_reserved_page_count","type":"bigint"},{"name":"lob_used_page_count","type":"bigint"},{"name":"lob_reserved_page_count","type":"bigint"},{"name":"row_overflow_used_page_count","type":"bigint"},{"name":"row_overflow_reserved_page_count","type":"bigint"},{"name":"used_page_count","type":"bigint"},{"name":"reserved_page_count","type":"bigint"},{"name":"row_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_persisted_sku_features","kind":"v","columns":[{"name":"feature_name","type":"nvarchar(4000)"},{"name":"feature_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_db_rda_migration_status","kind":"v","columns":[{"name":"table_id","type":"int"},{"name":"database_id","type":"int"},{"name":"migrated_rows","type":"bigint"},{"name":"start_time_utc","type":"datetime"},{"name":"end_time_utc","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"}]} +{"schema":"sys","name":"dm_db_rda_schema_update_status","kind":"v","columns":[{"name":"table_id","type":"int"},{"name":"database_id","type":"int"},{"name":"task_id","type":"bigint"},{"name":"task_type","type":"int"},{"name":"task_type_desc","type":"nvarchar(60)"},{"name":"task_state","type":"int"},{"name":"task_state_desc","type":"nvarchar(60)"},{"name":"start_time_utc","type":"datetime"},{"name":"end_time_utc","type":"datetime"},{"name":"error_number","type":"int"},{"name":"error_severity","type":"int"},{"name":"error_state","type":"int"}]} +{"schema":"sys","name":"dm_db_script_level","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"script_id","type":"int","not_null":true},{"name":"script_name","type":"nvarchar(128)"},{"name":"version","type":"int","not_null":true},{"name":"script_level","type":"int","not_null":true},{"name":"downgrade_start_level","type":"int","not_null":true},{"name":"downgrade_target_level","type":"int","not_null":true},{"name":"upgrade_start_level","type":"int"},{"name":"upgrade_target_level","type":"int"}]} +{"schema":"sys","name":"dm_db_session_space_usage","kind":"v","columns":[{"name":"session_id","type":"smallint"},{"name":"database_id","type":"int"},{"name":"user_objects_alloc_page_count","type":"bigint"},{"name":"user_objects_dealloc_page_count","type":"bigint"},{"name":"internal_objects_alloc_page_count","type":"bigint"},{"name":"internal_objects_dealloc_page_count","type":"bigint"},{"name":"user_objects_deferred_dealloc_page_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_storage_pool_nodes","kind":"v","columns":[{"name":"storage_pool_id","type":"int","not_null":true},{"name":"storage_pool_node_name","type":"nvarchar(256)","not_null":true},{"name":"address","type":"nvarchar(256)","not_null":true},{"name":"state","type":"nvarchar(256)","not_null":true},{"name":"health_status","type":"nvarchar(256)","not_null":true},{"name":"health_error_message","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_db_storage_pools","kind":"v","columns":[{"name":"storage_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)"},{"name":"location","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_db_task_space_usage","kind":"v","columns":[{"name":"task_address","type":"varbinary(8)"},{"name":"is_remote_task","type":"bit","not_null":true},{"name":"session_id","type":"smallint"},{"name":"request_id","type":"int"},{"name":"exec_context_id","type":"int"},{"name":"database_id","type":"int"},{"name":"user_objects_alloc_page_count","type":"bigint"},{"name":"user_objects_dealloc_page_count","type":"bigint"},{"name":"internal_objects_alloc_page_count","type":"bigint"},{"name":"internal_objects_dealloc_page_count","type":"bigint"}]} +{"schema":"sys","name":"dm_db_tuning_recommendations","kind":"v","columns":[{"name":"name","type":"nvarchar(4000)"},{"name":"type","type":"nvarchar(4000)"},{"name":"reason","type":"nvarchar(4000)"},{"name":"valid_since","type":"datetime2(7)"},{"name":"last_refresh","type":"datetime2(7)"},{"name":"state","type":"nvarchar(4000)"},{"name":"is_executable_action","type":"bit"},{"name":"is_revertable_action","type":"bit"},{"name":"execute_action_start_time","type":"datetime2(7)"},{"name":"execute_action_duration","type":"time(7)"},{"name":"execute_action_initiated_by","type":"nvarchar(4000)"},{"name":"execute_action_initiated_time","type":"datetime2(7)"},{"name":"revert_action_start_time","type":"datetime2(7)"},{"name":"revert_action_duration","type":"time(7)"},{"name":"revert_action_initiated_by","type":"nvarchar(4000)"},{"name":"revert_action_initiated_time","type":"datetime2(7)"},{"name":"score","type":"int"},{"name":"details","type":"nvarchar(max)"}]} +{"schema":"sys","name":"dm_db_uncontained_entities","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"nvarchar(60)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"statement_line_number","type":"int"},{"name":"statement_offset_begin","type":"int"},{"name":"statement_offset_end","type":"int"},{"name":"statement_type","type":"nvarchar(256)"},{"name":"feature_name","type":"nvarchar(128)","not_null":true},{"name":"feature_type_name","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_checkpoint_files","kind":"v","columns":[{"name":"container_id","type":"int","not_null":true},{"name":"container_guid","type":"uniqueidentifier","not_null":true},{"name":"checkpoint_file_id","type":"uniqueidentifier","not_null":true},{"name":"relative_file_path","type":"nvarchar(260)","not_null":true},{"name":"file_type","type":"smallint","not_null":true},{"name":"file_type_desc","type":"nvarchar(60)","not_null":true},{"name":"internal_storage_slot","type":"int"},{"name":"checkpoint_pair_file_id","type":"uniqueidentifier"},{"name":"file_size_in_bytes","type":"bigint","not_null":true},{"name":"file_size_used_in_bytes","type":"bigint"},{"name":"logical_row_count","type":"bigint"},{"name":"state","type":"smallint","not_null":true},{"name":"state_desc","type":"nvarchar(60)","not_null":true},{"name":"lower_bound_tsn","type":"bigint"},{"name":"upper_bound_tsn","type":"bigint"},{"name":"begin_checkpoint_id","type":"bigint"},{"name":"end_checkpoint_id","type":"bigint"},{"name":"last_updated_checkpoint_id","type":"bigint"},{"name":"encryption_status","type":"smallint"},{"name":"encryption_status_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_db_xtp_checkpoint_internals","kind":"v","columns":[{"name":"checkpoint_id","type":"bigint","not_null":true},{"name":"checkpoint_timestamp","type":"bigint"},{"name":"last_segment_lsn","type":"numeric(25,0)"},{"name":"recovery_lsn","type":"numeric(25,0)"},{"name":"is_synchronized","type":"bit"}]} +{"schema":"sys","name":"dm_db_xtp_checkpoint_stats","kind":"v","columns":[{"name":"last_lsn_processed","type":"numeric(25,0)"},{"name":"end_of_log_lsn","type":"numeric(25,0)"},{"name":"bytes_to_end_of_log","type":"bigint"},{"name":"log_consumption_rate","type":"bigint"},{"name":"active_scan_time_in_ms","type":"bigint"},{"name":"total_wait_time_in_ms","type":"bigint"},{"name":"waits_for_io_count","type":"bigint"},{"name":"io_wait_time_in_ms","type":"bigint"},{"name":"waits_for_new_log_count","type":"bigint"},{"name":"new_log_wait_time_in_ms","type":"bigint"},{"name":"idle_attempts_count","type":"bigint"},{"name":"tx_segments_dispatched_count","type":"bigint"},{"name":"segment_bytes_dispatched","type":"bigint"},{"name":"bytes_serialized","type":"bigint"},{"name":"serializer_user_time_in_ms","type":"bigint"},{"name":"serializer_kernel_time_in_ms","type":"bigint"},{"name":"xtp_log_bytes_consumed","type":"bigint"},{"name":"checkpoints_closed","type":"bigint"},{"name":"last_closed_checkpoint_ts","type":"bigint"},{"name":"hardened_recovery_lsn","type":"numeric(25,0)"},{"name":"hardened_root_file_guid","type":"uniqueidentifier"},{"name":"hardened_root_file_watermark","type":"bigint"},{"name":"hardened_truncation_lsn","type":"numeric(25,0)"},{"name":"log_bytes_since_last_close","type":"bigint"},{"name":"time_since_last_close_in_ms","type":"bigint"},{"name":"current_checkpoint_id","type":"bigint"},{"name":"current_checkpoint_segment_count","type":"bigint"},{"name":"recovery_lsn_candidate","type":"numeric(25,0)"},{"name":"outstanding_checkpoint_count","type":"bigint"},{"name":"closing_checkpoint_id","type":"bigint"},{"name":"recovery_checkpoint_id","type":"bigint"},{"name":"recovery_checkpoint_ts","type":"bigint"},{"name":"bootstrap_recovery_lsn","type":"numeric(25,0)"},{"name":"bootstrap_root_file_guid","type":"uniqueidentifier"},{"name":"internal_error_code","type":"bigint"},{"name":"tail_cache_page_count","type":"bigint"},{"name":"tail_cache_max_page_count","type":"bigint"},{"name":"tail_cache_min_needed_lsn","type":"numeric(25,0)"},{"name":"merge_outstanding_merges","type":"bigint"},{"name":"merge_stats_number_of_merges","type":"bigint"},{"name":"merge_stats_log_blocks_merged","type":"bigint"},{"name":"merge_stats_bytes_merged","type":"bigint"},{"name":"merge_stats_user_time","type":"bigint"},{"name":"merge_stats_kernel_time","type":"bigint"},{"name":"bytes_of_large_data_serialized","type":"bigint"},{"name":"closed_checkpoint_epoch_value","type":"bigint"},{"name":"db_in_checkpoint_only_mode","type":"bit"}]} +{"schema":"sys","name":"dm_db_xtp_gc_cycle_stats","kind":"v","columns":[{"name":"cycle_id","type":"bigint","not_null":true},{"name":"ticks_at_cycle_start","type":"bigint","not_null":true},{"name":"ticks_at_cycle_end","type":"bigint","not_null":true},{"name":"node_id","type":"int","not_null":true},{"name":"base_generation","type":"bigint","not_null":true},{"name":"xacts_copied_to_local","type":"bigint","not_null":true},{"name":"xacts_in_gen_0","type":"bigint","not_null":true},{"name":"xacts_in_gen_1","type":"bigint","not_null":true},{"name":"xacts_in_gen_2","type":"bigint","not_null":true},{"name":"xacts_in_gen_3","type":"bigint","not_null":true},{"name":"xacts_in_gen_4","type":"bigint","not_null":true},{"name":"xacts_in_gen_5","type":"bigint","not_null":true},{"name":"xacts_in_gen_6","type":"bigint","not_null":true},{"name":"xacts_in_gen_7","type":"bigint","not_null":true},{"name":"xacts_in_gen_8","type":"bigint","not_null":true},{"name":"xacts_in_gen_9","type":"bigint","not_null":true},{"name":"xacts_in_gen_10","type":"bigint","not_null":true},{"name":"xacts_in_gen_11","type":"bigint","not_null":true},{"name":"xacts_in_gen_12","type":"bigint","not_null":true},{"name":"xacts_in_gen_13","type":"bigint","not_null":true},{"name":"xacts_in_gen_14","type":"bigint","not_null":true},{"name":"xacts_in_gen_15","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_hash_index_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"total_bucket_count","type":"bigint","not_null":true},{"name":"empty_bucket_count","type":"bigint"},{"name":"avg_chain_length","type":"bigint","not_null":true},{"name":"max_chain_length","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_index_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"scans_started","type":"bigint","not_null":true},{"name":"scans_retries","type":"bigint","not_null":true},{"name":"rows_returned","type":"bigint","not_null":true},{"name":"rows_touched","type":"bigint","not_null":true},{"name":"rows_expiring","type":"bigint","not_null":true},{"name":"rows_expired","type":"bigint","not_null":true},{"name":"rows_expired_removed","type":"bigint","not_null":true},{"name":"phantom_scans_started","type":"bigint","not_null":true},{"name":"phantom_scans_retries","type":"bigint","not_null":true},{"name":"phantom_rows_touched","type":"bigint","not_null":true},{"name":"phantom_expiring_rows_encountered","type":"bigint","not_null":true},{"name":"phantom_expired_removed_rows_encountered","type":"bigint","not_null":true},{"name":"phantom_expired_rows_removed","type":"bigint","not_null":true},{"name":"object_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_memory_consumers","kind":"v","columns":[{"name":"memory_consumer_id","type":"bigint","not_null":true},{"name":"memory_consumer_type","type":"int","not_null":true},{"name":"memory_consumer_type_desc","type":"nvarchar(16)","not_null":true},{"name":"memory_consumer_desc","type":"nvarchar(64)"},{"name":"object_id","type":"int"},{"name":"xtp_object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"allocated_bytes","type":"bigint","not_null":true},{"name":"used_bytes","type":"bigint","not_null":true},{"name":"allocation_count","type":"bigint","not_null":true},{"name":"partition_count","type":"int","not_null":true},{"name":"sizeclass_count","type":"int","not_null":true},{"name":"min_sizeclass","type":"int","not_null":true},{"name":"max_sizeclass","type":"int","not_null":true},{"name":"memory_consumer_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_nonclustered_index_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"delta_pages","type":"bigint","not_null":true},{"name":"internal_pages","type":"bigint","not_null":true},{"name":"leaf_pages","type":"bigint","not_null":true},{"name":"outstanding_retired_nodes","type":"bigint","not_null":true},{"name":"page_update_count","type":"bigint","not_null":true},{"name":"page_update_retry_count","type":"bigint","not_null":true},{"name":"page_consolidation_count","type":"bigint","not_null":true},{"name":"page_consolidation_retry_count","type":"bigint","not_null":true},{"name":"page_split_count","type":"bigint","not_null":true},{"name":"page_split_retry_count","type":"bigint","not_null":true},{"name":"key_split_count","type":"bigint","not_null":true},{"name":"key_split_retry_count","type":"bigint","not_null":true},{"name":"page_merge_count","type":"bigint","not_null":true},{"name":"page_merge_retry_count","type":"bigint","not_null":true},{"name":"key_merge_count","type":"bigint","not_null":true},{"name":"key_merge_retry_count","type":"bigint","not_null":true},{"name":"uses_key_normalization","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_object_stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"row_insert_attempts","type":"bigint","not_null":true},{"name":"row_update_attempts","type":"bigint","not_null":true},{"name":"row_delete_attempts","type":"bigint","not_null":true},{"name":"write_conflicts","type":"bigint","not_null":true},{"name":"unique_constraint_violations","type":"bigint","not_null":true},{"name":"object_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_table_memory_stats","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"memory_allocated_for_table_kb","type":"bigint"},{"name":"memory_used_by_table_kb","type":"bigint"},{"name":"memory_allocated_for_indexes_kb","type":"bigint"},{"name":"memory_used_by_indexes_kb","type":"bigint"}]} +{"schema":"sys","name":"dm_db_xtp_transactions","kind":"v","columns":[{"name":"node_id","type":"smallint","not_null":true},{"name":"xtp_transaction_id","type":"bigint","not_null":true},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"session_id","type":"smallint","not_null":true},{"name":"begin_tsn","type":"bigint","not_null":true},{"name":"end_tsn","type":"bigint","not_null":true},{"name":"state","type":"int","not_null":true},{"name":"state_desc","type":"nvarchar(16)","not_null":true},{"name":"result","type":"int","not_null":true},{"name":"result_desc","type":"nvarchar(24)","not_null":true},{"name":"xtp_parent_transaction_node_id","type":"smallint","not_null":true},{"name":"xtp_parent_transaction_id","type":"bigint","not_null":true},{"name":"last_error","type":"int","not_null":true},{"name":"is_speculative","type":"bit","not_null":true},{"name":"is_prepared","type":"bit","not_null":true},{"name":"is_delayed_durability","type":"bit","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"database_address","type":"varbinary(8)","not_null":true},{"name":"thread_id","type":"int","not_null":true},{"name":"read_set_row_count","type":"int","not_null":true},{"name":"write_set_row_count","type":"int","not_null":true},{"name":"scan_set_count","type":"int","not_null":true},{"name":"savepoint_garbage_count","type":"int","not_null":true},{"name":"log_bytes_required","type":"bigint","not_null":true},{"name":"count_of_allocations","type":"int","not_null":true},{"name":"allocated_bytes","type":"int","not_null":true},{"name":"reserved_bytes","type":"int","not_null":true},{"name":"commit_dependency_count","type":"int","not_null":true},{"name":"commit_dependency_total_attempt_count","type":"int","not_null":true},{"name":"scan_area","type":"int","not_null":true},{"name":"scan_area_desc","type":"nvarchar(16)","not_null":true},{"name":"scan_location","type":"int","not_null":true},{"name":"dependent_1_address","type":"varbinary(8)","not_null":true},{"name":"dependent_2_address","type":"varbinary(8)","not_null":true},{"name":"dependent_3_address","type":"varbinary(8)","not_null":true},{"name":"dependent_4_address","type":"varbinary(8)","not_null":true},{"name":"dependent_5_address","type":"varbinary(8)","not_null":true},{"name":"dependent_6_address","type":"varbinary(8)","not_null":true},{"name":"dependent_7_address","type":"varbinary(8)","not_null":true},{"name":"dependent_8_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_db_xtp_undeploy_status","kind":"v","columns":[{"name":"deployment_state","type":"int","not_null":true},{"name":"deployment_state_desc","type":"nvarchar(60)","not_null":true},{"name":"undeploy_lsn","type":"numeric(25,0)"},{"name":"start_of_log_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"dm_dist_requests","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"dist_statement_hash","type":"binary(8)"},{"name":"dist_statement_id","type":"uniqueidentifier"},{"name":"dist_client_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_distributed_exchange_stats","kind":"v","columns":[{"name":"request_id","type":"nvarchar(32)"},{"name":"step_index","type":"int","not_null":true},{"name":"dms_step_index","type":"int"},{"name":"source_distribution_id","type":"int","not_null":true},{"name":"destination_distribution_id","type":"int"},{"name":"type","type":"nvarchar(32)"},{"name":"status","type":"nvarchar(32)"},{"name":"bytes_per_sec","type":"bigint","not_null":true},{"name":"bytes_processed","type":"bigint","not_null":true},{"name":"rows_processed","type":"bigint","not_null":true},{"name":"start_time","type":"datetime","not_null":true},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int","not_null":true},{"name":"cpu_time","type":"bigint"},{"name":"query_time","type":"int","not_null":true},{"name":"buffers_available","type":"int"},{"name":"sql_spid","type":"int","not_null":true},{"name":"dms_cpid","type":"int"},{"name":"error_id","type":"nvarchar(36)"},{"name":"source_info","type":"nvarchar(4000)"},{"name":"destination_info","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_dw_databases","kind":"v","columns":[{"name":"logical_database_id","type":"uniqueidentifier","not_null":true},{"name":"logical_db_name","type":"nvarchar(129)"},{"name":"database_type","type":"nvarchar(100)"},{"name":"sync_point","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_dw_pit_databases","kind":"v","columns":[{"name":"logical_database_id","type":"uniqueidentifier"},{"name":"sql_db_id","type":"smallint","not_null":true},{"name":"pit_key","type":"nvarchar(4000)"},{"name":"pit_db_name","type":"nvarchar(129)"},{"name":"database_type","type":"nvarchar(100)"}]} +{"schema":"sys","name":"dm_dw_quality_clustering","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_id","type":"bigint"},{"name":"total_row_groups_analyzed","type":"bigint"},{"name":"max_overlap","type":"bigint"},{"name":"total_overlap","type":"bigint"},{"name":"total_cell_count","type":"smallint"},{"name":"quality","type":"float"},{"name":"unit_of_work","type":"bigint"}]} +{"schema":"sys","name":"dm_dw_quality_delta","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_id","type":"bigint"},{"name":"total_rows_analyzed","type":"bigint"},{"name":"quality","type":"float"},{"name":"unit_of_work","type":"bigint"}]} +{"schema":"sys","name":"dm_dw_quality_index","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_id","type":"bigint"},{"name":"overall_quality","type":"float"},{"name":"clustering_quality","type":"float"},{"name":"delta_quality","type":"float"},{"name":"row_group_quality","type":"float"},{"name":"unit_of_work","type":"bigint"}]} +{"schema":"sys","name":"dm_dw_quality_row_group","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"partition_id","type":"bigint"},{"name":"total_row_groups_analyzed","type":"bigint"},{"name":"total_poor_row_groups_analyzed","type":"bigint"},{"name":"average_rows","type":"float"},{"name":"quality","type":"float"},{"name":"unit_of_work","type":"bigint"}]} +{"schema":"sys","name":"dm_dw_resource_manager_abort_cache","kind":"v","columns":[{"name":"asn","type":"bigint","not_null":true},{"name":"bsn","type":"bigint","not_null":true},{"name":"nested_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_dw_resource_manager_active_tran","kind":"v","columns":[{"name":"read_version","type":"bigint","not_null":true},{"name":"write_version","type":"bigint","not_null":true},{"name":"nested_id","type":"bigint","not_null":true},{"name":"current_read_version","type":"bigint","not_null":true},{"name":"is_pit","type":"tinyint","not_null":true},{"name":"txn_type","type":"tinyint","not_null":true},{"name":"txn_tag","type":"tinyint","not_null":true},{"name":"is_txn_owner","type":"tinyint","not_null":true},{"name":"ddl_step","type":"smallint","not_null":true}]} +{"schema":"sys","name":"dm_dw_tran_manager_abort_cache","kind":"v","columns":[{"name":"asn","type":"bigint","not_null":true},{"name":"bsn","type":"bigint","not_null":true},{"name":"nested_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_dw_tran_manager_active_cache","kind":"v","columns":[{"name":"bsn","type":"bigint","not_null":true},{"name":"tag","type":"tinyint","not_null":true},{"name":"resource_manager_id","type":"uniqueidentifier","not_null":true}]} +{"schema":"sys","name":"dm_dw_tran_manager_commit_cache","kind":"v","columns":[{"name":"bsn","type":"bigint","not_null":true},{"name":"csn","type":"bigint","not_null":true},{"name":"min_active_bsn","type":"bigint","not_null":true},{"name":"tag","type":"tinyint","not_null":true},{"name":"state","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"dm_exec_background_job_queue","kind":"v","columns":[{"name":"time_queued","type":"datetime","not_null":true},{"name":"job_id","type":"int","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"object_id1","type":"int","not_null":true},{"name":"object_id2","type":"int","not_null":true},{"name":"object_id3","type":"int","not_null":true},{"name":"object_id4","type":"int","not_null":true},{"name":"error_code","type":"int"},{"name":"request_type","type":"smallint","not_null":true},{"name":"retry_count","type":"smallint","not_null":true},{"name":"in_progress","type":"smallint","not_null":true},{"name":"session_id","type":"smallint"}]} +{"schema":"sys","name":"dm_exec_background_job_queue_stats","kind":"v","columns":[{"name":"queue_max_len","type":"int","not_null":true},{"name":"enqueued_count","type":"int","not_null":true},{"name":"started_count","type":"int","not_null":true},{"name":"ended_count","type":"int","not_null":true},{"name":"failed_lock_count","type":"int","not_null":true},{"name":"failed_other_count","type":"int","not_null":true},{"name":"failed_giveup_count","type":"int","not_null":true},{"name":"enqueue_failed_full_count","type":"int","not_null":true},{"name":"enqueue_failed_duplicate_count","type":"int","not_null":true},{"name":"elapsed_avg_ms","type":"int","not_null":true},{"name":"elapsed_max_ms","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_cached_plans","kind":"v","columns":[{"name":"bucketid","type":"int","not_null":true},{"name":"refcounts","type":"int","not_null":true},{"name":"usecounts","type":"int","not_null":true},{"name":"size_in_bytes","type":"int","not_null":true},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"cacheobjtype","type":"nvarchar(50)","not_null":true},{"name":"objtype","type":"nvarchar(20)","not_null":true},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"pool_id","type":"int","not_null":true},{"name":"parent_plan_handle","type":"varbinary(64)"}]} +{"schema":"sys","name":"dm_exec_ce_feedback_cache","kind":"v","columns":[{"name":"database_id","type":"bigint","not_null":true},{"name":"fingerprint","type":"varbinary(8)","not_null":true},{"name":"feedback","type":"varbinary(8)","not_null":true},{"name":"observed_count","type":"bigint","not_null":true},{"name":"state","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_compute_node_errors","kind":"v","columns":[{"name":"error_id","type":"nvarchar(36)"},{"name":"source","type":"nvarchar(255)"},{"name":"type","type":"nvarchar(255)"},{"name":"create_time","type":"datetime"},{"name":"compute_node_id","type":"int"},{"name":"execution_id","type":"nvarchar(36)"},{"name":"spid","type":"int"},{"name":"thread_id","type":"int"},{"name":"details","type":"nvarchar(4000)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_compute_node_status","kind":"v","columns":[{"name":"compute_node_id","type":"int"},{"name":"process_id","type":"int"},{"name":"process_name","type":"nvarchar(255)"},{"name":"allocated_memory","type":"bigint"},{"name":"available_memory","type":"bigint"},{"name":"process_cpu_usage","type":"bigint"},{"name":"total_cpu_usage","type":"bigint"},{"name":"thread_count","type":"bigint"},{"name":"handle_count","type":"bigint"},{"name":"total_elapsed_time","type":"bigint"},{"name":"is_available","type":"bit"},{"name":"sent_time","type":"datetime"},{"name":"received_time","type":"datetime"},{"name":"error_id","type":"nvarchar(36)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_compute_nodes","kind":"v","columns":[{"name":"compute_node_id","type":"int"},{"name":"type","type":"nvarchar(32)"},{"name":"name","type":"nvarchar(32)"},{"name":"address","type":"nvarchar(32)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_compute_pools","kind":"v","columns":[{"name":"compute_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)"},{"name":"location","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_exec_connections","kind":"v","columns":[{"name":"session_id","type":"int"},{"name":"most_recent_session_id","type":"int"},{"name":"connect_time","type":"datetime","not_null":true},{"name":"net_transport","type":"nvarchar(40)","not_null":true},{"name":"protocol_type","type":"nvarchar(40)"},{"name":"protocol_version","type":"int"},{"name":"endpoint_id","type":"int"},{"name":"encrypt_option","type":"nvarchar(40)","not_null":true},{"name":"auth_scheme","type":"nvarchar(40)","not_null":true},{"name":"node_affinity","type":"smallint","not_null":true},{"name":"num_reads","type":"int"},{"name":"num_writes","type":"int"},{"name":"last_read","type":"datetime"},{"name":"last_write","type":"datetime"},{"name":"net_packet_size","type":"int"},{"name":"client_net_address","type":"nvarchar(48)"},{"name":"client_tcp_port","type":"int"},{"name":"local_net_address","type":"nvarchar(48)"},{"name":"local_tcp_port","type":"int"},{"name":"connection_id","type":"uniqueidentifier","not_null":true},{"name":"parent_connection_id","type":"uniqueidentifier"},{"name":"most_recent_sql_handle","type":"varbinary(64)"}]} +{"schema":"sys","name":"dm_exec_distributed_request_steps","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"operation_type","type":"nvarchar(128)"},{"name":"distribution_type","type":"nvarchar(32)"},{"name":"location_type","type":"nvarchar(32)"},{"name":"status","type":"nvarchar(32)"},{"name":"error_id","type":"nvarchar(36)"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"row_count","type":"bigint"},{"name":"command","type":"nvarchar(4000)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_distributed_requests","kind":"v","columns":[{"name":"sql_handle","type":"varbinary(64)"},{"name":"execution_id","type":"nvarchar(32)"},{"name":"status","type":"nvarchar(32)"},{"name":"error_id","type":"nvarchar(36)"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_distributed_sql_requests","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"compute_node_id","type":"int"},{"name":"distribution_id","type":"int"},{"name":"status","type":"nvarchar(32)"},{"name":"error_id","type":"nvarchar(36)"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"row_count","type":"bigint"},{"name":"spid","type":"int"},{"name":"command","type":"nvarchar(4000)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_distributed_tasks","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"start_time","type":"datetime","not_null":true},{"name":"cpu_time","type":"int","not_null":true},{"name":"total_elapsed_time","type":"int","not_null":true},{"name":"distributed_statement_id","type":"nvarchar(38)"},{"name":"distributed_query_hash","type":"nvarchar(38)"},{"name":"distributed_request_id","type":"nvarchar(38)"},{"name":"distributed_scheduler_id","type":"nvarchar(38)"},{"name":"distributed_query_operator_id","type":"nvarchar(38)"},{"name":"distributed_task_group_id","type":"nvarchar(38)"},{"name":"distributed_execution_id","type":"nvarchar(38)"},{"name":"distributed_submission_id","type":"nvarchar(38)"}]} +{"schema":"sys","name":"dm_exec_dms_services","kind":"v","columns":[{"name":"dms_core_id","type":"int"},{"name":"compute_node_id","type":"int"},{"name":"status","type":"nvarchar(32)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_dms_workers","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"dms_step_index","type":"int"},{"name":"compute_node_id","type":"int"},{"name":"distribution_id","type":"int"},{"name":"type","type":"nvarchar(32)"},{"name":"status","type":"nvarchar(32)"},{"name":"bytes_per_sec","type":"bigint"},{"name":"bytes_processed","type":"bigint"},{"name":"rows_processed","type":"bigint"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"cpu_time","type":"bigint"},{"name":"query_time","type":"int"},{"name":"buffers_available","type":"int"},{"name":"dms_cpid","type":"int"},{"name":"sql_spid","type":"int"},{"name":"error_id","type":"nvarchar(36)"},{"name":"source_info","type":"nvarchar(4000)"},{"name":"destination_info","type":"nvarchar(4000)"},{"name":"command","type":"nvarchar(4000)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_external_operations","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"operation_type","type":"nvarchar(128)"},{"name":"operation_name","type":"nvarchar(4000)"},{"name":"map_progress","type":"float"},{"name":"reduce_progress","type":"float"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_external_work","kind":"v","columns":[{"name":"execution_id","type":"nvarchar(32)"},{"name":"step_index","type":"int"},{"name":"dms_step_index","type":"int"},{"name":"work_id","type":"int"},{"name":"compute_node_id","type":"int"},{"name":"type","type":"nvarchar(60)"},{"name":"input_name","type":"nvarchar(4000)"},{"name":"read_location","type":"bigint"},{"name":"read_command","type":"nvarchar(4000)"},{"name":"bytes_processed","type":"bigint"},{"name":"length","type":"bigint"},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time","type":"int"},{"name":"status","type":"nvarchar(32)"},{"name":"compute_pool_id","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_function_stats","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"sql_handle","type":"varbinary(64)","not_null":true},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"cached_time","type":"datetime"},{"name":"last_execution_time","type":"datetime"},{"name":"execution_count","type":"bigint","not_null":true},{"name":"total_worker_time","type":"bigint","not_null":true},{"name":"last_worker_time","type":"bigint","not_null":true},{"name":"min_worker_time","type":"bigint","not_null":true},{"name":"max_worker_time","type":"bigint","not_null":true},{"name":"total_physical_reads","type":"bigint","not_null":true},{"name":"last_physical_reads","type":"bigint","not_null":true},{"name":"min_physical_reads","type":"bigint","not_null":true},{"name":"max_physical_reads","type":"bigint","not_null":true},{"name":"total_logical_writes","type":"bigint","not_null":true},{"name":"last_logical_writes","type":"bigint","not_null":true},{"name":"min_logical_writes","type":"bigint","not_null":true},{"name":"max_logical_writes","type":"bigint","not_null":true},{"name":"total_logical_reads","type":"bigint","not_null":true},{"name":"last_logical_reads","type":"bigint","not_null":true},{"name":"min_logical_reads","type":"bigint","not_null":true},{"name":"max_logical_reads","type":"bigint","not_null":true},{"name":"total_elapsed_time","type":"bigint","not_null":true},{"name":"last_elapsed_time","type":"bigint","not_null":true},{"name":"min_elapsed_time","type":"bigint","not_null":true},{"name":"max_elapsed_time","type":"bigint","not_null":true},{"name":"total_num_physical_reads","type":"bigint","not_null":true},{"name":"last_num_physical_reads","type":"bigint","not_null":true},{"name":"min_num_physical_reads","type":"bigint","not_null":true},{"name":"max_num_physical_reads","type":"bigint","not_null":true},{"name":"total_page_server_reads","type":"bigint","not_null":true},{"name":"last_page_server_reads","type":"bigint","not_null":true},{"name":"min_page_server_reads","type":"bigint","not_null":true},{"name":"max_page_server_reads","type":"bigint","not_null":true},{"name":"total_num_page_server_reads","type":"bigint","not_null":true},{"name":"last_num_page_server_reads","type":"bigint","not_null":true},{"name":"min_num_page_server_reads","type":"bigint","not_null":true},{"name":"max_num_page_server_reads","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_procedure_stats","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"sql_handle","type":"varbinary(64)","not_null":true},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"cached_time","type":"datetime"},{"name":"last_execution_time","type":"datetime"},{"name":"execution_count","type":"bigint","not_null":true},{"name":"total_worker_time","type":"bigint","not_null":true},{"name":"last_worker_time","type":"bigint","not_null":true},{"name":"min_worker_time","type":"bigint","not_null":true},{"name":"max_worker_time","type":"bigint","not_null":true},{"name":"total_physical_reads","type":"bigint","not_null":true},{"name":"last_physical_reads","type":"bigint","not_null":true},{"name":"min_physical_reads","type":"bigint","not_null":true},{"name":"max_physical_reads","type":"bigint","not_null":true},{"name":"total_logical_writes","type":"bigint","not_null":true},{"name":"last_logical_writes","type":"bigint","not_null":true},{"name":"min_logical_writes","type":"bigint","not_null":true},{"name":"max_logical_writes","type":"bigint","not_null":true},{"name":"total_logical_reads","type":"bigint","not_null":true},{"name":"last_logical_reads","type":"bigint","not_null":true},{"name":"min_logical_reads","type":"bigint","not_null":true},{"name":"max_logical_reads","type":"bigint","not_null":true},{"name":"total_elapsed_time","type":"bigint","not_null":true},{"name":"last_elapsed_time","type":"bigint","not_null":true},{"name":"min_elapsed_time","type":"bigint","not_null":true},{"name":"max_elapsed_time","type":"bigint","not_null":true},{"name":"total_spills","type":"bigint"},{"name":"last_spills","type":"bigint"},{"name":"min_spills","type":"bigint"},{"name":"max_spills","type":"bigint"},{"name":"total_num_physical_reads","type":"bigint","not_null":true},{"name":"last_num_physical_reads","type":"bigint","not_null":true},{"name":"min_num_physical_reads","type":"bigint","not_null":true},{"name":"max_num_physical_reads","type":"bigint","not_null":true},{"name":"total_page_server_reads","type":"bigint","not_null":true},{"name":"last_page_server_reads","type":"bigint","not_null":true},{"name":"min_page_server_reads","type":"bigint","not_null":true},{"name":"max_page_server_reads","type":"bigint","not_null":true},{"name":"total_num_page_server_reads","type":"bigint","not_null":true},{"name":"last_num_page_server_reads","type":"bigint","not_null":true},{"name":"min_num_page_server_reads","type":"bigint","not_null":true},{"name":"max_num_page_server_reads","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_query_memory_grants","kind":"v","columns":[{"name":"session_id","type":"smallint"},{"name":"request_id","type":"int"},{"name":"scheduler_id","type":"int"},{"name":"dop","type":"smallint"},{"name":"request_time","type":"datetime"},{"name":"grant_time","type":"datetime"},{"name":"requested_memory_kb","type":"bigint"},{"name":"granted_memory_kb","type":"bigint"},{"name":"required_memory_kb","type":"bigint"},{"name":"used_memory_kb","type":"bigint"},{"name":"max_used_memory_kb","type":"bigint"},{"name":"query_cost","type":"float"},{"name":"timeout_sec","type":"int"},{"name":"resource_semaphore_id","type":"smallint"},{"name":"queue_id","type":"smallint"},{"name":"wait_order","type":"int"},{"name":"is_next_candidate","type":"bit"},{"name":"wait_time_ms","type":"bigint"},{"name":"plan_handle","type":"varbinary(64)"},{"name":"sql_handle","type":"varbinary(64)"},{"name":"group_id","type":"int"},{"name":"pool_id","type":"int"},{"name":"is_small","type":"bit"},{"name":"ideal_memory_kb","type":"bigint"},{"name":"reserved_worker_count","type":"int"},{"name":"used_worker_count","type":"int"},{"name":"max_used_worker_count","type":"int"},{"name":"reserved_node_bitmap","type":"bigint"},{"name":"query_hash","type":"binary(8)"},{"name":"query_plan_hash","type":"binary(8)"}]} +{"schema":"sys","name":"dm_exec_query_optimizer_info","kind":"v","columns":[{"name":"counter","type":"nvarchar(4000)","not_null":true},{"name":"occurrence","type":"bigint","not_null":true},{"name":"value","type":"float"}]} +{"schema":"sys","name":"dm_exec_query_optimizer_memory_gateways","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"max_count","type":"int","not_null":true},{"name":"active_count","type":"int","not_null":true},{"name":"waiter_count","type":"int","not_null":true},{"name":"threshold_factor","type":"bigint","not_null":true},{"name":"threshold","type":"bigint","not_null":true},{"name":"is_active","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_exec_query_parallel_workers","kind":"v","columns":[{"name":"node_id","type":"int","not_null":true},{"name":"scheduler_count","type":"int","not_null":true},{"name":"max_worker_count","type":"int","not_null":true},{"name":"reserved_worker_count","type":"int","not_null":true},{"name":"free_worker_count","type":"int","not_null":true},{"name":"used_worker_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_exec_query_profiles","kind":"v","columns":[{"name":"session_id","type":"smallint"},{"name":"request_id","type":"int"},{"name":"sql_handle","type":"varbinary(64)"},{"name":"plan_handle","type":"varbinary(64)"},{"name":"physical_operator_name","type":"nvarchar(256)"},{"name":"node_id","type":"int"},{"name":"thread_id","type":"int"},{"name":"task_address","type":"varbinary(8)","not_null":true},{"name":"row_count","type":"bigint"},{"name":"rewind_count","type":"bigint"},{"name":"rebind_count","type":"bigint"},{"name":"end_of_scan_count","type":"bigint"},{"name":"estimate_row_count","type":"bigint"},{"name":"first_active_time","type":"bigint"},{"name":"last_active_time","type":"bigint"},{"name":"open_time","type":"bigint"},{"name":"first_row_time","type":"bigint"},{"name":"last_row_time","type":"bigint"},{"name":"close_time","type":"bigint"},{"name":"elapsed_time_ms","type":"bigint"},{"name":"cpu_time_ms","type":"bigint"},{"name":"database_id","type":"smallint"},{"name":"object_id","type":"int"},{"name":"index_id","type":"int"},{"name":"scan_count","type":"bigint"},{"name":"logical_read_count","type":"bigint"},{"name":"physical_read_count","type":"bigint"},{"name":"read_ahead_count","type":"bigint"},{"name":"write_page_count","type":"bigint"},{"name":"lob_logical_read_count","type":"bigint"},{"name":"lob_physical_read_count","type":"bigint"},{"name":"lob_read_ahead_count","type":"bigint"},{"name":"segment_read_count","type":"int"},{"name":"segment_skip_count","type":"int"},{"name":"actual_read_row_count","type":"bigint"},{"name":"estimated_read_row_count","type":"bigint"},{"name":"page_server_read_count","type":"bigint"},{"name":"page_server_read_ahead_count","type":"bigint"},{"name":"lob_page_server_read_count","type":"bigint"},{"name":"lob_page_server_read_ahead_count","type":"bigint"},{"name":"row_requalification_count","type":"bigint"}]} +{"schema":"sys","name":"dm_exec_query_resource_semaphores","kind":"v","columns":[{"name":"resource_semaphore_id","type":"smallint"},{"name":"target_memory_kb","type":"bigint"},{"name":"max_target_memory_kb","type":"bigint"},{"name":"total_memory_kb","type":"bigint"},{"name":"available_memory_kb","type":"bigint"},{"name":"granted_memory_kb","type":"bigint"},{"name":"used_memory_kb","type":"bigint"},{"name":"grantee_count","type":"int"},{"name":"waiter_count","type":"int"},{"name":"timeout_error_count","type":"bigint"},{"name":"forced_grant_count","type":"bigint"},{"name":"pool_id","type":"int"}]} +{"schema":"sys","name":"dm_exec_query_stats","kind":"v","columns":[{"name":"sql_handle","type":"varbinary(64)","not_null":true},{"name":"statement_start_offset","type":"int","not_null":true},{"name":"statement_end_offset","type":"int","not_null":true},{"name":"plan_generation_num","type":"bigint"},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"creation_time","type":"datetime"},{"name":"last_execution_time","type":"datetime"},{"name":"execution_count","type":"bigint","not_null":true},{"name":"total_worker_time","type":"bigint","not_null":true},{"name":"last_worker_time","type":"bigint","not_null":true},{"name":"min_worker_time","type":"bigint","not_null":true},{"name":"max_worker_time","type":"bigint","not_null":true},{"name":"total_physical_reads","type":"bigint","not_null":true},{"name":"last_physical_reads","type":"bigint","not_null":true},{"name":"min_physical_reads","type":"bigint","not_null":true},{"name":"max_physical_reads","type":"bigint","not_null":true},{"name":"total_logical_writes","type":"bigint","not_null":true},{"name":"last_logical_writes","type":"bigint","not_null":true},{"name":"min_logical_writes","type":"bigint","not_null":true},{"name":"max_logical_writes","type":"bigint","not_null":true},{"name":"total_logical_reads","type":"bigint","not_null":true},{"name":"last_logical_reads","type":"bigint","not_null":true},{"name":"min_logical_reads","type":"bigint","not_null":true},{"name":"max_logical_reads","type":"bigint","not_null":true},{"name":"total_clr_time","type":"bigint","not_null":true},{"name":"last_clr_time","type":"bigint","not_null":true},{"name":"min_clr_time","type":"bigint","not_null":true},{"name":"max_clr_time","type":"bigint","not_null":true},{"name":"total_elapsed_time","type":"bigint","not_null":true},{"name":"last_elapsed_time","type":"bigint","not_null":true},{"name":"min_elapsed_time","type":"bigint","not_null":true},{"name":"max_elapsed_time","type":"bigint","not_null":true},{"name":"query_hash","type":"binary(8)"},{"name":"query_plan_hash","type":"binary(8)"},{"name":"total_rows","type":"bigint"},{"name":"last_rows","type":"bigint"},{"name":"min_rows","type":"bigint"},{"name":"max_rows","type":"bigint"},{"name":"statement_sql_handle","type":"varbinary(64)"},{"name":"statement_context_id","type":"bigint"},{"name":"total_dop","type":"bigint"},{"name":"last_dop","type":"bigint"},{"name":"min_dop","type":"bigint"},{"name":"max_dop","type":"bigint"},{"name":"total_grant_kb","type":"bigint"},{"name":"last_grant_kb","type":"bigint"},{"name":"min_grant_kb","type":"bigint"},{"name":"max_grant_kb","type":"bigint"},{"name":"total_used_grant_kb","type":"bigint"},{"name":"last_used_grant_kb","type":"bigint"},{"name":"min_used_grant_kb","type":"bigint"},{"name":"max_used_grant_kb","type":"bigint"},{"name":"total_ideal_grant_kb","type":"bigint"},{"name":"last_ideal_grant_kb","type":"bigint"},{"name":"min_ideal_grant_kb","type":"bigint"},{"name":"max_ideal_grant_kb","type":"bigint"},{"name":"total_reserved_threads","type":"bigint"},{"name":"last_reserved_threads","type":"bigint"},{"name":"min_reserved_threads","type":"bigint"},{"name":"max_reserved_threads","type":"bigint"},{"name":"total_used_threads","type":"bigint"},{"name":"last_used_threads","type":"bigint"},{"name":"min_used_threads","type":"bigint"},{"name":"max_used_threads","type":"bigint"},{"name":"total_columnstore_segment_reads","type":"bigint"},{"name":"last_columnstore_segment_reads","type":"bigint"},{"name":"min_columnstore_segment_reads","type":"bigint"},{"name":"max_columnstore_segment_reads","type":"bigint"},{"name":"total_columnstore_segment_skips","type":"bigint"},{"name":"last_columnstore_segment_skips","type":"bigint"},{"name":"min_columnstore_segment_skips","type":"bigint"},{"name":"max_columnstore_segment_skips","type":"bigint"},{"name":"total_spills","type":"bigint"},{"name":"last_spills","type":"bigint"},{"name":"min_spills","type":"bigint"},{"name":"max_spills","type":"bigint"},{"name":"total_num_physical_reads","type":"bigint","not_null":true},{"name":"last_num_physical_reads","type":"bigint","not_null":true},{"name":"min_num_physical_reads","type":"bigint","not_null":true},{"name":"max_num_physical_reads","type":"bigint","not_null":true},{"name":"total_page_server_reads","type":"bigint","not_null":true},{"name":"last_page_server_reads","type":"bigint","not_null":true},{"name":"min_page_server_reads","type":"bigint","not_null":true},{"name":"max_page_server_reads","type":"bigint","not_null":true},{"name":"total_num_page_server_reads","type":"bigint","not_null":true},{"name":"last_num_page_server_reads","type":"bigint","not_null":true},{"name":"min_num_page_server_reads","type":"bigint","not_null":true},{"name":"max_num_page_server_reads","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_query_transformation_stats","kind":"v","columns":[{"name":"name","type":"varchar(8000)","not_null":true},{"name":"promise_total","type":"bigint","not_null":true},{"name":"promise_avg","type":"float","not_null":true},{"name":"promised","type":"bigint","not_null":true},{"name":"built_substitute","type":"bigint","not_null":true},{"name":"succeeded","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_requests","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"start_time","type":"datetime","not_null":true},{"name":"status","type":"nvarchar(30)","not_null":true},{"name":"command","type":"nvarchar(32)","not_null":true},{"name":"sql_handle","type":"varbinary(64)"},{"name":"statement_start_offset","type":"int"},{"name":"statement_end_offset","type":"int"},{"name":"plan_handle","type":"varbinary(64)"},{"name":"database_id","type":"smallint","not_null":true},{"name":"user_id","type":"int","not_null":true},{"name":"connection_id","type":"uniqueidentifier"},{"name":"blocking_session_id","type":"smallint"},{"name":"wait_type","type":"nvarchar(60)"},{"name":"wait_time","type":"int","not_null":true},{"name":"last_wait_type","type":"nvarchar(60)","not_null":true},{"name":"wait_resource","type":"nvarchar(256)","not_null":true},{"name":"open_transaction_count","type":"int","not_null":true},{"name":"open_resultset_count","type":"int","not_null":true},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"context_info","type":"varbinary(128)"},{"name":"percent_complete","type":"real","not_null":true},{"name":"estimated_completion_time","type":"bigint","not_null":true},{"name":"cpu_time","type":"int","not_null":true},{"name":"total_elapsed_time","type":"int","not_null":true},{"name":"scheduler_id","type":"int"},{"name":"task_address","type":"varbinary(8)"},{"name":"reads","type":"bigint","not_null":true},{"name":"writes","type":"bigint","not_null":true},{"name":"logical_reads","type":"bigint","not_null":true},{"name":"text_size","type":"int","not_null":true},{"name":"language","type":"nvarchar(128)"},{"name":"date_format","type":"nvarchar(3)"},{"name":"date_first","type":"smallint","not_null":true},{"name":"quoted_identifier","type":"bit","not_null":true},{"name":"arithabort","type":"bit","not_null":true},{"name":"ansi_null_dflt_on","type":"bit","not_null":true},{"name":"ansi_defaults","type":"bit","not_null":true},{"name":"ansi_warnings","type":"bit","not_null":true},{"name":"ansi_padding","type":"bit","not_null":true},{"name":"ansi_nulls","type":"bit","not_null":true},{"name":"concat_null_yields_null","type":"bit","not_null":true},{"name":"transaction_isolation_level","type":"smallint","not_null":true},{"name":"lock_timeout","type":"int","not_null":true},{"name":"deadlock_priority","type":"int","not_null":true},{"name":"row_count","type":"bigint","not_null":true},{"name":"prev_error","type":"int","not_null":true},{"name":"nest_level","type":"int","not_null":true},{"name":"granted_query_memory","type":"int","not_null":true},{"name":"executing_managed_code","type":"bit","not_null":true},{"name":"group_id","type":"int","not_null":true},{"name":"query_hash","type":"binary(8)"},{"name":"query_plan_hash","type":"binary(8)"},{"name":"statement_sql_handle","type":"varbinary(64)"},{"name":"statement_context_id","type":"bigint"},{"name":"dop","type":"int","not_null":true},{"name":"parallel_worker_count","type":"int"},{"name":"external_script_request_id","type":"uniqueidentifier"},{"name":"is_resumable","type":"bit","not_null":true},{"name":"page_resource","type":"varbinary(8)"},{"name":"page_server_reads","type":"bigint","not_null":true},{"name":"dist_statement_id","type":"uniqueidentifier"},{"name":"label","type":"nvarchar(255)"}]} +{"schema":"sys","name":"dm_exec_requests_history","kind":"v","columns":[{"name":"status","type":"varchar(9)","not_null":true},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"distributed_statement_id","type":"nvarchar(128)","not_null":true},{"name":"query_hash","type":"binary(8)","not_null":true},{"name":"login_name","type":"nvarchar(644)"},{"name":"start_time","type":"datetime2(7)","not_null":true},{"name":"end_time","type":"datetime2(7)","not_null":true},{"name":"command","type":"nvarchar(4000)"},{"name":"query_text","type":"nvarchar(max)"},{"name":"total_elapsed_time_ms","type":"bigint"},{"name":"data_processed_mb","type":"bigint","not_null":true},{"name":"error","type":"nvarchar(max)"},{"name":"error_code","type":"int"},{"name":"rejected_rows_path","type":"nvarchar(max)"}]} +{"schema":"sys","name":"dm_exec_session_wait_stats","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"wait_type","type":"nvarchar(60)","not_null":true},{"name":"waiting_tasks_count","type":"bigint","not_null":true},{"name":"wait_time_ms","type":"bigint","not_null":true},{"name":"max_wait_time_ms","type":"bigint","not_null":true},{"name":"signal_wait_time_ms","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_sessions","kind":"v","columns":[{"name":"session_id","type":"smallint","not_null":true},{"name":"login_time","type":"datetime","not_null":true},{"name":"host_name","type":"nvarchar(128)"},{"name":"program_name","type":"nvarchar(128)"},{"name":"host_process_id","type":"int"},{"name":"client_version","type":"int"},{"name":"client_interface_name","type":"nvarchar(32)"},{"name":"security_id","type":"varbinary(85)","not_null":true},{"name":"login_name","type":"nvarchar(128)","not_null":true},{"name":"nt_domain","type":"nvarchar(128)"},{"name":"nt_user_name","type":"nvarchar(128)"},{"name":"status","type":"nvarchar(30)","not_null":true},{"name":"context_info","type":"varbinary(128)"},{"name":"cpu_time","type":"int","not_null":true},{"name":"memory_usage","type":"int","not_null":true},{"name":"total_scheduled_time","type":"int","not_null":true},{"name":"total_elapsed_time","type":"int","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"last_request_start_time","type":"datetime","not_null":true},{"name":"last_request_end_time","type":"datetime"},{"name":"reads","type":"bigint","not_null":true},{"name":"writes","type":"bigint","not_null":true},{"name":"logical_reads","type":"bigint","not_null":true},{"name":"is_user_process","type":"bit","not_null":true},{"name":"text_size","type":"int","not_null":true},{"name":"language","type":"nvarchar(128)"},{"name":"date_format","type":"nvarchar(3)"},{"name":"date_first","type":"smallint","not_null":true},{"name":"quoted_identifier","type":"bit","not_null":true},{"name":"arithabort","type":"bit","not_null":true},{"name":"ansi_null_dflt_on","type":"bit","not_null":true},{"name":"ansi_defaults","type":"bit","not_null":true},{"name":"ansi_warnings","type":"bit","not_null":true},{"name":"ansi_padding","type":"bit","not_null":true},{"name":"ansi_nulls","type":"bit","not_null":true},{"name":"concat_null_yields_null","type":"bit","not_null":true},{"name":"transaction_isolation_level","type":"smallint","not_null":true},{"name":"lock_timeout","type":"int","not_null":true},{"name":"deadlock_priority","type":"int","not_null":true},{"name":"row_count","type":"bigint","not_null":true},{"name":"prev_error","type":"int","not_null":true},{"name":"original_security_id","type":"varbinary(85)","not_null":true},{"name":"original_login_name","type":"nvarchar(128)","not_null":true},{"name":"last_successful_logon","type":"datetime"},{"name":"last_unsuccessful_logon","type":"datetime"},{"name":"unsuccessful_logons","type":"bigint"},{"name":"group_id","type":"int","not_null":true},{"name":"database_id","type":"smallint","not_null":true},{"name":"authenticating_database_id","type":"int"},{"name":"open_transaction_count","type":"int","not_null":true},{"name":"page_server_reads","type":"bigint","not_null":true},{"name":"contained_availability_group_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_exec_trigger_stats","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"sql_handle","type":"varbinary(64)","not_null":true},{"name":"plan_handle","type":"varbinary(64)","not_null":true},{"name":"cached_time","type":"datetime"},{"name":"last_execution_time","type":"datetime"},{"name":"execution_count","type":"bigint","not_null":true},{"name":"total_worker_time","type":"bigint","not_null":true},{"name":"last_worker_time","type":"bigint","not_null":true},{"name":"min_worker_time","type":"bigint","not_null":true},{"name":"max_worker_time","type":"bigint","not_null":true},{"name":"total_physical_reads","type":"bigint","not_null":true},{"name":"last_physical_reads","type":"bigint","not_null":true},{"name":"min_physical_reads","type":"bigint","not_null":true},{"name":"max_physical_reads","type":"bigint","not_null":true},{"name":"total_logical_writes","type":"bigint","not_null":true},{"name":"last_logical_writes","type":"bigint","not_null":true},{"name":"min_logical_writes","type":"bigint","not_null":true},{"name":"max_logical_writes","type":"bigint","not_null":true},{"name":"total_logical_reads","type":"bigint","not_null":true},{"name":"last_logical_reads","type":"bigint","not_null":true},{"name":"min_logical_reads","type":"bigint","not_null":true},{"name":"max_logical_reads","type":"bigint","not_null":true},{"name":"total_elapsed_time","type":"bigint","not_null":true},{"name":"last_elapsed_time","type":"bigint","not_null":true},{"name":"min_elapsed_time","type":"bigint","not_null":true},{"name":"max_elapsed_time","type":"bigint","not_null":true},{"name":"total_spills","type":"bigint"},{"name":"last_spills","type":"bigint"},{"name":"min_spills","type":"bigint"},{"name":"max_spills","type":"bigint"},{"name":"total_num_physical_reads","type":"bigint","not_null":true},{"name":"last_num_physical_reads","type":"bigint","not_null":true},{"name":"min_num_physical_reads","type":"bigint","not_null":true},{"name":"max_num_physical_reads","type":"bigint","not_null":true},{"name":"total_page_server_reads","type":"bigint","not_null":true},{"name":"last_page_server_reads","type":"bigint","not_null":true},{"name":"min_page_server_reads","type":"bigint","not_null":true},{"name":"max_page_server_reads","type":"bigint","not_null":true},{"name":"total_num_page_server_reads","type":"bigint","not_null":true},{"name":"last_num_page_server_reads","type":"bigint","not_null":true},{"name":"min_num_page_server_reads","type":"bigint","not_null":true},{"name":"max_num_page_server_reads","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_exec_valid_use_hints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"dm_external_authentication","kind":"v","columns":[{"name":"use_identity","type":"bit"},{"name":"credential_id","type":"int"},{"name":"certificate_id","type":"int"}]} +{"schema":"sys","name":"dm_external_data_processed","kind":"v","columns":[{"name":"type","type":"varchar(7)","not_null":true},{"name":"data_processed_mb","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_external_governance_sync_state","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"sync_scope","type":"smallint"},{"name":"sync_scope_desc","type":"nvarchar(60)"},{"name":"sync_state","type":"smallint"},{"name":"sync_state_desc","type":"nvarchar(60)"},{"name":"user_initiated_sync","type":"smallint"},{"name":"sync_percent_complete","type":"smallint"},{"name":"current_sync_token","type":"nvarchar(128)"},{"name":"next_sync_token","type":"nvarchar(128)"},{"name":"last_reference_fetch_success_time_utc","type":"datetime"},{"name":"last_reference_fetch_attempt_time_utc","type":"datetime"},{"name":"last_reference_fetch_error","type":"int"},{"name":"last_blob_fetch_success_time_utc","type":"datetime"},{"name":"last_blob_fetch_attempt_time_utc","type":"datetime"},{"name":"last_blob_fetch_error","type":"int"},{"name":"last_sync_success_time_utc","type":"datetime"},{"name":"last_synchronizing_success_time_utc","type":"datetime"},{"name":"last_synchronizing_attempt_time_utc","type":"datetime"},{"name":"last_synchronizing_error","type":"int"}]} +{"schema":"sys","name":"dm_external_governance_synchronizing_objects","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"schema_id","type":"int"},{"name":"last_fetch_time_utc","type":"datetime"},{"name":"last_synchronizing_attempt_time_utc","type":"datetime"},{"name":"last_synchronizing_error","type":"int"}]} +{"schema":"sys","name":"dm_external_policy_cache","kind":"v","columns":[{"name":"policy_cache_state","type":"int"},{"name":"policy_cache_state_desc","type":"nvarchar(16)"},{"name":"last_policy_cache_update_time","type":"datetime2(7)"},{"name":"last_pull_type","type":"int"},{"name":"last_pull_type_desc","type":"nvarchar(16)"},{"name":"number_of_cached_policies","type":"int"}]} +{"schema":"sys","name":"dm_external_policy_excluded_role_members","kind":"v","columns":[{"name":"excluded_principal_object_id","type":"nvarchar(36)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"assignment_scope","type":"nvarchar(4000)"},{"name":"condition_function","type":"nvarchar(128)"},{"name":"condition_function_parameters","type":"nvarchar(128)"}]} +{"schema":"sys","name":"dm_external_provider_certificate_info","kind":"v","columns":[{"name":"subject","type":"nvarchar(128)"},{"name":"thumbprint","type":"nvarchar(128)"},{"name":"expiry_date","type":"datetime"},{"name":"is_readable","type":"bit"},{"name":"is_missing","type":"bit"}]} +{"schema":"sys","name":"dm_external_script_execution_stats","kind":"v","columns":[{"name":"language","type":"nvarchar(128)"},{"name":"counter_name","type":"nvarchar(256)","not_null":true},{"name":"counter_value","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_external_script_requests","kind":"v","columns":[{"name":"external_script_request_id","type":"uniqueidentifier","not_null":true},{"name":"language","type":"nvarchar(128)"},{"name":"degree_of_parallelism","type":"int","not_null":true},{"name":"external_user_name","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_external_script_resource_usage_stats","kind":"v","columns":[{"name":"package_name","type":"nvarchar(256)","not_null":true},{"name":"memory_usage","type":"bigint","not_null":true},{"name":"cpu_usage","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_filestream_file_io_handles","kind":"v","columns":[{"name":"handle_context_address","type":"varbinary(8)"},{"name":"creation_request_id","type":"int","not_null":true},{"name":"creation_irp_id","type":"int","not_null":true},{"name":"handle_id","type":"int","not_null":true},{"name":"creation_client_thread_id","type":"varbinary(8)"},{"name":"creation_client_process_id","type":"varbinary(8)"},{"name":"filestream_transaction_id","type":"varbinary(128)"},{"name":"access_type","type":"nvarchar(60)","not_null":true},{"name":"logical_path","type":"nvarchar(256)"},{"name":"physical_path","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_filestream_file_io_requests","kind":"v","columns":[{"name":"request_context_address","type":"varbinary(8)","not_null":true},{"name":"current_spid","type":"smallint","not_null":true},{"name":"request_type","type":"nvarchar(60)","not_null":true},{"name":"request_state","type":"nvarchar(60)","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"irp_id","type":"int","not_null":true},{"name":"handle_id","type":"int","not_null":true},{"name":"client_thread_id","type":"varbinary(8)"},{"name":"client_process_id","type":"varbinary(8)"},{"name":"handle_context_address","type":"varbinary(8)"},{"name":"filestream_transaction_id","type":"varbinary(128)"}]} +{"schema":"sys","name":"dm_filestream_non_transacted_handles","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"object_id","type":"int"},{"name":"handle_id","type":"int"},{"name":"file_object_type","type":"int"},{"name":"file_object_type_desc","type":"nvarchar(60)"},{"name":"correlation_process_id","type":"varbinary(8)"},{"name":"correlation_thread_id","type":"varbinary(8)"},{"name":"file_context","type":"varbinary(8)"},{"name":"state","type":"int"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"current_workitem_type","type":"int"},{"name":"current_workitem_type_desc","type":"nvarchar(60)"},{"name":"fcb_id","type":"bigint"},{"name":"item_id","type":"varbinary(892)"},{"name":"is_directory","type":"bit"},{"name":"item_name","type":"nvarchar(256)"},{"name":"opened_file_name","type":"nvarchar(256)"},{"name":"database_directory_name","type":"nvarchar(256)"},{"name":"table_directory_name","type":"nvarchar(256)"},{"name":"remaining_file_name","type":"nvarchar(256)"},{"name":"open_time","type":"datetime","not_null":true},{"name":"flags","type":"int"},{"name":"login_id","type":"int"},{"name":"login_name","type":"nvarchar(256)"},{"name":"login_sid","type":"varbinary(85)"},{"name":"read_access","type":"bit"},{"name":"write_access","type":"bit"},{"name":"delete_access","type":"bit"},{"name":"share_read","type":"bit"},{"name":"share_write","type":"bit"},{"name":"share_delete","type":"bit"},{"name":"create_disposition","type":"int"}]} +{"schema":"sys","name":"dm_fts_active_catalogs","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"catalog_id","type":"int","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(4000)","not_null":true},{"name":"is_paused","type":"bit","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"status_description","type":"nvarchar(64)"},{"name":"previous_status","type":"int","not_null":true},{"name":"previous_status_description","type":"nvarchar(64)"},{"name":"worker_count","type":"int","not_null":true},{"name":"active_fts_index_count","type":"int","not_null":true},{"name":"auto_population_count","type":"int","not_null":true},{"name":"manual_population_count","type":"int","not_null":true},{"name":"full_incremental_population_count","type":"int","not_null":true},{"name":"row_count_in_thousands","type":"int","not_null":true},{"name":"is_importing","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_fts_fdhosts","kind":"v","columns":[{"name":"fdhost_id","type":"int","not_null":true},{"name":"fdhost_name","type":"nvarchar(128)"},{"name":"fdhost_process_id","type":"int","not_null":true},{"name":"fdhost_type","type":"nvarchar(64)"},{"name":"max_thread","type":"int","not_null":true},{"name":"batch_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_fts_index_population","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"catalog_id","type":"int","not_null":true},{"name":"table_id","type":"int","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"population_type","type":"int","not_null":true},{"name":"population_type_description","type":"nvarchar(64)"},{"name":"is_clustered_index_scan","type":"bit","not_null":true},{"name":"range_count","type":"int","not_null":true},{"name":"completed_range_count","type":"int","not_null":true},{"name":"outstanding_batch_count","type":"int","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"status_description","type":"nvarchar(64)"},{"name":"completion_type","type":"int","not_null":true},{"name":"completion_type_description","type":"nvarchar(64)"},{"name":"worker_count","type":"int","not_null":true},{"name":"queued_population_type","type":"int","not_null":true},{"name":"queued_population_type_description","type":"nvarchar(64)"},{"name":"start_time","type":"datetime","not_null":true},{"name":"incremental_timestamp","type":"binary(8)","not_null":true}]} +{"schema":"sys","name":"dm_fts_memory_buffers","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(4000)","not_null":true},{"name":"is_free","type":"bit","not_null":true},{"name":"row_count","type":"int","not_null":true},{"name":"bytes_used","type":"int","not_null":true},{"name":"percent_used","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_fts_memory_pools","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"buffer_size","type":"int","not_null":true},{"name":"min_buffer_limit","type":"int","not_null":true},{"name":"max_buffer_limit","type":"int","not_null":true},{"name":"buffer_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_fts_outstanding_batches","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"catalog_id","type":"int","not_null":true},{"name":"table_id","type":"int","not_null":true},{"name":"batch_id","type":"int","not_null":true},{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"crawl_memory_address","type":"varbinary(8)","not_null":true},{"name":"memregion_memory_address","type":"varbinary(8)","not_null":true},{"name":"hr_batch","type":"int","not_null":true},{"name":"is_retry_batch","type":"bit","not_null":true},{"name":"retry_hints","type":"int","not_null":true},{"name":"retry_hints_description","type":"nvarchar(64)"},{"name":"doc_failed","type":"bigint","not_null":true},{"name":"batch_timestamp","type":"binary(8)","not_null":true}]} +{"schema":"sys","name":"dm_fts_population_ranges","kind":"v","columns":[{"name":"memory_address","type":"varbinary(8)","not_null":true},{"name":"parent_memory_address","type":"varbinary(8)","not_null":true},{"name":"is_retry","type":"bit","not_null":true},{"name":"session_id","type":"smallint","not_null":true},{"name":"processed_row_count","type":"int","not_null":true},{"name":"error_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_fts_semantic_similarity_population","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"catalog_id","type":"int","not_null":true},{"name":"table_id","type":"int","not_null":true},{"name":"document_count","type":"bigint","not_null":true},{"name":"document_processed_count","type":"bigint","not_null":true},{"name":"completion_type","type":"int","not_null":true},{"name":"completion_type_description","type":"nvarchar(64)"},{"name":"worker_count","type":"int","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"status_description","type":"nvarchar(64)"},{"name":"start_time","type":"datetime","not_null":true},{"name":"incremental_timestamp","type":"binary(8)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_ag_threads","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"num_databases","type":"int"},{"name":"num_capture_threads","type":"int"},{"name":"num_redo_threads","type":"int"},{"name":"num_parallel_redo_threads","type":"int"},{"name":"num_hadr_threads","type":"int"}]} +{"schema":"sys","name":"dm_hadr_auto_page_repair","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"file_id","type":"int","not_null":true},{"name":"page_id","type":"bigint","not_null":true},{"name":"error_type","type":"smallint","not_null":true},{"name":"page_status","type":"tinyint","not_null":true},{"name":"modification_time","type":"datetime","not_null":true}]} +{"schema":"sys","name":"dm_hadr_automatic_seeding","kind":"v","columns":[{"name":"start_time","type":"datetime","not_null":true},{"name":"completion_time","type":"datetime"},{"name":"ag_id","type":"uniqueidentifier","not_null":true},{"name":"ag_db_id","type":"uniqueidentifier","not_null":true},{"name":"ag_remote_replica_id","type":"uniqueidentifier","not_null":true},{"name":"operation_id","type":"uniqueidentifier","not_null":true},{"name":"is_source","type":"bit","not_null":true},{"name":"current_state","type":"nvarchar(4000)","not_null":true},{"name":"performed_seeding","type":"bit","not_null":true},{"name":"failure_state","type":"int"},{"name":"failure_state_desc","type":"nvarchar(4000)"},{"name":"error_code","type":"int"},{"name":"number_of_attempts","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_hadr_availability_group_states","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"primary_replica","type":"nvarchar(128)"},{"name":"primary_recovery_health","type":"tinyint"},{"name":"primary_recovery_health_desc","type":"nvarchar(60)"},{"name":"secondary_recovery_health","type":"tinyint"},{"name":"secondary_recovery_health_desc","type":"nvarchar(60)"},{"name":"synchronization_health","type":"tinyint"},{"name":"synchronization_health_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_hadr_availability_replica_cluster_nodes","kind":"v","columns":[{"name":"group_name","type":"nvarchar(256)","not_null":true},{"name":"replica_server_name","type":"nvarchar(256)","not_null":true},{"name":"node_name","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_availability_replica_cluster_states","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"replica_server_name","type":"nvarchar(256)","not_null":true},{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"join_state","type":"tinyint","not_null":true},{"name":"join_state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_hadr_availability_replica_states","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"is_local","type":"bit","not_null":true},{"name":"role","type":"tinyint"},{"name":"role_desc","type":"nvarchar(60)"},{"name":"operational_state","type":"tinyint"},{"name":"operational_state_desc","type":"nvarchar(60)"},{"name":"connected_state","type":"tinyint"},{"name":"connected_state_desc","type":"nvarchar(60)"},{"name":"recovery_health","type":"tinyint"},{"name":"recovery_health_desc","type":"nvarchar(60)"},{"name":"synchronization_health","type":"tinyint"},{"name":"synchronization_health_desc","type":"nvarchar(60)"},{"name":"last_connect_error_number","type":"int"},{"name":"last_connect_error_description","type":"nvarchar(1024)"},{"name":"last_connect_error_timestamp","type":"datetime"},{"name":"write_lease_remaining_ticks","type":"bigint"},{"name":"current_configuration_commit_start_time_utc","type":"datetime"},{"name":"is_internal","type":"bit"}]} +{"schema":"sys","name":"dm_hadr_cached_database_replica_states","kind":"v","columns":[{"name":"ag_id","type":"uniqueidentifier","not_null":true},{"name":"ag_name","type":"nvarchar(256)","not_null":true},{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"replica_name","type":"nvarchar(256)","not_null":true},{"name":"ag_db_id","type":"uniqueidentifier","not_null":true},{"name":"ag_db_name","type":"nvarchar(256)","not_null":true},{"name":"is_local","type":"bit","not_null":true},{"name":"is_primary_replica","type":"bit","not_null":true},{"name":"synchronization_state","type":"tinyint"},{"name":"synchronization_state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_hadr_cached_replica_states","kind":"v","columns":[{"name":"ag_id","type":"uniqueidentifier","not_null":true},{"name":"ag_name","type":"nvarchar(256)","not_null":true},{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"replica_name","type":"nvarchar(256)","not_null":true},{"name":"is_local","type":"bit","not_null":true},{"name":"availability_mode","type":"tinyint","not_null":true},{"name":"sequence_number","type":"bigint"},{"name":"role","type":"tinyint"},{"name":"role_desc","type":"nvarchar(60)"},{"name":"synchronization_health","type":"tinyint"},{"name":"synchronization_health_desc","type":"nvarchar(60)"},{"name":"secondary_role_allow_connections","type":"tinyint"},{"name":"secondary_role_allow_connections_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_hadr_cluster","kind":"v","columns":[{"name":"cluster_name","type":"nvarchar(256)","not_null":true},{"name":"quorum_type","type":"tinyint","not_null":true},{"name":"quorum_type_desc","type":"nvarchar(60)","not_null":true},{"name":"quorum_state","type":"tinyint","not_null":true},{"name":"quorum_state_desc","type":"nvarchar(60)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_cluster_members","kind":"v","columns":[{"name":"member_name","type":"nvarchar(256)","not_null":true},{"name":"member_type","type":"tinyint","not_null":true},{"name":"member_type_desc","type":"nvarchar(60)","not_null":true},{"name":"member_state","type":"tinyint","not_null":true},{"name":"member_state_desc","type":"nvarchar(60)","not_null":true},{"name":"number_of_quorum_votes","type":"int"},{"name":"number_of_current_votes","type":"int"}]} +{"schema":"sys","name":"dm_hadr_cluster_networks","kind":"v","columns":[{"name":"member_name","type":"nvarchar(128)","not_null":true},{"name":"network_subnet_ip","type":"nvarchar(64)","not_null":true},{"name":"network_subnet_ipv4_mask","type":"nvarchar(45)"},{"name":"network_subnet_prefix_length","type":"int"},{"name":"is_public","type":"bit","not_null":true},{"name":"is_ipv4","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_hadr_database_replica_cluster_states","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"group_database_id","type":"uniqueidentifier","not_null":true},{"name":"database_name","type":"nvarchar(128)"},{"name":"is_failover_ready","type":"bit","not_null":true},{"name":"is_pending_secondary_suspend","type":"bit","not_null":true},{"name":"is_database_joined","type":"bit","not_null":true},{"name":"recovery_lsn","type":"numeric(25,0)"},{"name":"truncation_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"dm_hadr_database_replica_states","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"replica_id","type":"uniqueidentifier","not_null":true},{"name":"group_database_id","type":"uniqueidentifier","not_null":true},{"name":"is_local","type":"bit"},{"name":"is_primary_replica","type":"bit"},{"name":"synchronization_state","type":"tinyint"},{"name":"synchronization_state_desc","type":"nvarchar(60)"},{"name":"is_commit_participant","type":"bit"},{"name":"synchronization_health","type":"tinyint"},{"name":"synchronization_health_desc","type":"nvarchar(60)"},{"name":"database_state","type":"tinyint"},{"name":"database_state_desc","type":"nvarchar(60)"},{"name":"is_suspended","type":"bit"},{"name":"suspend_reason","type":"tinyint"},{"name":"suspend_reason_desc","type":"nvarchar(60)"},{"name":"recovery_lsn","type":"numeric(25,0)"},{"name":"truncation_lsn","type":"numeric(25,0)"},{"name":"last_sent_lsn","type":"numeric(25,0)"},{"name":"last_sent_time","type":"datetime"},{"name":"last_received_lsn","type":"numeric(25,0)"},{"name":"last_received_time","type":"datetime"},{"name":"last_hardened_lsn","type":"numeric(25,0)"},{"name":"last_hardened_time","type":"datetime"},{"name":"last_redone_lsn","type":"numeric(25,0)"},{"name":"last_redone_time","type":"datetime"},{"name":"log_send_queue_size","type":"bigint"},{"name":"log_send_rate","type":"bigint"},{"name":"redo_queue_size","type":"bigint"},{"name":"redo_rate","type":"bigint"},{"name":"filestream_send_rate","type":"bigint"},{"name":"end_of_log_lsn","type":"numeric(25,0)"},{"name":"last_commit_lsn","type":"numeric(25,0)"},{"name":"last_commit_time","type":"datetime"},{"name":"low_water_mark_for_ghosts","type":"bigint"},{"name":"secondary_lag_seconds","type":"bigint"},{"name":"quorum_commit_lsn","type":"numeric(25,0)"},{"name":"quorum_commit_time","type":"datetime"},{"name":"is_internal","type":"bit"}]} +{"schema":"sys","name":"dm_hadr_db_threads","kind":"v","columns":[{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"ag_db_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"num_capture_threads","type":"int"},{"name":"num_redo_threads","type":"int"},{"name":"num_parallel_redo_threads","type":"int"}]} +{"schema":"sys","name":"dm_hadr_instance_node_map","kind":"v","columns":[{"name":"ag_resource_id","type":"nvarchar(256)","not_null":true},{"name":"instance_name","type":"nvarchar(256)","not_null":true},{"name":"node_name","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_internal_availability_groups","kind":"v","columns":[{"name":"distributed_availability_group_id","type":"uniqueidentifier"},{"name":"group_id","type":"uniqueidentifier","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"resource_id","type":"nvarchar(40)"},{"name":"resource_group_id","type":"nvarchar(40)"},{"name":"failure_condition_level","type":"int"},{"name":"health_check_timeout","type":"int"},{"name":"automated_backup_preference","type":"tinyint"},{"name":"automated_backup_preference_desc","type":"nvarchar(60)"},{"name":"version","type":"smallint"},{"name":"basic_features","type":"bit"},{"name":"dtc_support","type":"bit"},{"name":"db_failover","type":"bit"},{"name":"is_distributed","type":"bit"},{"name":"cluster_type","type":"tinyint"},{"name":"cluster_type_desc","type":"nvarchar(60)"},{"name":"required_synchronized_secondaries_to_commit","type":"int"},{"name":"sequence_number","type":"bigint"},{"name":"is_contained","type":"bit"},{"name":"group_database_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_hadr_internal_availability_replicas","kind":"v","columns":[{"name":"replica_id","type":"uniqueidentifier"},{"name":"group_id","type":"uniqueidentifier"},{"name":"replica_metadata_id","type":"int"},{"name":"replica_server_name","type":"nvarchar(256)"},{"name":"owner_sid","type":"varbinary(85)"},{"name":"endpoint_url","type":"nvarchar(256)"},{"name":"availability_mode","type":"tinyint"},{"name":"availability_mode_desc","type":"nvarchar(60)"},{"name":"failover_mode","type":"tinyint"},{"name":"failover_mode_desc","type":"nvarchar(60)"},{"name":"session_timeout","type":"int"},{"name":"primary_role_allow_connections","type":"tinyint"},{"name":"primary_role_allow_connections_desc","type":"nvarchar(60)"},{"name":"secondary_role_allow_connections","type":"tinyint"},{"name":"secondary_role_allow_connections_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime"},{"name":"modify_date","type":"datetime"},{"name":"backup_priority","type":"int"},{"name":"read_only_routing_url","type":"nvarchar(256)"},{"name":"seeding_mode","type":"tinyint"},{"name":"seeding_mode_desc","type":"nvarchar(60)"},{"name":"read_write_routing_url","type":"nvarchar(256)"},{"name":"distributed_availability_group_replica_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"dm_hadr_name_id_map","kind":"v","columns":[{"name":"ag_name","type":"nvarchar(256)","not_null":true},{"name":"ag_id","type":"uniqueidentifier","not_null":true},{"name":"ag_resource_id","type":"nvarchar(256)","not_null":true},{"name":"ag_group_id","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_hadr_physical_seeding_stats","kind":"v","columns":[{"name":"local_physical_seeding_id","type":"uniqueidentifier","not_null":true},{"name":"remote_physical_seeding_id","type":"uniqueidentifier"},{"name":"local_database_id","type":"int","not_null":true},{"name":"local_database_name","type":"nvarchar(128)"},{"name":"remote_machine_name","type":"nvarchar(128)"},{"name":"role_desc","type":"nvarchar(128)"},{"name":"internal_state_desc","type":"nvarchar(128)"},{"name":"transfer_rate_bytes_per_second","type":"bigint"},{"name":"transferred_size_bytes","type":"bigint"},{"name":"database_size_bytes","type":"bigint"},{"name":"start_time_utc","type":"datetime"},{"name":"end_time_utc","type":"datetime"},{"name":"estimate_time_complete_utc","type":"datetime"},{"name":"total_disk_io_wait_time_ms","type":"bigint"},{"name":"total_network_wait_time_ms","type":"bigint"},{"name":"failure_code","type":"int"},{"name":"failure_message","type":"nvarchar(128)"},{"name":"failure_time_utc","type":"datetime"},{"name":"is_compression_enabled","type":"bit"}]} +{"schema":"sys","name":"dm_hpc_device_stats","kind":"v","columns":[{"name":"device_logical_id","type":"int","not_null":true},{"name":"device_type","type":"int","not_null":true},{"name":"device_provider","type":"int","not_null":true},{"name":"device_physical_id","type":"bigint","not_null":true},{"name":"version","type":"bigint","not_null":true},{"name":"compute_units","type":"int","not_null":true},{"name":"max_thread_proxies","type":"int","not_null":true},{"name":"clock_frequency","type":"bigint","not_null":true},{"name":"device_memory_bytes","type":"bigint","not_null":true},{"name":"rows_handled","type":"bigint","not_null":true},{"name":"cycles_used","type":"bigint","not_null":true},{"name":"device_to_host_bytes","type":"bigint","not_null":true},{"name":"host_to_device_bytes","type":"bigint","not_null":true},{"name":"device_ready","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_hpc_thread_proxy_stats","kind":"v","columns":[{"name":"device_logical_id","type":"int","not_null":true},{"name":"device_type","type":"int","not_null":true},{"name":"device_provider","type":"int","not_null":true},{"name":"proxy_id","type":"int","not_null":true},{"name":"rows_handled","type":"bigint","not_null":true},{"name":"cycles_used","type":"bigint","not_null":true},{"name":"host_to_device_bytes","type":"bigint","not_null":true},{"name":"device_to_host_bytes","type":"bigint","not_null":true},{"name":"device_memory_bytes","type":"bigint","not_null":true},{"name":"session_id","type":"smallint","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"active","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_io_backup_tapes","kind":"v","columns":[{"name":"physical_device_name","type":"nvarchar(260)","not_null":true},{"name":"logical_device_name","type":"nvarchar(128)"},{"name":"status","type":"int","not_null":true},{"name":"status_desc","type":"nvarchar(260)","not_null":true},{"name":"mount_request_time","type":"datetime"},{"name":"mount_expiration_time","type":"datetime"},{"name":"database_name","type":"nvarchar(128)"},{"name":"spid","type":"int"},{"name":"command","type":"int"},{"name":"command_desc","type":"nvarchar(60)"},{"name":"media_family_id","type":"int"},{"name":"media_set_name","type":"nvarchar(128)"},{"name":"media_set_guid","type":"uniqueidentifier"},{"name":"media_sequence_number","type":"int"},{"name":"tape_operation","type":"int"},{"name":"tape_operation_desc","type":"nvarchar(60)"},{"name":"mount_request_type","type":"int"},{"name":"mount_request_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_io_cluster_shared_drives","kind":"v","columns":[{"name":"drivename","type":"nchar(1)"}]} +{"schema":"sys","name":"dm_io_cluster_valid_path_names","kind":"v","columns":[{"name":"path_name","type":"nvarchar(256)"},{"name":"cluster_owner_node","type":"nvarchar(60)"},{"name":"is_cluster_shared_volume","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_io_network_traffic_stats","kind":"v","columns":[{"name":"snapshot_time","type":"datetime2(7)","not_null":true},{"name":"network_protocol","type":"tinyint","not_null":true},{"name":"network_protocol_desc","type":"nvarchar(60)","not_null":true},{"name":"count_sends","type":"bigint","not_null":true},{"name":"count_receives","type":"bigint","not_null":true},{"name":"send_bytes","type":"bigint","not_null":true},{"name":"receive_bytes","type":"bigint","not_null":true},{"name":"max_send_bytes","type":"bigint","not_null":true},{"name":"max_receive_bytes","type":"bigint","not_null":true},{"name":"min_send_bytes","type":"bigint","not_null":true},{"name":"min_receive_bytes","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_io_pending_io_requests","kind":"v","columns":[{"name":"io_completion_request_address","type":"varbinary(8)","not_null":true},{"name":"io_type","type":"nvarchar(60)","not_null":true},{"name":"io_pending_ms_ticks","type":"bigint","not_null":true},{"name":"io_pending","type":"int","not_null":true},{"name":"io_completion_routine_address","type":"varbinary(8)"},{"name":"io_user_data_address","type":"varbinary(8)"},{"name":"scheduler_address","type":"varbinary(8)","not_null":true},{"name":"io_handle","type":"varbinary(8)"},{"name":"io_offset","type":"bigint","not_null":true},{"name":"io_handle_path","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_logpool_hashentries","kind":"v","columns":[{"name":"bucket_no","type":"int","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"recovery_unit_id","type":"int","not_null":true},{"name":"log_block_id","type":"bigint","not_null":true},{"name":"cache_buffer","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_logpool_stats","kind":"v","columns":[{"name":"hash_hit_total_search_length","type":"bigint","not_null":true},{"name":"hash_miss_total_search_length","type":"bigint","not_null":true},{"name":"hash_hits","type":"bigint","not_null":true},{"name":"hash_misses","type":"bigint","not_null":true},{"name":"hash_bucket_count","type":"int","not_null":true},{"name":"mem_status_stamp","type":"bigint","not_null":true},{"name":"mem_status","type":"int","not_null":true},{"name":"logpoolmgr_count","type":"int","not_null":true},{"name":"total_pages","type":"bigint","not_null":true},{"name":"private_pages","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_buffer_descriptors","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"file_id","type":"int"},{"name":"page_id","type":"int"},{"name":"page_level","type":"int"},{"name":"allocation_unit_id","type":"bigint"},{"name":"page_type","type":"nvarchar(60)"},{"name":"row_count","type":"int"},{"name":"free_space_in_bytes","type":"int"},{"name":"is_modified","type":"bit"},{"name":"numa_node","type":"int"},{"name":"read_microsec","type":"bigint"},{"name":"is_in_bpool_extension","type":"bit"},{"name":"error_code","type":"int"},{"name":"op_history","type":"varbinary(8)"},{"name":"buffer_address","type":"varbinary(8)"},{"name":"latch_address","type":"varbinary(8)"},{"name":"latch_desc","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_buffer_pool_extension_configuration","kind":"v","columns":[{"name":"path","type":"nvarchar(256)"},{"name":"file_id","type":"int"},{"name":"state","type":"int"},{"name":"state_description","type":"nvarchar(60)","not_null":true},{"name":"current_size_in_kb","type":"bigint"}]} +{"schema":"sys","name":"dm_os_child_instances","kind":"v","columns":[{"name":"owning_principal_name","type":"nvarchar(256)"},{"name":"owning_principal_sid","type":"nvarchar(256)"},{"name":"owning_principal_sid_binary","type":"varbinary(85)"},{"name":"instance_name","type":"nvarchar(128)"},{"name":"instance_pipe_name","type":"nvarchar(260)"},{"name":"os_process_id","type":"int"},{"name":"os_process_creation_date","type":"datetime"},{"name":"heart_beat","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_os_cluster_nodes","kind":"v","columns":[{"name":"nodename","type":"nvarchar(128)"},{"name":"status","type":"int"},{"name":"status_description","type":"varchar(7)","not_null":true},{"name":"is_current_owner","type":"bit"}]} +{"schema":"sys","name":"dm_os_cluster_properties","kind":"v","columns":[{"name":"verboselogging","type":"bigint"},{"name":"sqldumperdumpflags","type":"bigint"},{"name":"sqldumperdumppath","type":"nvarchar(260)","not_null":true},{"name":"sqldumperdumptimeout","type":"bigint"},{"name":"failureconditionlevel","type":"bigint"},{"name":"healthchecktimeout","type":"bigint"},{"name":"clusterconnectionoptions","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"dm_os_dispatcher_pools","kind":"v","columns":[{"name":"dispatcher_pool_address","type":"varbinary(8)","not_null":true},{"name":"type","type":"nvarchar(256)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"dispatcher_count","type":"int","not_null":true},{"name":"dispatcher_ideal_count","type":"int","not_null":true},{"name":"dispatcher_timeout_ms","type":"int","not_null":true},{"name":"dispatcher_waiting_count","type":"int","not_null":true},{"name":"queue_length","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_dispatchers","kind":"v","columns":[{"name":"dispatcher_pool_address","type":"varbinary(8)","not_null":true},{"name":"task_address","type":"varbinary(8)","not_null":true},{"name":"state","type":"nvarchar(60)","not_null":true},{"name":"wait_duration","type":"bigint"},{"name":"current_item_duration","type":"bigint"},{"name":"items_processed","type":"bigint","not_null":true},{"name":"fade_end_time","type":"int"}]} +{"schema":"sys","name":"dm_os_enumerate_fixed_drives","kind":"v","columns":[{"name":"fixed_drive_path","type":"nvarchar(256)"},{"name":"drive_type","type":"int","not_null":true},{"name":"drive_type_desc","type":"nvarchar(256)"},{"name":"free_space_in_bytes","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_host_info","kind":"v","columns":[{"name":"host_platform","type":"nvarchar(256)","not_null":true},{"name":"host_distribution","type":"nvarchar(256)","not_null":true},{"name":"host_release","type":"nvarchar(256)","not_null":true},{"name":"host_service_pack_level","type":"nvarchar(256)","not_null":true},{"name":"host_sku","type":"int"},{"name":"os_language_version","type":"int","not_null":true},{"name":"host_architecture","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_os_hosts","kind":"v","columns":[{"name":"host_address","type":"varbinary(8)","not_null":true},{"name":"type","type":"nvarchar(60)"},{"name":"name","type":"nvarchar(60)","not_null":true},{"name":"enqueued_tasks_count","type":"int"},{"name":"active_tasks_count","type":"int"},{"name":"completed_ios_count","type":"int"},{"name":"completed_ios_in_bytes","type":"bigint"},{"name":"active_ios_count","type":"int"},{"name":"default_memory_clerk_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_os_job_object","kind":"v","columns":[{"name":"cpu_rate","type":"int"},{"name":"cpu_affinity_mask","type":"bigint"},{"name":"cpu_affinity_group","type":"int"},{"name":"memory_limit_mb","type":"bigint"},{"name":"process_memory_limit_mb","type":"bigint"},{"name":"workingset_limit_mb","type":"bigint"},{"name":"non_sos_mem_gap_mb","type":"bigint"},{"name":"low_mem_signal_threshold_mb","type":"bigint"},{"name":"total_user_time","type":"bigint"},{"name":"total_kernel_time","type":"bigint"},{"name":"write_operation_count","type":"bigint"},{"name":"read_operation_count","type":"bigint"},{"name":"peak_process_memory_used_mb","type":"bigint"},{"name":"peak_job_memory_used_mb","type":"bigint"},{"name":"process_physical_affinity","type":"nvarchar(3072)","not_null":true}]} +{"schema":"sys","name":"dm_os_latch_stats","kind":"v","columns":[{"name":"latch_class","type":"nvarchar(60)","not_null":true},{"name":"waiting_requests_count","type":"bigint"},{"name":"wait_time_ms","type":"bigint"},{"name":"max_wait_time_ms","type":"bigint"}]} +{"schema":"sys","name":"dm_os_linux_cpu_stats","kind":"v","columns":[{"name":"uptime_secs","type":"float","not_null":true},{"name":"loadavg_1min","type":"float","not_null":true},{"name":"user_time_cs","type":"bigint","not_null":true},{"name":"nice_time_cs","type":"bigint","not_null":true},{"name":"system_time_cs","type":"bigint","not_null":true},{"name":"idle_time_cs","type":"bigint","not_null":true},{"name":"iowait_time_cs","type":"bigint","not_null":true},{"name":"irq_time_cs","type":"bigint","not_null":true},{"name":"softirq_time_cs","type":"bigint","not_null":true},{"name":"interrupt_cnt","type":"bigint","not_null":true},{"name":"csw_cnt","type":"bigint","not_null":true},{"name":"boot_time_secs","type":"bigint","not_null":true},{"name":"total_forks_cnt","type":"bigint","not_null":true},{"name":"proc_runable_cnt","type":"bigint","not_null":true},{"name":"proc_ioblocked_cnt","type":"bigint","not_null":true},{"name":"c3_time","type":"bigint","not_null":true},{"name":"c2_time","type":"bigint","not_null":true},{"name":"c1_time","type":"bigint","not_null":true},{"name":"c3_count","type":"bigint","not_null":true},{"name":"c2_count","type":"bigint","not_null":true},{"name":"c1_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_linux_disk_stats","kind":"v","columns":[{"name":"dev_name","type":"nvarchar(256)","not_null":true},{"name":"major_num","type":"bigint","not_null":true},{"name":"minor_num","type":"bigint","not_null":true},{"name":"reads_completed","type":"bigint","not_null":true},{"name":"reads_merged","type":"bigint","not_null":true},{"name":"sectors_read","type":"bigint","not_null":true},{"name":"read_time_ms","type":"bigint","not_null":true},{"name":"writes_completed","type":"bigint","not_null":true},{"name":"writes_merged","type":"bigint","not_null":true},{"name":"sectors_written","type":"bigint","not_null":true},{"name":"write_time_ms","type":"bigint","not_null":true},{"name":"ios_in_progress","type":"bigint","not_null":true},{"name":"io_time_ms","type":"bigint","not_null":true},{"name":"weighted_io_time_ms","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_linux_net_stats","kind":"v","columns":[{"name":"interface","type":"nvarchar(256)","not_null":true},{"name":"recv_bytes","type":"bigint","not_null":true},{"name":"recv_packets","type":"bigint","not_null":true},{"name":"recv_errors","type":"bigint","not_null":true},{"name":"recv_drops","type":"bigint","not_null":true},{"name":"recv_fifo","type":"bigint","not_null":true},{"name":"recv_frame","type":"bigint","not_null":true},{"name":"recv_compressed","type":"bigint","not_null":true},{"name":"recv_multicast","type":"bigint","not_null":true},{"name":"tx_bytes","type":"bigint","not_null":true},{"name":"tx_packets","type":"bigint","not_null":true},{"name":"tx_errors","type":"bigint","not_null":true},{"name":"tx_drop","type":"bigint","not_null":true},{"name":"tx_fifo","type":"bigint","not_null":true},{"name":"tx_collisions","type":"bigint","not_null":true},{"name":"tx_carrier","type":"bigint","not_null":true},{"name":"tx_compressed","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_linux_vm_stats","kind":"v","columns":[{"name":"vm_metric_name","type":"nvarchar(256)","not_null":true},{"name":"count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_loaded_modules","kind":"v","columns":[{"name":"base_address","type":"varbinary(8)","not_null":true},{"name":"file_version","type":"varchar(256)"},{"name":"product_version","type":"varchar(256)"},{"name":"debug","type":"bit"},{"name":"patched","type":"bit"},{"name":"prerelease","type":"bit"},{"name":"private_build","type":"bit"},{"name":"special_build","type":"bit"},{"name":"language","type":"int"},{"name":"company","type":"nvarchar(256)"},{"name":"description","type":"nvarchar(256)"},{"name":"name","type":"nvarchar(512)"},{"name":"target","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_memory_allocations","kind":"v","columns":[{"name":"memory_allocation_address","type":"varbinary(8)","not_null":true},{"name":"size_in_bytes","type":"bigint","not_null":true},{"name":"creation_time","type":"datetime","not_null":true},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"allocator_stack_address","type":"varbinary(8)","not_null":true},{"name":"source_file","type":"varchar(256)"},{"name":"line_num","type":"int","not_null":true},{"name":"sequence_num","type":"int","not_null":true},{"name":"tag","type":"int","not_null":true},{"name":"allocation_rva_stack","type":"nvarchar(max)"}]} +{"schema":"sys","name":"dm_os_memory_allocations_filtered","kind":"v","columns":[{"name":"memory_object_address","type":"varbinary(8)"},{"name":"sum_bytes","type":"bigint"},{"name":"line_num","type":"int","not_null":true},{"name":"source_file","type":"varchar(256)"}]} +{"schema":"sys","name":"dm_os_memory_broker_clerks","kind":"v","columns":[{"name":"clerk_name","type":"nvarchar(256)","not_null":true},{"name":"total_kb","type":"bigint","not_null":true},{"name":"simulated_kb","type":"bigint","not_null":true},{"name":"simulation_benefit","type":"float","not_null":true},{"name":"internal_benefit","type":"float","not_null":true},{"name":"external_benefit","type":"float","not_null":true},{"name":"value_of_memory","type":"float","not_null":true},{"name":"periodic_freed_kb","type":"bigint","not_null":true},{"name":"internal_freed_kb","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_brokers","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"memory_broker_type","type":"nvarchar(60)","not_null":true},{"name":"allocations_kb","type":"bigint","not_null":true},{"name":"allocations_kb_per_sec","type":"bigint","not_null":true},{"name":"predicted_allocations_kb","type":"bigint","not_null":true},{"name":"target_allocations_kb","type":"bigint","not_null":true},{"name":"future_allocations_kb","type":"bigint","not_null":true},{"name":"overall_limit_kb","type":"bigint","not_null":true},{"name":"last_notification","type":"nvarchar(60)","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_cache_clock_hands","kind":"v","columns":[{"name":"cache_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"clock_hand","type":"nvarchar(60)","not_null":true},{"name":"clock_status","type":"nvarchar(60)","not_null":true},{"name":"rounds_count","type":"bigint","not_null":true},{"name":"removed_all_rounds_count","type":"bigint","not_null":true},{"name":"updated_last_round_count","type":"bigint","not_null":true},{"name":"removed_last_round_count","type":"bigint","not_null":true},{"name":"last_tick_time","type":"bigint","not_null":true},{"name":"round_start_time","type":"bigint","not_null":true},{"name":"last_round_start_time","type":"bigint","not_null":true},{"name":"entries_visited_all_rounds_count","type":"bigint","not_null":true},{"name":"inuse_all_rounds_count","type":"bigint","not_null":true},{"name":"pinned_all_rounds_count","type":"bigint","not_null":true},{"name":"do_not_remove_all_rounds_count","type":"bigint","not_null":true},{"name":"invisible_all_rounds_count","type":"bigint","not_null":true},{"name":"different_pool_all_rounds_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_cache_counters","kind":"v","columns":[{"name":"cache_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"pages_kb","type":"bigint","not_null":true},{"name":"pages_in_use_kb","type":"bigint"},{"name":"entries_count","type":"bigint","not_null":true},{"name":"entries_in_use_count","type":"bigint","not_null":true},{"name":"extended_properties","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_memory_cache_entries","kind":"v","columns":[{"name":"cache_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"entry_address","type":"varbinary(8)","not_null":true},{"name":"entry_data_address","type":"varbinary(8)","not_null":true},{"name":"in_use_count","type":"int","not_null":true},{"name":"is_dirty","type":"bit","not_null":true},{"name":"disk_ios_count","type":"int","not_null":true},{"name":"context_switches_count","type":"int","not_null":true},{"name":"original_cost","type":"int","not_null":true},{"name":"current_cost","type":"int","not_null":true},{"name":"memory_object_address","type":"varbinary(8)"},{"name":"pages_kb","type":"bigint","not_null":true},{"name":"entry_data","type":"nvarchar(3072)"},{"name":"pool_id","type":"int"},{"name":"time_to_generate","type":"float"},{"name":"use_count","type":"bigint"},{"name":"average_time_between_uses","type":"float"},{"name":"time_since_last_use","type":"float"},{"name":"probability_of_reuse","type":"float"},{"name":"value","type":"float"}]} +{"schema":"sys","name":"dm_os_memory_cache_hash_tables","kind":"v","columns":[{"name":"cache_address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"table_level","type":"int","not_null":true},{"name":"buckets_count","type":"int","not_null":true},{"name":"buckets_in_use_count","type":"int","not_null":true},{"name":"buckets_min_length","type":"int","not_null":true},{"name":"buckets_max_length","type":"int","not_null":true},{"name":"buckets_avg_length","type":"int","not_null":true},{"name":"buckets_max_length_ever","type":"int","not_null":true},{"name":"hits_count","type":"bigint","not_null":true},{"name":"misses_count","type":"bigint","not_null":true},{"name":"buckets_avg_scan_hit_length","type":"int","not_null":true},{"name":"buckets_avg_scan_miss_length","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_clerks","kind":"v","columns":[{"name":"memory_clerk_address","type":"varbinary(8)","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"pages_kb","type":"bigint","not_null":true},{"name":"virtual_memory_reserved_kb","type":"bigint","not_null":true},{"name":"virtual_memory_committed_kb","type":"bigint","not_null":true},{"name":"awe_allocated_kb","type":"bigint","not_null":true},{"name":"shared_memory_reserved_kb","type":"bigint","not_null":true},{"name":"shared_memory_committed_kb","type":"bigint","not_null":true},{"name":"page_size_in_bytes","type":"bigint","not_null":true},{"name":"page_allocator_address","type":"varbinary(8)","not_null":true},{"name":"host_address","type":"varbinary(8)","not_null":true},{"name":"parent_memory_broker_type","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_os_memory_health_history","kind":"v","columns":[{"name":"snapshot_time","type":"datetime2(7)","not_null":true},{"name":"severity_level","type":"tinyint","not_null":true},{"name":"severity_level_desc","type":"nvarchar(60)","not_null":true},{"name":"allocation_potential_memory_mb","type":"int","not_null":true},{"name":"reclaimable_cache_memory_mb","type":"int","not_null":true},{"name":"top_memory_clerks","type":"nvarchar(4000)"},{"name":"out_of_memory_event_count","type":"int","not_null":true},{"name":"memgrant_timeout_count","type":"int","not_null":true},{"name":"memgrant_waiter_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_node_access_stats","kind":"v","columns":[{"name":"local_node","type":"int"},{"name":"remote_node","type":"int"},{"name":"page_class","type":"nvarchar(60)"},{"name":"read_count","type":"bigint"},{"name":"write_count","type":"bigint"}]} +{"schema":"sys","name":"dm_os_memory_nodes","kind":"v","columns":[{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"virtual_address_space_reserved_kb","type":"bigint","not_null":true},{"name":"virtual_address_space_committed_kb","type":"bigint","not_null":true},{"name":"locked_page_allocations_kb","type":"bigint","not_null":true},{"name":"pages_kb","type":"bigint","not_null":true},{"name":"shared_memory_reserved_kb","type":"bigint","not_null":true},{"name":"shared_memory_committed_kb","type":"bigint","not_null":true},{"name":"cpu_affinity_mask","type":"bigint","not_null":true},{"name":"online_scheduler_mask","type":"bigint","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"foreign_committed_kb","type":"bigint","not_null":true},{"name":"target_kb","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_nodes_processor_groups","kind":"v","columns":[{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"processor_group","type":"smallint","not_null":true}]} +{"schema":"sys","name":"dm_os_memory_objects","kind":"v","columns":[{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"parent_address","type":"varbinary(8)"},{"name":"pages_in_bytes","type":"bigint","not_null":true},{"name":"creation_options","type":"int"},{"name":"bytes_used","type":"bigint"},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"name","type":"varchar(256)"},{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"creation_time","type":"datetime"},{"name":"page_size_in_bytes","type":"int","not_null":true},{"name":"max_pages_in_bytes","type":"bigint","not_null":true},{"name":"page_allocator_address","type":"varbinary(8)","not_null":true},{"name":"creation_stack_address","type":"varbinary(8)"},{"name":"sequence_num","type":"int"},{"name":"partition_type","type":"int","not_null":true},{"name":"partition_type_desc","type":"nvarchar(60)","not_null":true},{"name":"contention_factor","type":"real"},{"name":"waiting_tasks_count","type":"bigint"},{"name":"exclusive_access_count","type":"bigint"}]} +{"schema":"sys","name":"dm_os_memory_pools","kind":"v","columns":[{"name":"memory_pool_address","type":"varbinary(8)","not_null":true},{"name":"pool_id","type":"int","not_null":true},{"name":"type","type":"nvarchar(60)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"max_free_entries_count","type":"bigint","not_null":true},{"name":"free_entries_count","type":"bigint","not_null":true},{"name":"removed_in_all_rounds_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_nodes","kind":"v","columns":[{"name":"node_id","type":"smallint","not_null":true},{"name":"node_state_desc","type":"nvarchar(256)","not_null":true},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"memory_clerk_address","type":"varbinary(8)","not_null":true},{"name":"io_completion_worker_address","type":"varbinary(8)"},{"name":"memory_node_id","type":"smallint","not_null":true},{"name":"cpu_affinity_mask","type":"bigint","not_null":true},{"name":"online_scheduler_count","type":"smallint","not_null":true},{"name":"idle_scheduler_count","type":"smallint","not_null":true},{"name":"active_worker_count","type":"int","not_null":true},{"name":"avg_load_balance","type":"int","not_null":true},{"name":"timer_task_affinity_mask","type":"bigint","not_null":true},{"name":"permanent_task_affinity_mask","type":"bigint","not_null":true},{"name":"resource_monitor_state","type":"bit","not_null":true},{"name":"online_scheduler_mask","type":"bigint","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"cpu_count","type":"int","not_null":true},{"name":"cached_tasks","type":"bigint","not_null":true},{"name":"cached_tasks_reused","type":"bigint","not_null":true},{"name":"cached_tasks_removed","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_out_of_memory_events","kind":"v","columns":[{"name":"event_time","type":"datetime","not_null":true},{"name":"oom_cause","type":"smallint","not_null":true},{"name":"oom_cause_desc","type":"nvarchar(30)","not_null":true},{"name":"available_physical_memory_mb","type":"int","not_null":true},{"name":"initial_job_object_memory_limit_mb","type":"int"},{"name":"current_job_object_memory_limit_mb","type":"int"},{"name":"process_memory_usage_mb","type":"int","not_null":true},{"name":"non_sos_memory_usage_mb","type":"int","not_null":true},{"name":"committed_memory_target_mb","type":"int","not_null":true},{"name":"committed_memory_mb","type":"int","not_null":true},{"name":"allocation_potential_memory_mb","type":"int","not_null":true},{"name":"oom_factor","type":"smallint","not_null":true},{"name":"oom_factor_desc","type":"nvarchar(30)","not_null":true},{"name":"oom_resource_pools","type":"nvarchar(4000)"},{"name":"top_memory_clerks","type":"nvarchar(4000)"},{"name":"top_resource_pools","type":"nvarchar(4000)"},{"name":"possible_leaked_memory_clerks","type":"nvarchar(4000)"},{"name":"possible_non_sos_leaked_memory_mb","type":"int"}]} +{"schema":"sys","name":"dm_os_parent_block_descriptors","kind":"v","columns":[{"name":"parent_block_descriptor","type":"varbinary(8)","not_null":true},{"name":"total_blocks","type":"bigint","not_null":true},{"name":"free_blocks","type":"bigint","not_null":true},{"name":"uncommitted_blocks","type":"bigint","not_null":true},{"name":"block_allocator_address","type":"varbinary(8)"},{"name":"free_committed_blocks","type":"bigint"},{"name":"allocation_granularity","type":"bigint"},{"name":"is_leaf_allocator","type":"bit"},{"name":"is_oom","type":"bit"},{"name":"is_oom_warning","type":"bit"},{"name":"top_block_allocator_address","type":"varbinary(8)"},{"name":"top_block_allocation_granularity","type":"bigint"}]} +{"schema":"sys","name":"dm_os_performance_counters","kind":"v","columns":[{"name":"object_name","type":"nchar(128)","not_null":true},{"name":"counter_name","type":"nchar(128)","not_null":true},{"name":"instance_name","type":"nchar(128)"},{"name":"cntr_value","type":"bigint","not_null":true},{"name":"cntr_type","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_process_memory","kind":"v","columns":[{"name":"physical_memory_in_use_kb","type":"bigint","not_null":true},{"name":"large_page_allocations_kb","type":"bigint","not_null":true},{"name":"locked_page_allocations_kb","type":"bigint","not_null":true},{"name":"total_virtual_address_space_kb","type":"bigint","not_null":true},{"name":"virtual_address_space_reserved_kb","type":"bigint","not_null":true},{"name":"virtual_address_space_committed_kb","type":"bigint","not_null":true},{"name":"virtual_address_space_available_kb","type":"bigint","not_null":true},{"name":"page_fault_count","type":"bigint","not_null":true},{"name":"memory_utilization_percentage","type":"int","not_null":true},{"name":"available_commit_limit_kb","type":"bigint","not_null":true},{"name":"process_physical_memory_low","type":"bit","not_null":true},{"name":"process_virtual_memory_low","type":"bit","not_null":true}]} +{"schema":"sys","name":"dm_os_ring_buffers","kind":"v","columns":[{"name":"ring_buffer_address","type":"varbinary(8)","not_null":true},{"name":"ring_buffer_type","type":"nvarchar(60)","not_null":true},{"name":"timestamp","type":"bigint","not_null":true},{"name":"record","type":"nvarchar(max)"},{"name":"ring_buffer_group","type":"nvarchar(60)","not_null":true},{"name":"create_time","type":"datetime2(7)","not_null":true}]} +{"schema":"sys","name":"dm_os_schedulers","kind":"v","columns":[{"name":"scheduler_address","type":"varbinary(8)","not_null":true},{"name":"parent_node_id","type":"int","not_null":true},{"name":"scheduler_id","type":"int","not_null":true},{"name":"cpu_id","type":"int","not_null":true},{"name":"status","type":"nvarchar(60)","not_null":true},{"name":"is_online","type":"bit","not_null":true},{"name":"is_idle","type":"bit","not_null":true},{"name":"preemptive_switches_count","type":"int","not_null":true},{"name":"context_switches_count","type":"int","not_null":true},{"name":"idle_switches_count","type":"int","not_null":true},{"name":"current_tasks_count","type":"int","not_null":true},{"name":"runnable_tasks_count","type":"int","not_null":true},{"name":"current_workers_count","type":"int","not_null":true},{"name":"active_workers_count","type":"int","not_null":true},{"name":"work_queue_count","type":"bigint","not_null":true},{"name":"pending_disk_io_count","type":"int","not_null":true},{"name":"queued_disk_io_count","type":"int","not_null":true},{"name":"load_factor","type":"int","not_null":true},{"name":"yield_count","type":"int","not_null":true},{"name":"last_timer_activity","type":"bigint","not_null":true},{"name":"failed_to_create_worker","type":"bit","not_null":true},{"name":"active_worker_address","type":"varbinary(8)"},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"task_memory_object_address","type":"varbinary(8)","not_null":true},{"name":"quantum_length_us","type":"bigint","not_null":true},{"name":"total_cpu_usage_ms","type":"bigint","not_null":true},{"name":"total_cpu_idle_capped_ms","type":"bigint"},{"name":"total_scheduler_delay_ms","type":"bigint","not_null":true},{"name":"ideal_workers_limit","type":"int","not_null":true},{"name":"total_signal_time","type":"bigint","not_null":true},{"name":"total_waits_completed","type":"bigint","not_null":true},{"name":"total_enqueued_tasks","type":"int","not_null":true},{"name":"total_completed_tasks","type":"int","not_null":true},{"name":"spinlock_wait_time_ms","type":"bigint","not_null":true},{"name":"spinlock_max_wait_time_ms","type":"bigint","not_null":true},{"name":"spinlock_wait_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_server_diagnostics_log_configurations","kind":"v","columns":[{"name":"is_enabled","type":"int"},{"name":"path","type":"nvarchar(260)","not_null":true},{"name":"max_size","type":"int"},{"name":"max_files","type":"int"}]} +{"schema":"sys","name":"dm_os_spinlock_stats","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"collisions","type":"bigint"},{"name":"spins","type":"bigint"},{"name":"spins_per_collision","type":"real"},{"name":"sleep_time","type":"bigint"},{"name":"backoffs","type":"bigint"}]} +{"schema":"sys","name":"dm_os_stacks","kind":"v","columns":[{"name":"stack_address","type":"varbinary(8)","not_null":true},{"name":"frame_index","type":"int","not_null":true},{"name":"frame_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_os_sublatches","kind":"v","columns":[{"name":"superlatch_address","type":"varbinary(8)"},{"name":"sublatch_address","type":"varbinary(8)","not_null":true},{"name":"partition_id","type":"int","not_null":true},{"name":"class_desc","type":"nvarchar(60)","not_null":true},{"name":"latch_desc","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_sys_info","kind":"v","columns":[{"name":"cpu_ticks","type":"bigint","not_null":true},{"name":"ms_ticks","type":"bigint","not_null":true},{"name":"cpu_count","type":"int","not_null":true},{"name":"hyperthread_ratio","type":"int","not_null":true},{"name":"physical_memory_kb","type":"bigint","not_null":true},{"name":"virtual_memory_kb","type":"bigint","not_null":true},{"name":"committed_kb","type":"bigint","not_null":true},{"name":"committed_target_kb","type":"bigint","not_null":true},{"name":"visible_target_kb","type":"bigint","not_null":true},{"name":"stack_size_in_bytes","type":"int","not_null":true},{"name":"os_quantum","type":"bigint","not_null":true},{"name":"os_error_mode","type":"int","not_null":true},{"name":"os_priority_class","type":"int"},{"name":"max_workers_count","type":"int","not_null":true},{"name":"scheduler_count","type":"int","not_null":true},{"name":"scheduler_total_count","type":"int","not_null":true},{"name":"deadlock_monitor_serial_number","type":"int","not_null":true},{"name":"sqlserver_start_time_ms_ticks","type":"bigint","not_null":true},{"name":"sqlserver_start_time","type":"datetime","not_null":true},{"name":"affinity_type","type":"int","not_null":true},{"name":"affinity_type_desc","type":"nvarchar(60)","not_null":true},{"name":"process_kernel_time_ms","type":"bigint","not_null":true},{"name":"process_user_time_ms","type":"bigint","not_null":true},{"name":"time_source","type":"int","not_null":true},{"name":"time_source_desc","type":"nvarchar(60)","not_null":true},{"name":"virtual_machine_type","type":"int","not_null":true},{"name":"virtual_machine_type_desc","type":"nvarchar(60)","not_null":true},{"name":"softnuma_configuration","type":"int","not_null":true},{"name":"softnuma_configuration_desc","type":"nvarchar(60)","not_null":true},{"name":"process_physical_affinity","type":"nvarchar(3072)","not_null":true},{"name":"sql_memory_model","type":"int","not_null":true},{"name":"sql_memory_model_desc","type":"nvarchar(60)","not_null":true},{"name":"socket_count","type":"int","not_null":true},{"name":"cores_per_socket","type":"int","not_null":true},{"name":"numa_node_count","type":"int","not_null":true},{"name":"container_type","type":"int","not_null":true},{"name":"container_type_desc","type":"nvarchar(60)","not_null":true}]} +{"schema":"sys","name":"dm_os_sys_memory","kind":"v","columns":[{"name":"total_physical_memory_kb","type":"bigint","not_null":true},{"name":"available_physical_memory_kb","type":"bigint","not_null":true},{"name":"total_page_file_kb","type":"bigint","not_null":true},{"name":"available_page_file_kb","type":"bigint","not_null":true},{"name":"system_cache_kb","type":"bigint","not_null":true},{"name":"kernel_paged_pool_kb","type":"bigint","not_null":true},{"name":"kernel_nonpaged_pool_kb","type":"bigint","not_null":true},{"name":"system_high_memory_signal_state","type":"bit","not_null":true},{"name":"system_low_memory_signal_state","type":"bit","not_null":true},{"name":"system_memory_state_desc","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"dm_os_tasks","kind":"v","columns":[{"name":"task_address","type":"varbinary(8)","not_null":true},{"name":"task_state","type":"nvarchar(60)"},{"name":"context_switches_count","type":"int"},{"name":"pending_io_count","type":"int"},{"name":"pending_io_byte_count","type":"bigint"},{"name":"pending_io_byte_average","type":"int"},{"name":"scheduler_id","type":"int","not_null":true},{"name":"session_id","type":"smallint"},{"name":"exec_context_id","type":"int"},{"name":"request_id","type":"int"},{"name":"worker_address","type":"varbinary(8)"},{"name":"host_address","type":"varbinary(8)","not_null":true},{"name":"parent_task_address","type":"varbinary(8)"},{"name":"task_local_storage","type":"nvarchar(3072)"}]} +{"schema":"sys","name":"dm_os_threads","kind":"v","columns":[{"name":"thread_address","type":"varbinary(8)","not_null":true},{"name":"started_by_sqlservr","type":"bit","not_null":true},{"name":"os_thread_id","type":"int","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"instruction_address","type":"varbinary(8)"},{"name":"creation_time","type":"datetime"},{"name":"kernel_time","type":"bigint"},{"name":"usermode_time","type":"bigint"},{"name":"stack_base_address","type":"varbinary(8)","not_null":true},{"name":"stack_end_address","type":"varbinary(8)"},{"name":"stack_bytes_committed","type":"int","not_null":true},{"name":"stack_bytes_used","type":"int"},{"name":"affinity","type":"bigint","not_null":true},{"name":"priority","type":"int"},{"name":"locale","type":"int"},{"name":"token","type":"varbinary(8)"},{"name":"is_impersonating","type":"int"},{"name":"is_waiting_on_loader_lock","type":"int"},{"name":"fiber_data","type":"varbinary(8)"},{"name":"thread_handle","type":"varbinary(8)"},{"name":"event_handle","type":"varbinary(8)"},{"name":"scheduler_address","type":"varbinary(8)"},{"name":"worker_address","type":"varbinary(8)"},{"name":"fiber_context_address","type":"varbinary(8)"},{"name":"self_address","type":"varbinary(8)"},{"name":"processor_group","type":"smallint","not_null":true},{"name":"description","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_os_virtual_address_dump","kind":"v","columns":[{"name":"region_base_address","type":"varbinary(8)","not_null":true},{"name":"region_allocation_base_address","type":"varbinary(8)","not_null":true},{"name":"region_allocation_protection","type":"varbinary(8)","not_null":true},{"name":"region_size_in_bytes","type":"bigint","not_null":true},{"name":"region_state","type":"varbinary(8)","not_null":true},{"name":"region_current_protection","type":"varbinary(8)","not_null":true},{"name":"region_type","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_os_wait_stats","kind":"v","columns":[{"name":"wait_type","type":"nvarchar(60)","not_null":true},{"name":"waiting_tasks_count","type":"bigint","not_null":true},{"name":"wait_time_ms","type":"bigint","not_null":true},{"name":"max_wait_time_ms","type":"bigint","not_null":true},{"name":"signal_wait_time_ms","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_os_waiting_tasks","kind":"v","columns":[{"name":"waiting_task_address","type":"varbinary(8)","not_null":true},{"name":"session_id","type":"smallint"},{"name":"exec_context_id","type":"int"},{"name":"wait_duration_ms","type":"bigint"},{"name":"wait_type","type":"nvarchar(60)"},{"name":"resource_address","type":"varbinary(8)"},{"name":"blocking_task_address","type":"varbinary(8)"},{"name":"blocking_session_id","type":"smallint"},{"name":"blocking_exec_context_id","type":"int"},{"name":"resource_description","type":"nvarchar(3072)"}]} +{"schema":"sys","name":"dm_os_windows_info","kind":"v","columns":[{"name":"windows_release","type":"nvarchar(256)","not_null":true},{"name":"windows_service_pack_level","type":"nvarchar(256)","not_null":true},{"name":"windows_sku","type":"int"},{"name":"os_language_version","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_os_worker_local_storage","kind":"v","columns":[{"name":"worker_address","type":"varbinary(8)","not_null":true},{"name":"comp_exec_ctxt_address","type":"varbinary(8)","not_null":true},{"name":"ec_address","type":"varbinary(8)","not_null":true},{"name":"broker_address","type":"varbinary(8)","not_null":true},{"name":"task_proxy_address","type":"varbinary(8)","not_null":true},{"name":"msqlxact_address","type":"varbinary(8)","not_null":true},{"name":"sql_prof_address","type":"varbinary(8)","not_null":true},{"name":"stack_checker_address","type":"varbinary(8)","not_null":true},{"name":"host_task_address","type":"varbinary(8)","not_null":true},{"name":"sni_error_address","type":"varbinary(8)","not_null":true},{"name":"queryscan_address","type":"varbinary(8)","not_null":true},{"name":"diag_address","type":"varbinary(8)","not_null":true},{"name":"query_driver_address","type":"varbinary(8)","not_null":true},{"name":"federatedxact_address","type":"varbinary(8)","not_null":true},{"name":"filestream_address","type":"varbinary(8)","not_null":true},{"name":"qe_cc_address","type":"varbinary(8)","not_null":true},{"name":"xtp_address","type":"varbinary(8)","not_null":true},{"name":"gq_address","type":"varbinary(8)","not_null":true},{"name":"extensibility_ctxt_address","type":"varbinary(8)","not_null":true},{"name":"performance_counters_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_os_workers","kind":"v","columns":[{"name":"worker_address","type":"varbinary(8)","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"is_preemptive","type":"bit"},{"name":"is_fiber","type":"bit"},{"name":"is_sick","type":"bit"},{"name":"is_in_cc_exception","type":"bit"},{"name":"is_fatal_exception","type":"bit"},{"name":"is_inside_catch","type":"bit"},{"name":"is_in_polling_io_completion_routine","type":"bit"},{"name":"context_switch_count","type":"int","not_null":true},{"name":"pending_io_count","type":"int","not_null":true},{"name":"pending_io_byte_count","type":"bigint","not_null":true},{"name":"pending_io_byte_average","type":"int","not_null":true},{"name":"wait_started_ms_ticks","type":"bigint","not_null":true},{"name":"wait_resumed_ms_ticks","type":"bigint","not_null":true},{"name":"task_bound_ms_ticks","type":"bigint","not_null":true},{"name":"worker_created_ms_ticks","type":"bigint","not_null":true},{"name":"exception_num","type":"int","not_null":true},{"name":"exception_severity","type":"int","not_null":true},{"name":"exception_address","type":"varbinary(8)"},{"name":"affinity","type":"bigint","not_null":true},{"name":"state","type":"nvarchar(60)"},{"name":"start_quantum","type":"bigint","not_null":true},{"name":"end_quantum","type":"bigint","not_null":true},{"name":"last_wait_type","type":"nvarchar(60)"},{"name":"return_code","type":"int","not_null":true},{"name":"quantum_used","type":"bigint","not_null":true},{"name":"max_quantum","type":"bigint","not_null":true},{"name":"boost_count","type":"int","not_null":true},{"name":"tasks_processed_count","type":"int","not_null":true},{"name":"fiber_address","type":"varbinary(8)"},{"name":"task_address","type":"varbinary(8)"},{"name":"memory_object_address","type":"varbinary(8)","not_null":true},{"name":"thread_address","type":"varbinary(8)"},{"name":"signal_worker_address","type":"varbinary(8)"},{"name":"scheduler_address","type":"varbinary(8)"},{"name":"processor_group","type":"smallint","not_null":true},{"name":"worker_migration_count","type":"int","not_null":true},{"name":"spinlock_wait_time_ms","type":"bigint","not_null":true},{"name":"spinlock_max_wait_time_ms","type":"bigint","not_null":true},{"name":"spinlock_wait_count","type":"bigint","not_null":true},{"name":"cpu_used","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_pal_processes","kind":"v","columns":[{"name":"process_id","type":"bigint","not_null":true},{"name":"process_name","type":"nvarchar(256)","not_null":true},{"name":"processor_time","type":"bigint","not_null":true},{"name":"user_time","type":"bigint","not_null":true},{"name":"privileged_time","type":"bigint","not_null":true},{"name":"virtual_bytes_peak","type":"bigint","not_null":true},{"name":"virtual_bytes","type":"bigint","not_null":true},{"name":"working_set_peak","type":"bigint","not_null":true},{"name":"working_set","type":"bigint","not_null":true},{"name":"page_file_bytes_peak","type":"bigint","not_null":true},{"name":"page_file_bytes","type":"bigint","not_null":true},{"name":"private_bytes","type":"bigint","not_null":true},{"name":"thread_count","type":"bigint","not_null":true},{"name":"elapsed_time","type":"bigint","not_null":true},{"name":"pool_paged_bytes","type":"bigint","not_null":true},{"name":"handle_count","type":"bigint","not_null":true},{"name":"io_read_operations","type":"bigint","not_null":true},{"name":"io_write_operations","type":"bigint","not_null":true},{"name":"io_read_bytes","type":"bigint","not_null":true},{"name":"io_write_bytes","type":"bigint","not_null":true},{"name":"working_set_private","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_pal_ring_buffers","kind":"v","columns":[{"name":"ring_buffer_address","type":"varbinary(8)","not_null":true},{"name":"ring_buffer_type","type":"nvarchar(60)","not_null":true},{"name":"timestamp","type":"bigint","not_null":true},{"name":"record","type":"nvarchar(max)"},{"name":"ring_buffer_group","type":"nvarchar(60)","not_null":true},{"name":"create_time","type":"datetime2(7)","not_null":true}]} +{"schema":"sys","name":"dm_qn_subscriptions","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"sid","type":"varbinary(85)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"created","type":"datetime","not_null":true},{"name":"timeout","type":"int","not_null":true},{"name":"status","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_repl_articles","kind":"v","columns":[{"name":"artcache_db_address","type":"varbinary(8)"},{"name":"artcache_table_address","type":"varbinary(8)"},{"name":"artcache_schema_address","type":"varbinary(8)"},{"name":"artcache_article_address","type":"varbinary(8)"},{"name":"artid","type":"int"},{"name":"artfilter","type":"int"},{"name":"artobjid","type":"int"},{"name":"artpubid","type":"int"},{"name":"artstatus","type":"tinyint"},{"name":"arttype","type":"tinyint"},{"name":"wszartdesttable","type":"nvarchar(256)"},{"name":"wszartdesttableowner","type":"nvarchar(256)"},{"name":"wszartinscmd","type":"nvarchar(258)"},{"name":"cmdtypeins","type":"int"},{"name":"wszartdelcmd","type":"nvarchar(258)"},{"name":"cmdtypedel","type":"int"},{"name":"wszartupdcmd","type":"nvarchar(258)"},{"name":"cmdtypeupd","type":"int"},{"name":"wszartpartialupdcmd","type":"nvarchar(258)"},{"name":"cmdtypepartialupd","type":"int"},{"name":"numcol","type":"int"},{"name":"artcmdtype","type":"tinyint"},{"name":"artgeninscmd","type":"nvarchar(4000)"},{"name":"artgendelcmd","type":"nvarchar(4000)"},{"name":"artgenupdcmd","type":"nvarchar(4000)"},{"name":"artpartialupdcmd","type":"nvarchar(4000)"},{"name":"artupdtxtcmd","type":"nvarchar(4000)"},{"name":"artgenins2cmd","type":"nvarchar(4000)"},{"name":"artgendel2cmd","type":"nvarchar(4000)"},{"name":"finreconcile","type":"tinyint"},{"name":"fpuballowupdate","type":"tinyint"},{"name":"intpublicationoptions","type":"int"}]} +{"schema":"sys","name":"dm_repl_schemas","kind":"v","columns":[{"name":"artcache_schema_address","type":"varbinary(8)"},{"name":"tabid","type":"int"},{"name":"indexid","type":"smallint"},{"name":"idsch","type":"int"},{"name":"tabschema","type":"nvarchar(256)"},{"name":"cctabschema","type":"smallint"},{"name":"tabname","type":"nvarchar(256)"},{"name":"cctabname","type":"smallint"},{"name":"rowsetid_delete","type":"bigint"},{"name":"rowsetid_insert","type":"bigint"},{"name":"num_pk_cols","type":"int"},{"name":"pcitee","type":"varbinary(8)"},{"name":"re_numtextcols","type":"int"},{"name":"re_schema_lsn_begin","type":"nvarchar(24)"},{"name":"re_schema_lsn_end","type":"nvarchar(24)"},{"name":"re_numcols","type":"int"},{"name":"re_colid","type":"int"},{"name":"re_awcname","type":"nvarchar(256)"},{"name":"re_ccname","type":"smallint"},{"name":"re_colattr","type":"smallint"},{"name":"re_maxlen","type":"smallint"},{"name":"re_prec","type":"tinyint"},{"name":"re_scale","type":"tinyint"},{"name":"re_collatid","type":"int"},{"name":"re_xvtype","type":"tinyint"},{"name":"re_offset","type":"int"},{"name":"re_bitpos","type":"tinyint"},{"name":"re_fnullable","type":"tinyint"},{"name":"re_fansitrim","type":"tinyint"},{"name":"re_computed","type":"int"},{"name":"se_rowsetid","type":"bigint"},{"name":"se_schema_lsn_begin","type":"nvarchar(24)"},{"name":"se_schema_lsn_end","type":"nvarchar(24)"},{"name":"se_numcols","type":"int"},{"name":"se_colid","type":"int"},{"name":"se_maxlen","type":"smallint"},{"name":"se_prec","type":"tinyint"},{"name":"se_scale","type":"tinyint"},{"name":"se_collatid","type":"int"},{"name":"se_xvtype","type":"tinyint"},{"name":"se_offset","type":"int"},{"name":"se_bitpos","type":"tinyint"},{"name":"se_fnullable","type":"tinyint"},{"name":"se_fansitrim","type":"tinyint"},{"name":"se_computed","type":"tinyint"},{"name":"se_nullbitinleafrows","type":"smallint"}]} +{"schema":"sys","name":"dm_repl_tranhash","kind":"v","columns":[{"name":"buckets","type":"int"},{"name":"hashed_trans","type":"int"},{"name":"completed_trans","type":"int"},{"name":"compensated_trans","type":"int"},{"name":"first_begin_lsn","type":"nvarchar(24)"},{"name":"last_commit_lsn","type":"nvarchar(24)"}]} +{"schema":"sys","name":"dm_repl_traninfo","kind":"v","columns":[{"name":"fp2p_pub_exists","type":"tinyint"},{"name":"db_ver","type":"int"},{"name":"comp_range_address","type":"varbinary(8)"},{"name":"textinfo_address","type":"varbinary(8)"},{"name":"fsinfo_address","type":"varbinary(8)"},{"name":"begin_lsn","type":"nvarchar(24)"},{"name":"commit_lsn","type":"nvarchar(24)"},{"name":"dbid","type":"smallint"},{"name":"rows","type":"int"},{"name":"xdesid","type":"nvarchar(24)"},{"name":"artcache_table_address","type":"varbinary(8)"},{"name":"server","type":"nvarchar(256)"},{"name":"server_len_in_bytes","type":"int"},{"name":"database","type":"nvarchar(256)"},{"name":"db_len_in_bytes","type":"int"},{"name":"originator","type":"nvarchar(256)"},{"name":"originator_len_in_bytes","type":"int"},{"name":"orig_db","type":"nvarchar(256)"},{"name":"orig_db_len_in_bytes","type":"int"},{"name":"cmds_in_tran","type":"int"},{"name":"is_boundedupdate_singleton","type":"tinyint"},{"name":"begin_update_lsn","type":"nvarchar(24)"},{"name":"delete_lsn","type":"nvarchar(24)"},{"name":"last_end_lsn","type":"nvarchar(24)"},{"name":"fcomplete","type":"tinyint"},{"name":"fcompensated","type":"tinyint"},{"name":"fprocessingtext","type":"tinyint"},{"name":"max_cmds_in_tran","type":"int"},{"name":"begin_time","type":"datetime"},{"name":"commit_time","type":"datetime"},{"name":"session_id","type":"int"},{"name":"session_phase","type":"nvarchar(200)"},{"name":"is_known_cdc_tran","type":"tinyint"},{"name":"error_count","type":"int"}]} +{"schema":"sys","name":"dm_request_phases","kind":"v","columns":[{"name":"dist_statement_id","type":"uniqueidentifier","not_null":true},{"name":"dist_request_id","type":"uniqueidentifier","not_null":true},{"name":"id","type":"nvarchar(30)","not_null":true},{"name":"start_time","type":"datetime"},{"name":"end_time","type":"datetime"},{"name":"total_elapsed_time_ms","type":"bigint"},{"name":"min_time_ms","type":"bigint"},{"name":"max_time_ms","type":"bigint"},{"name":"avg_time_ms","type":"bigint"},{"name":"stdev_time_ms","type":"float"},{"name":"input_dop","type":"int","not_null":true},{"name":"output_dop","type":"int","not_null":true},{"name":"state_desc","type":"nvarchar(30)","not_null":true},{"name":"total_bytes_processed","type":"bigint"},{"name":"operation_type","type":"nvarchar(30)"},{"name":"task_retries","type":"int"},{"name":"parent_ids","type":"nvarchar(30)"},{"name":"min_rows","type":"bigint"},{"name":"max_rows","type":"bigint"},{"name":"avg_rows","type":"bigint"},{"name":"stdev_rows","type":"float"},{"name":"total_rows","type":"bigint"},{"name":"error_id","type":"nvarchar(30)"}]} +{"schema":"sys","name":"dm_request_phases_exec_task_stats","kind":"v","columns":[{"name":"dist_request_id","type":"uniqueidentifier","not_null":true},{"name":"id","type":"nvarchar(30)","not_null":true},{"name":"min_time_ms","type":"bigint"},{"name":"max_time_ms","type":"bigint"},{"name":"avg_time_ms","type":"bigint"},{"name":"stdev_time_ms","type":"float"},{"name":"total_bytes_processed","type":"bigint"},{"name":"min_rows","type":"bigint"},{"name":"max_rows","type":"bigint"},{"name":"avg_rows","type":"bigint"},{"name":"stdev_rows","type":"float"},{"name":"total_rows","type":"bigint"},{"name":"error_id","type":"nvarchar(30)"}]} +{"schema":"sys","name":"dm_request_phases_task_group_stats","kind":"v","columns":[{"name":"dist_request_id","type":"uniqueidentifier","not_null":true},{"name":"id","type":"nvarchar(30)","not_null":true},{"name":"dist_statement_id","type":"uniqueidentifier","not_null":true},{"name":"state_desc","type":"nvarchar(30)","not_null":true},{"name":"start_time","type":"bigint","not_null":true},{"name":"end_time","type":"bigint","not_null":true},{"name":"input_dop","type":"int","not_null":true},{"name":"output_dop","type":"int","not_null":true},{"name":"operation_type","type":"nvarchar(30)"},{"name":"task_retries","type":"int"},{"name":"parent_ids","type":"nvarchar(30)"}]} +{"schema":"sys","name":"dm_resource_governor_configuration","kind":"v","columns":[{"name":"classifier_function_id","type":"int","not_null":true},{"name":"is_reconfiguration_pending","type":"tinyint","not_null":true},{"name":"max_outstanding_io_per_volume","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_external_resource_pool_affinity","kind":"v","columns":[{"name":"external_pool_id","type":"int","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"cpu_mask","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_external_resource_pools","kind":"v","columns":[{"name":"external_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"pool_version","type":"bigint","not_null":true},{"name":"max_cpu_percent","type":"int","not_null":true},{"name":"max_processes","type":"int","not_null":true},{"name":"max_memory_percent","type":"int","not_null":true},{"name":"statistics_start_time","type":"datetime","not_null":true},{"name":"peak_memory_kb","type":"bigint","not_null":true},{"name":"write_io_count","type":"bigint","not_null":true},{"name":"read_io_count","type":"bigint","not_null":true},{"name":"total_cpu_kernel_ms","type":"bigint","not_null":true},{"name":"total_cpu_user_ms","type":"bigint","not_null":true},{"name":"active_processes_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_resource_pool_affinity","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"scheduler_mask","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_resource_pool_volumes","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"volume_name","type":"nvarchar(256)","not_null":true},{"name":"read_io_queued_total","type":"int","not_null":true},{"name":"read_io_issued_total","type":"int","not_null":true},{"name":"read_io_completed_total","type":"int","not_null":true},{"name":"read_io_throttled_total","type":"int","not_null":true},{"name":"read_bytes_total","type":"bigint","not_null":true},{"name":"read_io_stall_total_ms","type":"bigint","not_null":true},{"name":"read_io_stall_queued_ms","type":"bigint","not_null":true},{"name":"write_io_queued_total","type":"int","not_null":true},{"name":"write_io_issued_total","type":"int","not_null":true},{"name":"write_io_completed_total","type":"int","not_null":true},{"name":"write_io_throttled_total","type":"int","not_null":true},{"name":"write_bytes_total","type":"bigint","not_null":true},{"name":"write_io_stall_total_ms","type":"bigint","not_null":true},{"name":"write_io_stall_queued_ms","type":"bigint","not_null":true},{"name":"io_issue_violations_total","type":"int","not_null":true},{"name":"io_issue_delay_total_ms","type":"bigint","not_null":true},{"name":"io_issue_ahead_total_ms","type":"bigint","not_null":true},{"name":"reserved_io_limited_by_volume_total","type":"int","not_null":true},{"name":"io_issue_delay_non_throttled_total_ms","type":"bigint"}]} +{"schema":"sys","name":"dm_resource_governor_resource_pools","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"statistics_start_time","type":"datetime","not_null":true},{"name":"total_cpu_usage_ms","type":"bigint","not_null":true},{"name":"cache_memory_kb","type":"bigint","not_null":true},{"name":"compile_memory_kb","type":"bigint","not_null":true},{"name":"used_memgrant_kb","type":"bigint","not_null":true},{"name":"total_memgrant_count","type":"bigint","not_null":true},{"name":"total_memgrant_timeout_count","type":"bigint","not_null":true},{"name":"active_memgrant_count","type":"int","not_null":true},{"name":"active_memgrant_kb","type":"bigint","not_null":true},{"name":"memgrant_waiter_count","type":"int","not_null":true},{"name":"max_memory_kb","type":"bigint","not_null":true},{"name":"used_memory_kb","type":"bigint","not_null":true},{"name":"target_memory_kb","type":"bigint","not_null":true},{"name":"out_of_memory_count","type":"bigint","not_null":true},{"name":"min_cpu_percent","type":"int","not_null":true},{"name":"max_cpu_percent","type":"int","not_null":true},{"name":"min_memory_percent","type":"int","not_null":true},{"name":"max_memory_percent","type":"int","not_null":true},{"name":"cap_cpu_percent","type":"int","not_null":true},{"name":"min_iops_per_volume","type":"int"},{"name":"max_iops_per_volume","type":"int"},{"name":"read_io_queued_total","type":"int"},{"name":"read_io_issued_total","type":"int"},{"name":"read_io_completed_total","type":"int","not_null":true},{"name":"read_io_throttled_total","type":"int"},{"name":"read_bytes_total","type":"bigint","not_null":true},{"name":"read_io_stall_total_ms","type":"bigint","not_null":true},{"name":"read_io_stall_queued_ms","type":"bigint"},{"name":"write_io_queued_total","type":"int"},{"name":"write_io_issued_total","type":"int"},{"name":"write_io_completed_total","type":"int","not_null":true},{"name":"write_io_throttled_total","type":"int"},{"name":"write_bytes_total","type":"bigint","not_null":true},{"name":"write_io_stall_total_ms","type":"bigint","not_null":true},{"name":"write_io_stall_queued_ms","type":"bigint"},{"name":"io_issue_violations_total","type":"int"},{"name":"io_issue_delay_total_ms","type":"bigint"},{"name":"io_issue_ahead_total_ms","type":"bigint"},{"name":"reserved_io_limited_by_volume_total","type":"int"},{"name":"io_issue_delay_non_throttled_total_ms","type":"bigint"},{"name":"total_cpu_delayed_ms","type":"bigint","not_null":true},{"name":"total_cpu_active_ms","type":"bigint","not_null":true},{"name":"total_cpu_violation_delay_ms","type":"bigint","not_null":true},{"name":"total_cpu_violation_sec","type":"bigint","not_null":true},{"name":"total_cpu_usage_preemptive_ms","type":"bigint","not_null":true},{"name":"total_cpu_usage_actual_ms","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_resource_governor_workload_groups","kind":"v","columns":[{"name":"group_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"pool_id","type":"int","not_null":true},{"name":"external_pool_id","type":"int"},{"name":"statistics_start_time","type":"datetime","not_null":true},{"name":"total_request_count","type":"bigint","not_null":true},{"name":"total_queued_request_count","type":"bigint","not_null":true},{"name":"active_request_count","type":"int","not_null":true},{"name":"queued_request_count","type":"int","not_null":true},{"name":"total_cpu_limit_violation_count","type":"bigint","not_null":true},{"name":"total_cpu_usage_ms","type":"bigint","not_null":true},{"name":"max_request_cpu_time_ms","type":"bigint","not_null":true},{"name":"blocked_task_count","type":"int","not_null":true},{"name":"total_lock_wait_count","type":"bigint","not_null":true},{"name":"total_lock_wait_time_ms","type":"bigint","not_null":true},{"name":"total_query_optimization_count","type":"bigint","not_null":true},{"name":"total_suboptimal_plan_generation_count","type":"bigint","not_null":true},{"name":"total_reduced_memgrant_count","type":"bigint","not_null":true},{"name":"max_request_grant_memory_kb","type":"bigint","not_null":true},{"name":"active_parallel_thread_count","type":"bigint","not_null":true},{"name":"importance","type":"nvarchar(256)","not_null":true},{"name":"request_max_memory_grant_percent","type":"int","not_null":true},{"name":"request_max_cpu_time_sec","type":"int","not_null":true},{"name":"request_memory_grant_timeout_sec","type":"int","not_null":true},{"name":"group_max_requests","type":"int","not_null":true},{"name":"max_dop","type":"int","not_null":true},{"name":"effective_max_dop","type":"int","not_null":true},{"name":"total_cpu_usage_preemptive_ms","type":"bigint","not_null":true},{"name":"request_max_memory_grant_percent_numeric","type":"float","not_null":true},{"name":"total_cpu_usage_actual_ms","type":"bigint","not_null":true},{"name":"cache_memory_kb","type":"bigint"},{"name":"compile_memory_kb","type":"bigint"},{"name":"used_memory_kb","type":"bigint","not_null":true},{"name":"cap_cpu_percent","type":"decimal(5,2)"},{"name":"tempdb_data_space_kb","type":"bigint"},{"name":"peak_tempdb_data_space_kb","type":"bigint"},{"name":"total_tempdb_data_limit_violation_count","type":"bigint"}]} +{"schema":"sys","name":"dm_server_accelerator_status","kind":"v","columns":[{"name":"accelerator","type":"nvarchar(256)","not_null":true},{"name":"accelerator_desc","type":"nvarchar(256)","not_null":true},{"name":"config","type":"tinyint"},{"name":"config_in_use","type":"tinyint"},{"name":"mode","type":"tinyint"},{"name":"mode_desc","type":"nvarchar(60)"},{"name":"mode_reason","type":"tinyint"},{"name":"mode_reason_desc","type":"nvarchar(60)"},{"name":"accelerator_hardware_detected","type":"tinyint"},{"name":"accelerator_library_version","type":"nvarchar(256)"},{"name":"accelerator_driver_version","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_server_audit_status","kind":"v","columns":[{"name":"audit_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"status","type":"smallint","not_null":true},{"name":"status_desc","type":"nvarchar(256)","not_null":true},{"name":"status_time","type":"datetime2(7)","not_null":true},{"name":"event_session_address","type":"varbinary(8)"},{"name":"audit_file_path","type":"nvarchar(256)"},{"name":"audit_file_size","type":"bigint"}]} +{"schema":"sys","name":"dm_server_external_policy_actions","kind":"v","columns":[{"name":"sql_action_id","type":"int"},{"name":"action_namespace","type":"nvarchar(256)"},{"name":"action_type","type":"nvarchar(32)"},{"name":"action_provider_string","type":"nvarchar(20)"}]} +{"schema":"sys","name":"dm_server_external_policy_principal_assigned_actions","kind":"v","columns":[{"name":"principal_sid","type":"varbinary(85)"},{"name":"principal_aad_object_id","type":"nvarchar(36)"},{"name":"action_namespace","type":"nvarchar(256)"},{"name":"action_type","type":"nvarchar(32)"},{"name":"role_name","type":"nvarchar(128)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"role_assignment_scope","type":"nvarchar(4000)"},{"name":"role_assignment_type","type":"int"},{"name":"role_assignment_type_desc","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_server_external_policy_principals","kind":"v","columns":[{"name":"sid","type":"varbinary(85)"},{"name":"aad_object_id","type":"nvarchar(36)"},{"name":"type","type":"nvarchar(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"authentication_type","type":"int"},{"name":"authentication_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"dm_server_external_policy_role_actions","kind":"v","columns":[{"name":"role_guid","type":"nvarchar(128)"},{"name":"sql_action_id","type":"int"}]} +{"schema":"sys","name":"dm_server_external_policy_role_members","kind":"v","columns":[{"name":"principal_aad_object_id","type":"nvarchar(36)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"policy_guid","type":"nvarchar(128)"},{"name":"assignment_scope","type":"nvarchar(4000)"},{"name":"assignment_type","type":"int"},{"name":"assignment_type_desc","type":"nvarchar(5)"}]} +{"schema":"sys","name":"dm_server_external_policy_roles","kind":"v","columns":[{"name":"role_name","type":"nvarchar(128)"},{"name":"role_guid","type":"nvarchar(128)"},{"name":"modify_date","type":"datetime2(7)"}]} +{"schema":"sys","name":"dm_server_managed_identities","kind":"v","columns":[{"name":"client_id","type":"uniqueidentifier"},{"name":"identity_type","type":"nvarchar(60)"},{"name":"tenant_id","type":"uniqueidentifier"},{"name":"is_primary","type":"bit"}]} +{"schema":"sys","name":"dm_server_memory_dumps","kind":"v","columns":[{"name":"filename","type":"nvarchar(256)","not_null":true},{"name":"creation_time","type":"datetimeoffset(7)","not_null":true},{"name":"size_in_bytes","type":"bigint"}]} +{"schema":"sys","name":"dm_server_registry","kind":"v","columns":[{"name":"registry_key","type":"nvarchar(256)"},{"name":"value_name","type":"nvarchar(256)"},{"name":"value_data","type":"sql_variant"}]} +{"schema":"sys","name":"dm_server_services","kind":"v","columns":[{"name":"servicename","type":"nvarchar(256)","not_null":true},{"name":"startup_type","type":"int"},{"name":"startup_type_desc","type":"nvarchar(256)","not_null":true},{"name":"status","type":"int"},{"name":"status_desc","type":"nvarchar(256)","not_null":true},{"name":"process_id","type":"int"},{"name":"last_startup_time","type":"datetimeoffset(7)"},{"name":"service_account","type":"nvarchar(256)","not_null":true},{"name":"filename","type":"nvarchar(256)","not_null":true},{"name":"is_clustered","type":"nvarchar(1)","not_null":true},{"name":"cluster_nodename","type":"nvarchar(256)"},{"name":"instant_file_initialization_enabled","type":"nvarchar(1)","not_null":true}]} +{"schema":"sys","name":"dm_server_suspend_status","kind":"v","columns":[{"name":"db_id","type":"smallint","not_null":true},{"name":"db_name","type":"nvarchar(256)","not_null":true},{"name":"suspend_session_id","type":"smallint"},{"name":"suspend_time_ms","type":"bigint"},{"name":"is_diff_map_cleared","type":"bit"},{"name":"is_write_io_frozen","type":"bit"}]} +{"schema":"sys","name":"dm_tcp_listener_states","kind":"v","columns":[{"name":"listener_id","type":"int","not_null":true},{"name":"ip_address","type":"nvarchar(48)","not_null":true},{"name":"is_ipv4","type":"bit","not_null":true},{"name":"port","type":"int","not_null":true},{"name":"type","type":"smallint","not_null":true},{"name":"type_desc","type":"nvarchar(20)","not_null":true},{"name":"state","type":"smallint","not_null":true},{"name":"state_desc","type":"nvarchar(16)","not_null":true},{"name":"start_time","type":"datetime","not_null":true}]} +{"schema":"sys","name":"dm_tran_aborted_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint","not_null":true},{"name":"database_id","type":"smallint","not_null":true},{"name":"begin_xact_lsn","type":"numeric(25,0)"},{"name":"end_xact_lsn","type":"numeric(25,0)"},{"name":"begin_time","type":"datetime"},{"name":"nest_aborted","type":"bit"}]} +{"schema":"sys","name":"dm_tran_active_snapshot_database_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint"},{"name":"transaction_sequence_num","type":"bigint"},{"name":"commit_sequence_num","type":"bigint"},{"name":"session_id","type":"int"},{"name":"is_snapshot","type":"bit"},{"name":"first_snapshot_sequence_num","type":"bigint"},{"name":"max_version_chain_traversed","type":"int"},{"name":"average_version_chain_traversed","type":"float"},{"name":"elapsed_time_seconds","type":"bigint"}]} +{"schema":"sys","name":"dm_tran_active_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint","not_null":true},{"name":"name","type":"nvarchar(32)","not_null":true},{"name":"transaction_begin_time","type":"datetime","not_null":true},{"name":"transaction_type","type":"int","not_null":true},{"name":"transaction_uow","type":"uniqueidentifier"},{"name":"transaction_state","type":"int","not_null":true},{"name":"transaction_status","type":"int","not_null":true},{"name":"transaction_status2","type":"int","not_null":true},{"name":"dtc_state","type":"int","not_null":true},{"name":"dtc_status","type":"int","not_null":true},{"name":"dtc_isolation_level","type":"int","not_null":true},{"name":"filestream_transaction_id","type":"varbinary(128)"}]} +{"schema":"sys","name":"dm_tran_commit_table","kind":"v","columns":[{"name":"commit_ts","type":"bigint"},{"name":"xdes_id","type":"bigint"},{"name":"commit_lbn","type":"bigint","not_null":true},{"name":"commit_csn","type":"bigint","not_null":true},{"name":"commit_time","type":"datetime","not_null":true}]} +{"schema":"sys","name":"dm_tran_current_snapshot","kind":"v","columns":[{"name":"transaction_sequence_num","type":"bigint"}]} +{"schema":"sys","name":"dm_tran_current_transaction","kind":"v","columns":[{"name":"transaction_id","type":"bigint"},{"name":"transaction_sequence_num","type":"bigint"},{"name":"transaction_is_snapshot","type":"bit"},{"name":"first_snapshot_sequence_num","type":"bigint"},{"name":"last_transaction_sequence_num","type":"bigint"},{"name":"first_useful_sequence_num","type":"bigint"}]} +{"schema":"sys","name":"dm_tran_database_transactions","kind":"v","columns":[{"name":"transaction_id","type":"bigint","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"database_transaction_begin_time","type":"datetime"},{"name":"database_transaction_type","type":"int","not_null":true},{"name":"database_transaction_state","type":"int","not_null":true},{"name":"database_transaction_status","type":"int","not_null":true},{"name":"database_transaction_status2","type":"int","not_null":true},{"name":"database_transaction_log_record_count","type":"bigint","not_null":true},{"name":"database_transaction_replicate_record_count","type":"int","not_null":true},{"name":"database_transaction_log_bytes_used","type":"bigint","not_null":true},{"name":"database_transaction_log_bytes_reserved","type":"bigint","not_null":true},{"name":"database_transaction_log_bytes_used_system","type":"int","not_null":true},{"name":"database_transaction_log_bytes_reserved_system","type":"int","not_null":true},{"name":"database_transaction_begin_lsn","type":"numeric(25,0)"},{"name":"database_transaction_last_lsn","type":"numeric(25,0)"},{"name":"database_transaction_most_recent_savepoint_lsn","type":"numeric(25,0)"},{"name":"database_transaction_commit_lsn","type":"numeric(25,0)"},{"name":"database_transaction_last_rollback_lsn","type":"numeric(25,0)"},{"name":"database_transaction_next_undo_lsn","type":"numeric(25,0)"},{"name":"database_transaction_first_repl_lsn","type":"numeric(25,0)"}]} +{"schema":"sys","name":"dm_tran_distributed_transaction_stats","kind":"v","columns":[{"name":"aborted","type":"int","not_null":true},{"name":"aborted_max","type":"int","not_null":true},{"name":"forced_abort","type":"int","not_null":true},{"name":"committed","type":"int","not_null":true},{"name":"committed_max","type":"int","not_null":true},{"name":"forced_commit","type":"int","not_null":true},{"name":"heuristic","type":"int","not_null":true},{"name":"heuristic_max","type":"int","not_null":true},{"name":"in_doubt","type":"int","not_null":true},{"name":"in_doubt_max","type":"int","not_null":true},{"name":"open","type":"int","not_null":true},{"name":"open_max","type":"int","not_null":true},{"name":"single_phase_in_doubt","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_tran_global_recovery_transactions","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"transaction_uow","type":"uniqueidentifier","not_null":true},{"name":"transaction_manager_dbid","type":"int","not_null":true},{"name":"transaction_manager_rmid","type":"uniqueidentifier","not_null":true},{"name":"transaction_manager_server_name","type":"nvarchar(261)"},{"name":"transaction_manager_database_name","type":"nvarchar(129)"}]} +{"schema":"sys","name":"dm_tran_global_transactions","kind":"v","columns":[{"name":"transaction_id","type":"uniqueidentifier","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"transaction_state","type":"int","not_null":true},{"name":"resource_manager_id","type":"uniqueidentifier","not_null":true},{"name":"resource_manager_server","type":"nvarchar(261)"},{"name":"resource_manager_database","type":"nvarchar(129)"},{"name":"resource_manager_dbid","type":"int","not_null":true},{"name":"resource_manager_state","type":"int","not_null":true},{"name":"resource_prepare_lsn","type":"nvarchar(24)"},{"name":"resource_phase_1_time","type":"bigint","not_null":true},{"name":"resource_phase_2_time","type":"bigint","not_null":true},{"name":"transaction_phase_1_time","type":"bigint","not_null":true},{"name":"transaction_phase_2_time","type":"bigint","not_null":true},{"name":"transaction_total_time","type":"bigint","not_null":true},{"name":"transaction_diag_status","type":"int","not_null":true},{"name":"resource_manager_diag_status","type":"int","not_null":true},{"name":"max_csn","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_tran_global_transactions_enlistments","kind":"v","columns":[{"name":"transaction_id","type":"uniqueidentifier","not_null":true},{"name":"database_id","type":"int","not_null":true},{"name":"iso_level","type":"int","not_null":true},{"name":"can_commit","type":"int","not_null":true},{"name":"enlistment_state","type":"int","not_null":true},{"name":"resource_manager_id","type":"uniqueidentifier","not_null":true},{"name":"server_name","type":"nvarchar(261)"},{"name":"database_name","type":"nvarchar(129)"},{"name":"transaction_manager_server_name","type":"nvarchar(261)"},{"name":"transaction_manager_database_name","type":"nvarchar(129)"},{"name":"transaction_manager_database_id","type":"int","not_null":true},{"name":"transaction_manager_rmid","type":"uniqueidentifier","not_null":true},{"name":"prepare_lsn","type":"nvarchar(24)"},{"name":"snapshot_timestamp","type":"bigint","not_null":true},{"name":"oldest_active_lsn","type":"nvarchar(24)"},{"name":"prepare_elapsed_time","type":"bigint","not_null":true},{"name":"object_ref_count","type":"int","not_null":true},{"name":"transaction_timeout","type":"int","not_null":true},{"name":"diag_status","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_tran_global_transactions_log","kind":"v","columns":[{"name":"transaction_id","type":"uniqueidentifier","not_null":true},{"name":"time_utc","type":"datetime","not_null":true},{"name":"dropped","type":"tinyint","not_null":true},{"name":"resource_manager_id","type":"uniqueidentifier","not_null":true},{"name":"resource_manager_prepare_lsn","type":"nvarchar(24)"},{"name":"resource_manager_ack_received","type":"tinyint","not_null":true},{"name":"commit_timestamp","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_tran_locks","kind":"v","columns":[{"name":"resource_type","type":"nvarchar(60)","not_null":true},{"name":"resource_subtype","type":"nvarchar(60)","not_null":true},{"name":"resource_database_id","type":"int","not_null":true},{"name":"resource_description","type":"nvarchar(256)","not_null":true},{"name":"resource_associated_entity_id","type":"bigint"},{"name":"resource_lock_partition","type":"int"},{"name":"request_mode","type":"nvarchar(60)","not_null":true},{"name":"request_type","type":"nvarchar(60)","not_null":true},{"name":"request_status","type":"nvarchar(60)","not_null":true},{"name":"request_reference_count","type":"smallint","not_null":true},{"name":"request_lifetime","type":"int","not_null":true},{"name":"request_session_id","type":"int","not_null":true},{"name":"request_exec_context_id","type":"int","not_null":true},{"name":"request_request_id","type":"int","not_null":true},{"name":"request_owner_type","type":"nvarchar(60)","not_null":true},{"name":"request_owner_id","type":"bigint"},{"name":"request_owner_guid","type":"uniqueidentifier"},{"name":"request_owner_lockspace_id","type":"nvarchar(32)","not_null":true},{"name":"lock_owner_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_tran_orphaned_distributed_transactions","kind":"v","columns":[{"name":"transaction_uow","type":"nvarchar(256)"},{"name":"description","type":"nvarchar(256)","not_null":true},{"name":"state","type":"nvarchar(256)","not_null":true},{"name":"isolation_level","type":"int","not_null":true},{"name":"parent","type":"nvarchar(256)"}]} +{"schema":"sys","name":"dm_tran_persistent_version_store","kind":"v","columns":[{"name":"xdes_ts_push","type":"bigint","not_null":true},{"name":"xdes_ts_tran","type":"bigint","not_null":true},{"name":"subid_push","type":"int"},{"name":"subid_tran","type":"int"},{"name":"rowset_id","type":"bigint","not_null":true},{"name":"sec_version_rid","type":"binary(8)","not_null":true},{"name":"min_len","type":"smallint"},{"name":"seq_num","type":"bigint"},{"name":"prev_row_in_chain","type":"binary(8)","not_null":true},{"name":"row_version","type":"varbinary(8000)","not_null":true}]} +{"schema":"sys","name":"dm_tran_persistent_version_store_stats","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"pvs_filegroup_id","type":"smallint"},{"name":"persistent_version_store_size_kb","type":"bigint","not_null":true},{"name":"online_index_version_store_size_kb","type":"bigint","not_null":true},{"name":"current_aborted_transaction_count","type":"bigint","not_null":true},{"name":"oldest_active_transaction_id","type":"bigint","not_null":true},{"name":"oldest_active_transaction_global_id","type":"bigint","not_null":true},{"name":"oldest_aborted_transaction_id","type":"bigint","not_null":true},{"name":"min_transaction_timestamp","type":"bigint","not_null":true},{"name":"online_index_min_transaction_timestamp","type":"bigint","not_null":true},{"name":"secondary_low_water_mark","type":"bigint","not_null":true},{"name":"offrow_version_cleaner_start_time","type":"datetime2(7)"},{"name":"offrow_version_cleaner_end_time","type":"datetime2(7)"},{"name":"aborted_version_cleaner_start_time","type":"datetime2(7)"},{"name":"aborted_version_cleaner_end_time","type":"datetime2(7)"},{"name":"pvs_off_row_page_skipped_low_water_mark","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_transaction_not_cleaned","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_oldest_active_xdesid","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_min_useful_xts","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_oldest_snapshot","type":"bigint","not_null":true},{"name":"pvs_off_row_page_skipped_oldest_aborted_xdesid","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_tran_session_transactions","kind":"v","columns":[{"name":"session_id","type":"int","not_null":true},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"transaction_descriptor","type":"binary(8)","not_null":true},{"name":"enlist_count","type":"int","not_null":true},{"name":"is_user_transaction","type":"bit","not_null":true},{"name":"is_local","type":"bit","not_null":true},{"name":"is_enlisted","type":"bit","not_null":true},{"name":"is_bound","type":"bit","not_null":true},{"name":"open_transaction_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_tran_top_version_generators","kind":"v","columns":[{"name":"database_id","type":"smallint"},{"name":"rowset_id","type":"bigint"},{"name":"aggregated_record_length_in_bytes","type":"int"}]} +{"schema":"sys","name":"dm_tran_transactions_snapshot","kind":"v","columns":[{"name":"transaction_sequence_num","type":"bigint"},{"name":"snapshot_id","type":"int"},{"name":"snapshot_sequence_num","type":"bigint"}]} +{"schema":"sys","name":"dm_tran_version_store","kind":"v","columns":[{"name":"transaction_sequence_num","type":"bigint"},{"name":"version_sequence_num","type":"bigint"},{"name":"database_id","type":"smallint"},{"name":"rowset_id","type":"bigint"},{"name":"status","type":"tinyint"},{"name":"min_length_in_bytes","type":"smallint"},{"name":"record_length_first_part_in_bytes","type":"smallint"},{"name":"record_image_first_part","type":"varbinary(8000)"},{"name":"record_length_second_part_in_bytes","type":"smallint"},{"name":"record_image_second_part","type":"varbinary(8000)"}]} +{"schema":"sys","name":"dm_tran_version_store_space_usage","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"reserved_page_count","type":"bigint"},{"name":"reserved_space_kb","type":"bigint"}]} +{"schema":"sys","name":"dm_xe_map_values","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"object_package_guid","type":"uniqueidentifier","not_null":true},{"name":"map_key","type":"int","not_null":true},{"name":"map_value","type":"nvarchar(3072)","not_null":true}]} +{"schema":"sys","name":"dm_xe_object_columns","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"object_name","type":"nvarchar(256)","not_null":true},{"name":"object_package_guid","type":"uniqueidentifier","not_null":true},{"name":"type_name","type":"nvarchar(256)","not_null":true},{"name":"type_package_guid","type":"uniqueidentifier","not_null":true},{"name":"column_type","type":"nvarchar(60)","not_null":true},{"name":"column_value","type":"nvarchar(256)"},{"name":"capabilities","type":"int"},{"name":"capabilities_desc","type":"nvarchar(256)"},{"name":"description","type":"nvarchar(3072)"}]} +{"schema":"sys","name":"dm_xe_objects","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"object_type","type":"nvarchar(60)","not_null":true},{"name":"package_guid","type":"uniqueidentifier","not_null":true},{"name":"description","type":"nvarchar(3072)","not_null":true},{"name":"capabilities","type":"int"},{"name":"capabilities_desc","type":"nvarchar(256)"},{"name":"type_name","type":"nvarchar(256)"},{"name":"type_package_guid","type":"uniqueidentifier"},{"name":"type_size","type":"int"}]} +{"schema":"sys","name":"dm_xe_packages","kind":"v","columns":[{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"guid","type":"uniqueidentifier","not_null":true},{"name":"description","type":"nvarchar(3072)","not_null":true},{"name":"capabilities","type":"int"},{"name":"capabilities_desc","type":"nvarchar(256)"},{"name":"module_guid","type":"nvarchar(60)","not_null":true},{"name":"module_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_xe_session_event_actions","kind":"v","columns":[{"name":"event_session_address","type":"varbinary(8)","not_null":true},{"name":"action_name","type":"nvarchar(256)","not_null":true},{"name":"action_package_guid","type":"uniqueidentifier","not_null":true},{"name":"event_name","type":"nvarchar(256)","not_null":true},{"name":"event_package_guid","type":"uniqueidentifier","not_null":true}]} +{"schema":"sys","name":"dm_xe_session_events","kind":"v","columns":[{"name":"event_session_address","type":"varbinary(8)","not_null":true},{"name":"event_name","type":"nvarchar(256)","not_null":true},{"name":"event_package_guid","type":"uniqueidentifier","not_null":true},{"name":"event_predicate","type":"nvarchar(3072)"},{"name":"event_fire_count","type":"bigint","not_null":true},{"name":"event_fire_average_time","type":"bigint","not_null":true},{"name":"event_fire_min_time","type":"bigint","not_null":true},{"name":"event_fire_max_time","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_xe_session_object_columns","kind":"v","columns":[{"name":"event_session_address","type":"varbinary(8)","not_null":true},{"name":"column_name","type":"nvarchar(256)","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"column_value","type":"nvarchar(3072)"},{"name":"object_type","type":"nvarchar(60)","not_null":true},{"name":"object_name","type":"nvarchar(256)","not_null":true},{"name":"object_package_guid","type":"uniqueidentifier","not_null":true}]} +{"schema":"sys","name":"dm_xe_session_targets","kind":"v","columns":[{"name":"event_session_address","type":"varbinary(8)","not_null":true},{"name":"target_name","type":"nvarchar(256)","not_null":true},{"name":"target_package_guid","type":"uniqueidentifier","not_null":true},{"name":"execution_count","type":"bigint","not_null":true},{"name":"execution_duration_ms","type":"bigint","not_null":true},{"name":"target_data","type":"nvarchar(max)"},{"name":"bytes_written","type":"bigint","not_null":true},{"name":"used_memory","type":"bigint","not_null":true},{"name":"max_memory","type":"bigint","not_null":true},{"name":"failed_buffer_count","type":"bigint"}]} +{"schema":"sys","name":"dm_xe_sessions","kind":"v","columns":[{"name":"address","type":"varbinary(8)","not_null":true},{"name":"name","type":"nvarchar(256)","not_null":true},{"name":"pending_buffers","type":"int","not_null":true},{"name":"total_regular_buffers","type":"int","not_null":true},{"name":"regular_buffer_size","type":"bigint","not_null":true},{"name":"total_large_buffers","type":"int","not_null":true},{"name":"large_buffer_size","type":"bigint","not_null":true},{"name":"total_buffer_size","type":"bigint","not_null":true},{"name":"buffer_policy_flags","type":"int","not_null":true},{"name":"buffer_policy_desc","type":"nvarchar(256)","not_null":true},{"name":"flags","type":"int","not_null":true},{"name":"flag_desc","type":"nvarchar(256)","not_null":true},{"name":"dropped_event_count","type":"int","not_null":true},{"name":"dropped_buffer_count","type":"int","not_null":true},{"name":"blocked_event_fire_time","type":"int","not_null":true},{"name":"create_time","type":"datetime","not_null":true},{"name":"largest_event_dropped_size","type":"int","not_null":true},{"name":"session_source","type":"nvarchar(256)","not_null":true},{"name":"buffer_processed_count","type":"bigint","not_null":true},{"name":"buffer_full_count","type":"bigint","not_null":true},{"name":"total_bytes_generated","type":"bigint","not_null":true},{"name":"total_target_memory","type":"bigint","not_null":true},{"name":"buffer_processing_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_xtp_gc_queue_stats","kind":"v","columns":[{"name":"queue_id","type":"int","not_null":true},{"name":"total_enqueues","type":"bigint","not_null":true},{"name":"total_dequeues","type":"bigint","not_null":true},{"name":"current_queue_depth","type":"bigint","not_null":true},{"name":"maximum_queue_depth","type":"bigint","not_null":true},{"name":"last_service_ticks","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_xtp_gc_stats","kind":"v","columns":[{"name":"rows_examined","type":"bigint","not_null":true},{"name":"rows_no_sweep_needed","type":"bigint","not_null":true},{"name":"rows_first_in_bucket","type":"bigint","not_null":true},{"name":"rows_first_in_bucket_removed","type":"bigint","not_null":true},{"name":"rows_marked_for_unlink","type":"bigint","not_null":true},{"name":"parallel_assist_count","type":"bigint","not_null":true},{"name":"idle_worker_count","type":"bigint","not_null":true},{"name":"sweep_scans_started","type":"bigint","not_null":true},{"name":"sweep_scan_retries","type":"bigint","not_null":true},{"name":"sweep_rows_touched","type":"bigint","not_null":true},{"name":"sweep_rows_expiring","type":"bigint","not_null":true},{"name":"sweep_rows_expired","type":"bigint","not_null":true},{"name":"sweep_rows_expired_removed","type":"bigint","not_null":true}]} +{"schema":"sys","name":"dm_xtp_system_memory_consumers","kind":"v","columns":[{"name":"memory_consumer_id","type":"bigint","not_null":true},{"name":"memory_consumer_type","type":"int","not_null":true},{"name":"memory_consumer_type_desc","type":"nvarchar(16)","not_null":true},{"name":"memory_consumer_desc","type":"nvarchar(64)"},{"name":"lookaside_id","type":"bigint"},{"name":"allocated_bytes","type":"bigint","not_null":true},{"name":"used_bytes","type":"bigint","not_null":true},{"name":"allocation_count","type":"bigint","not_null":true},{"name":"partition_count","type":"int","not_null":true},{"name":"sizeclass_count","type":"int","not_null":true},{"name":"min_sizeclass","type":"int","not_null":true},{"name":"max_sizeclass","type":"int","not_null":true},{"name":"memory_consumer_address","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_xtp_threads","kind":"v","columns":[{"name":"thread_address","type":"varbinary(8)","not_null":true},{"name":"thread_type","type":"int","not_null":true},{"name":"thread_type_desc","type":"nvarchar(32)","not_null":true},{"name":"retired_row_count","type":"int","not_null":true},{"name":"retired_transaction_count","type":"int","not_null":true}]} +{"schema":"sys","name":"dm_xtp_transaction_recent_rows","kind":"v","columns":[{"name":"node_id","type":"smallint","not_null":true},{"name":"xtp_transaction_id","type":"bigint","not_null":true},{"name":"row_address","type":"varbinary(8)","not_null":true},{"name":"table_address","type":"varbinary(8)","not_null":true},{"name":"before_begin","type":"bigint","not_null":true},{"name":"before_end","type":"bigint","not_null":true},{"name":"before_links","type":"int","not_null":true},{"name":"before_time","type":"bigint","not_null":true},{"name":"after_begin","type":"bigint","not_null":true},{"name":"after_end","type":"bigint","not_null":true},{"name":"after_links","type":"int","not_null":true},{"name":"after_time","type":"bigint","not_null":true},{"name":"outcome","type":"varbinary(8)","not_null":true}]} +{"schema":"sys","name":"dm_xtp_transaction_stats","kind":"v","columns":[{"name":"total_count","type":"bigint","not_null":true},{"name":"read_only_count","type":"bigint","not_null":true},{"name":"total_aborts","type":"bigint","not_null":true},{"name":"system_aborts","type":"bigint","not_null":true},{"name":"validation_failures","type":"bigint","not_null":true},{"name":"dependencies_taken","type":"bigint","not_null":true},{"name":"dependencies_failed","type":"bigint","not_null":true},{"name":"savepoint_create","type":"bigint","not_null":true},{"name":"savepoint_rollbacks","type":"bigint","not_null":true},{"name":"savepoint_refreshes","type":"bigint","not_null":true},{"name":"log_bytes_written","type":"bigint","not_null":true},{"name":"log_io_count","type":"bigint","not_null":true},{"name":"phantom_scans_started","type":"bigint","not_null":true},{"name":"phantom_scans_retries","type":"bigint","not_null":true},{"name":"phantom_rows_touched","type":"bigint","not_null":true},{"name":"phantom_rows_expiring","type":"bigint","not_null":true},{"name":"phantom_rows_expired","type":"bigint","not_null":true},{"name":"phantom_rows_expired_removed","type":"bigint","not_null":true},{"name":"scans_started","type":"bigint","not_null":true},{"name":"scans_retried","type":"bigint","not_null":true},{"name":"rows_returned","type":"bigint","not_null":true},{"name":"rows_touched","type":"bigint","not_null":true},{"name":"rows_expiring","type":"bigint","not_null":true},{"name":"rows_expired","type":"bigint","not_null":true},{"name":"rows_expired_removed","type":"bigint","not_null":true},{"name":"row_insert_attempts","type":"bigint","not_null":true},{"name":"row_update_attempts","type":"bigint","not_null":true},{"name":"row_delete_attempts","type":"bigint","not_null":true},{"name":"write_conflicts","type":"bigint","not_null":true},{"name":"unique_constraint_violations","type":"bigint","not_null":true},{"name":"drop_table_memory_attempts","type":"bigint","not_null":true},{"name":"drop_table_memory_failures","type":"bigint","not_null":true}]} +{"schema":"sys","name":"edge_constraint_clauses","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"clause_number","type":"int","not_null":true},{"name":"from_object_id","type":"int","not_null":true},{"name":"to_object_id","type":"int","not_null":true}]} +{"schema":"sys","name":"edge_constraints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"is_disabled","type":"bit","not_null":true},{"name":"is_not_trusted","type":"bit","not_null":true},{"name":"is_system_named","type":"bit","not_null":true},{"name":"delete_referential_action","type":"tinyint"},{"name":"delete_referential_action_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"endpoint_webmethods","kind":"v","columns":[{"name":"endpoint_id","type":"int","not_null":true},{"name":"namespace","type":"nvarchar(384)"},{"name":"method_alias","type":"nvarchar(64)","not_null":true},{"name":"object_name","type":"nvarchar(776)"},{"name":"result_schema","type":"tinyint"},{"name":"result_schema_desc","type":"nvarchar(60)"},{"name":"result_format","type":"tinyint"},{"name":"result_format_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true}]} +{"schema":"sys","name":"event_notification_event_types","kind":"v","columns":[{"name":"type","type":"int","not_null":true},{"name":"type_name","type":"nvarchar(64)"},{"name":"parent_type","type":"int"}]} +{"schema":"sys","name":"event_notifications","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"parent_class","type":"tinyint","not_null":true},{"name":"parent_class_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"service_name","type":"nvarchar(256)"},{"name":"broker_instance","type":"nvarchar(128)"},{"name":"creator_sid","type":"varbinary(85)"},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"events","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"type_desc","type":"nvarchar(128)","not_null":true},{"name":"is_trigger_event","type":"bit"},{"name":"event_group_type","type":"int"},{"name":"event_group_type_desc","type":"nvarchar(128)"}]} +{"schema":"sys","name":"extended_procedures","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"dll_name","type":"nvarchar(260)"}]} +{"schema":"sys","name":"extended_properties","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"value","type":"sql_variant"}]} +{"schema":"sys","name":"external_data_sources","kind":"v","columns":[{"name":"data_source_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"location","type":"nvarchar(4000)","not_null":true},{"name":"type_desc","type":"nvarchar(255)"},{"name":"type","type":"tinyint","not_null":true},{"name":"resource_manager_location","type":"nvarchar(4000)"},{"name":"credential_id","type":"int","not_null":true},{"name":"database_name","type":"nvarchar(128)"},{"name":"shard_map_name","type":"nvarchar(128)"},{"name":"connection_options","type":"nvarchar(4000)"},{"name":"pushdown","type":"nvarchar(256)","not_null":true}]} +{"schema":"sys","name":"external_file_formats","kind":"v","columns":[{"name":"file_format_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"format_type","type":"nvarchar(100)","not_null":true},{"name":"field_terminator","type":"nvarchar(10)"},{"name":"string_delimiter","type":"nvarchar(10)"},{"name":"date_format","type":"nvarchar(50)"},{"name":"use_type_default","type":"bit"},{"name":"serde_method","type":"nvarchar(255)"},{"name":"row_terminator","type":"nvarchar(10)"},{"name":"encoding","type":"nvarchar(10)"},{"name":"data_compression","type":"nvarchar(255)"},{"name":"first_row","type":"int"},{"name":"parser_version","type":"nvarchar(32)"}]} +{"schema":"sys","name":"external_governance_classification_attributes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"object_attributes","type":"nvarchar(max)"}]} +{"schema":"sys","name":"external_governance_classifications","kind":"v","columns":[{"name":"classification","type":"nvarchar(4000)"},{"name":"classification_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"external_governance_classifications_mapping","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(16)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"classification_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"external_governance_sensitivity_classifications","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(16)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"label","type":"nvarchar(128)"},{"name":"label_id","type":"nvarchar(128)"},{"name":"information_type","type":"nvarchar(128)"},{"name":"information_type_id","type":"nvarchar(128)"},{"name":"rank","type":"int"},{"name":"rank_desc","type":"varchar(8)"}]} +{"schema":"sys","name":"external_governance_sensitivity_labels","kind":"v","columns":[{"name":"label","type":"nvarchar(4000)"},{"name":"label_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"external_governance_sensitivity_labels_mapping","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(16)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"label_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"external_job_streams","kind":"v","columns":[{"name":"job_id","type":"int","not_null":true},{"name":"stream_id","type":"int","not_null":true},{"name":"is_input","type":"bit","not_null":true},{"name":"is_output","type":"bit","not_null":true}]} +{"schema":"sys","name":"external_language_files","kind":"v","columns":[{"name":"external_language_id","type":"int","not_null":true},{"name":"content","type":"varbinary(max)"},{"name":"file_name","type":"nvarchar(128)"},{"name":"platform","type":"tinyint"},{"name":"platform_desc","type":"nvarchar(60)"},{"name":"parameters","type":"nvarchar(128)"},{"name":"environment_variables","type":"nvarchar(128)"}]} +{"schema":"sys","name":"external_languages","kind":"v","columns":[{"name":"external_language_id","type":"int","not_null":true},{"name":"language","type":"nvarchar(128)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"external_libraries","kind":"v","columns":[{"name":"external_library_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"principal_id","type":"int"},{"name":"language","type":"nvarchar(128)"},{"name":"scope","type":"int","not_null":true},{"name":"scope_desc","type":"varchar(7)","not_null":true}]} +{"schema":"sys","name":"external_libraries_installed","kind":"v","columns":[{"name":"db_id","type":"int","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"language_id","type":"int","not_null":true},{"name":"external_library_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"mdversion","type":"binary(8)","not_null":true}]} +{"schema":"sys","name":"external_library_files","kind":"v","columns":[{"name":"external_library_id","type":"int","not_null":true},{"name":"content","type":"varbinary(max)"},{"name":"platform","type":"tinyint"},{"name":"platform_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"external_library_setup_errors","kind":"v","columns":[{"name":"db_id","type":"int","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"external_library_id","type":"int","not_null":true},{"name":"error_code","type":"int","not_null":true},{"name":"error_timestamp","type":"datetime2(7)","not_null":true},{"name":"error_message","type":"nvarchar(1024)"}]} +{"schema":"sys","name":"external_models","kind":"v","columns":[{"name":"external_model_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"principal_id","type":"int"},{"name":"location","type":"nvarchar(4000)"},{"name":"api_format","type":"nvarchar(100)"},{"name":"model_type_id","type":"int"},{"name":"model_type_desc","type":"nvarchar(65)"},{"name":"model","type":"nvarchar(100)"},{"name":"credential_id","type":"int"},{"name":"parameters","type":"nvarchar(max)"},{"name":"create_time","type":"datetime2(7)"},{"name":"modify_time","type":"datetime2(7)"}]} +{"schema":"sys","name":"external_stream_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true}]} +{"schema":"sys","name":"external_streaming_jobs","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"uses_ansi_nulls","type":"bit"},{"name":"statement","type":"nvarchar(max)"},{"name":"status","type":"int"}]} +{"schema":"sys","name":"external_streams","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"max_column_id_used","type":"int"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"data_source_id","type":"int"},{"name":"file_format_id","type":"int"},{"name":"location","type":"nvarchar(4000)"},{"name":"input_options","type":"nvarchar(4000)"},{"name":"output_options","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"external_table_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"partition_column_ordinal","type":"int"},{"name":"hash_column_ordinal","type":"int"}]} +{"schema":"sys","name":"external_table_partitioning_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"ordinal_id","type":"bigint"}]} +{"schema":"sys","name":"external_table_schema_changed_mdsync","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"table_id","type":"int","not_null":true},{"name":"schema_changed","type":"sql_variant"}]} +{"schema":"sys","name":"external_tables","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"max_column_id_used","type":"int"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"data_source_id","type":"int","not_null":true},{"name":"file_format_id","type":"int"},{"name":"location","type":"nvarchar(4000)"},{"name":"reject_type","type":"nvarchar(20)"},{"name":"reject_value","type":"float"},{"name":"reject_sample_value","type":"float"},{"name":"distribution_type","type":"tinyint"},{"name":"distribution_desc","type":"nvarchar(120)"},{"name":"sharding_col_id","type":"int"},{"name":"remote_schema_name","type":"nvarchar(128)"},{"name":"remote_object_name","type":"nvarchar(128)"},{"name":"rejected_row_location","type":"nvarchar(4000)"},{"name":"table_options","type":"nvarchar(1000)"},{"name":"partition_type","type":"int","not_null":true},{"name":"partition_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"filegroups","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"data_space_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_default","type":"bit"},{"name":"is_system","type":"bit"},{"name":"filegroup_guid","type":"uniqueidentifier"},{"name":"log_filegroup_id","type":"int"},{"name":"is_read_only","type":"bit"},{"name":"is_autogrow_all_files","type":"bit"}]} +{"schema":"sys","name":"filetable_system_defined_objects","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true}]} +{"schema":"sys","name":"filetables","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"is_enabled","type":"bit","not_null":true},{"name":"directory_name","type":"nvarchar(256)","not_null":true},{"name":"filename_collation_id","type":"int","not_null":true},{"name":"filename_collation_name","type":"nvarchar(129)","not_null":true}]} +{"schema":"sys","name":"foreign_key_columns","kind":"v","columns":[{"name":"constraint_object_id","type":"int","not_null":true},{"name":"constraint_column_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"parent_column_id","type":"int","not_null":true},{"name":"referenced_object_id","type":"int","not_null":true},{"name":"referenced_column_id","type":"int","not_null":true}]} +{"schema":"sys","name":"foreign_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"referenced_object_id","type":"int"},{"name":"key_index_id","type":"int"},{"name":"is_disabled","type":"bit","not_null":true},{"name":"is_not_for_replication","type":"bit","not_null":true},{"name":"is_not_trusted","type":"bit","not_null":true},{"name":"delete_referential_action","type":"tinyint"},{"name":"delete_referential_action_desc","type":"nvarchar(60)"},{"name":"update_referential_action","type":"tinyint"},{"name":"update_referential_action_desc","type":"nvarchar(60)"},{"name":"is_system_named","type":"bit","not_null":true}]} +{"schema":"sys","name":"fulltext_catalogs","kind":"v","columns":[{"name":"fulltext_catalog_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"path","type":"nvarchar(260)"},{"name":"is_default","type":"bit","not_null":true},{"name":"is_accent_sensitivity_on","type":"bit","not_null":true},{"name":"data_space_id","type":"int"},{"name":"file_id","type":"int"},{"name":"principal_id","type":"int"},{"name":"is_importing","type":"bit","not_null":true}]} +{"schema":"sys","name":"fulltext_document_types","kind":"v","columns":[{"name":"document_type","type":"nvarchar(128)","not_null":true},{"name":"class_id","type":"uniqueidentifier","not_null":true},{"name":"path","type":"nvarchar(260)"},{"name":"version","type":"nvarchar(128)","not_null":true},{"name":"manufacturer","type":"nvarchar(128)"}]} +{"schema":"sys","name":"fulltext_index_catalog_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int"},{"name":"fulltext_catalog_id","type":"int","not_null":true}]} +{"schema":"sys","name":"fulltext_index_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"type_column_id","type":"int"},{"name":"language_id","type":"int","not_null":true},{"name":"statistical_semantics","type":"int","not_null":true}]} +{"schema":"sys","name":"fulltext_index_fragments","kind":"v","columns":[{"name":"table_id","type":"int","not_null":true},{"name":"fragment_id","type":"int","not_null":true},{"name":"fragment_object_id","type":"int","not_null":true},{"name":"timestamp","type":"binary(8)","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"data_size","type":"bigint","not_null":true},{"name":"row_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"fulltext_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"unique_index_id","type":"int","not_null":true},{"name":"index_version","type":"int"},{"name":"fulltext_catalog_id","type":"int"},{"name":"is_enabled","type":"bit","not_null":true},{"name":"change_tracking_state","type":"char(1)"},{"name":"change_tracking_state_desc","type":"nvarchar(60)"},{"name":"has_crawl_completed","type":"bit","not_null":true},{"name":"crawl_type","type":"char(1)","not_null":true},{"name":"crawl_type_desc","type":"nvarchar(60)"},{"name":"crawl_start_date","type":"datetime"},{"name":"crawl_end_date","type":"datetime"},{"name":"incremental_timestamp","type":"binary(8)"},{"name":"stoplist_id","type":"int"},{"name":"property_list_id","type":"int"},{"name":"data_space_id","type":"int","not_null":true}]} +{"schema":"sys","name":"fulltext_languages","kind":"v","columns":[{"name":"lcid","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"fulltext_semantic_language_statistics_database","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"register_date","type":"datetime","not_null":true},{"name":"registered_by","type":"int","not_null":true},{"name":"version","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"fulltext_semantic_languages","kind":"v","columns":[{"name":"lcid","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"fulltext_stoplists","kind":"v","columns":[{"name":"stoplist_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"fulltext_stopwords","kind":"v","columns":[{"name":"stoplist_id","type":"int","not_null":true},{"name":"stopword","type":"nvarchar(64)","not_null":true},{"name":"language","type":"nvarchar(128)","not_null":true},{"name":"language_id","type":"int","not_null":true}]} +{"schema":"sys","name":"fulltext_system_stopwords","kind":"v","columns":[{"name":"stopword","type":"nvarchar(64)"},{"name":"language_id","type":"int","not_null":true}]} +{"schema":"sys","name":"function_order_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"order_column_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"is_descending","type":"bit"}]} +{"schema":"sys","name":"hash_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"has_filter","type":"bit"},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"bucket_count","type":"int","not_null":true},{"name":"auto_created","type":"bit"}]} +{"schema":"sys","name":"http_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"site","type":"nvarchar(128)"},{"name":"url_path","type":"nvarchar(4000)"},{"name":"is_clear_port_enabled","type":"bit","not_null":true},{"name":"clear_port","type":"int","not_null":true},{"name":"is_ssl_port_enabled","type":"bit","not_null":true},{"name":"ssl_port","type":"int","not_null":true},{"name":"is_anonymous_enabled","type":"bit","not_null":true},{"name":"is_basic_auth_enabled","type":"bit","not_null":true},{"name":"is_digest_auth_enabled","type":"bit","not_null":true},{"name":"is_kerberos_auth_enabled","type":"bit","not_null":true},{"name":"is_ntlm_auth_enabled","type":"bit","not_null":true},{"name":"is_integrated_auth_enabled","type":"bit","not_null":true},{"name":"authorization_realm","type":"nvarchar(128)"},{"name":"default_logon_domain","type":"nvarchar(128)"},{"name":"is_compression_enabled","type":"bit","not_null":true}]} +{"schema":"sys","name":"identity_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"seed_value","type":"sql_variant"},{"name":"increment_value","type":"sql_variant"},{"name":"last_value","type":"sql_variant"},{"name":"is_not_for_replication","type":"bit"},{"name":"is_computed","type":"bit","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_column_set","type":"bit","not_null":true},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit","not_null":true},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"}]} +{"schema":"sys","name":"index_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"index_column_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"key_ordinal","type":"tinyint","not_null":true},{"name":"partition_ordinal","type":"tinyint","not_null":true},{"name":"is_descending_key","type":"bit"},{"name":"is_included_column","type":"bit"},{"name":"column_store_order_ordinal","type":"tinyint"},{"name":"data_clustering_ordinal","type":"tinyint"}]} +{"schema":"sys","name":"index_resumable_operations","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"sql_text","type":"nvarchar(max)"},{"name":"last_max_dop_used","type":"smallint","not_null":true},{"name":"partition_number","type":"int"},{"name":"state","type":"tinyint","not_null":true},{"name":"state_desc","type":"nvarchar(60)"},{"name":"start_time","type":"datetime","not_null":true},{"name":"last_pause_time","type":"datetime"},{"name":"total_execution_time","type":"int","not_null":true},{"name":"percent_complete","type":"float","not_null":true},{"name":"page_count","type":"bigint","not_null":true}]} +{"schema":"sys","name":"indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int"},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"has_filter","type":"bit"},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"compression_delay","type":"int"},{"name":"suppress_dup_key_messages","type":"bit"},{"name":"auto_created","type":"bit"},{"name":"optimize_for_sequential_key","type":"bit"}]} +{"schema":"sys","name":"information_protection_label_mapping","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(6)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"label_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"internal_partitions","kind":"v","columns":[{"name":"partition_id","type":"bigint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"hobt_id","type":"bigint","not_null":true},{"name":"internal_object_type","type":"tinyint"},{"name":"internal_object_type_desc","type":"nvarchar(60)"},{"name":"row_group_id","type":"int"},{"name":"rows","type":"bigint"},{"name":"data_compression","type":"tinyint"},{"name":"data_compression_desc","type":"nvarchar(60)"},{"name":"xml_compression","type":"bit"},{"name":"xml_compression_desc","type":"varchar(3)"}]} +{"schema":"sys","name":"internal_tables","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"},{"name":"internal_type","type":"tinyint"},{"name":"internal_type_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int"},{"name":"parent_minor_id","type":"int"},{"name":"lob_data_space_id","type":"int","not_null":true},{"name":"filestream_data_space_id","type":"int"}]} +{"schema":"sys","name":"json_index_paths","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"path","type":"varchar(8000)"}]} +{"schema":"sys","name":"json_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"has_filter","type":"bit","not_null":true},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"auto_created","type":"bit"},{"name":"optimize_for_array_search","type":"bit"}]} +{"schema":"sys","name":"key_constraints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"unique_index_id","type":"int"},{"name":"is_system_named","type":"bit","not_null":true},{"name":"is_enforced","type":"bit"}]} +{"schema":"sys","name":"key_encryptions","kind":"v","columns":[{"name":"key_id","type":"int","not_null":true},{"name":"thumbprint","type":"varbinary(32)"},{"name":"crypt_type","type":"char(4)","not_null":true},{"name":"crypt_type_desc","type":"nvarchar(60)"},{"name":"crypt_property","type":"varbinary(max)"}]} +{"schema":"sys","name":"ledger_column_history","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"column_name","type":"nvarchar(128)","not_null":true},{"name":"operation_type","type":"int","not_null":true},{"name":"operation_type_desc","type":"nvarchar(60)"},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"sequence_number","type":"bigint","not_null":true}]} +{"schema":"sys","name":"ledger_table_history","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"schema_name","type":"nvarchar(128)","not_null":true},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"ledger_view_schema_name","type":"nvarchar(128)","not_null":true},{"name":"ledger_view_name","type":"nvarchar(128)","not_null":true},{"name":"operation_type","type":"int","not_null":true},{"name":"operation_type_desc","type":"nvarchar(60)"},{"name":"transaction_id","type":"bigint","not_null":true},{"name":"sequence_number","type":"bigint","not_null":true}]} +{"schema":"sys","name":"linked_logins","kind":"v","columns":[{"name":"server_id","type":"int","not_null":true},{"name":"local_principal_id","type":"int"},{"name":"uses_self_credential","type":"bit","not_null":true},{"name":"remote_name","type":"nvarchar(128)"},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"login_token","kind":"v","columns":[{"name":"principal_id","type":"int"},{"name":"sid","type":"varbinary(85)"},{"name":"name","type":"nvarchar(128)"},{"name":"type","type":"nvarchar(128)"},{"name":"usage","type":"nvarchar(128)"}]} +{"schema":"sys","name":"masked_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"is_non_sql_subscribed","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_dts_replicated","type":"bit"},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_database_collation","type":"bit","not_null":true},{"name":"is_persisted","type":"bit","not_null":true},{"name":"is_computed","type":"bit","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_column_set","type":"bit","not_null":true},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit","not_null":true},{"name":"is_masked","type":"bit"},{"name":"masking_function","type":"nvarchar(4000)"},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit"},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit"}]} +{"schema":"sys","name":"master_files","kind":"v","columns":[{"name":"database_id","type":"int","not_null":true},{"name":"file_id","type":"int","not_null":true},{"name":"file_guid","type":"uniqueidentifier"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"data_space_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"physical_name","type":"nvarchar(260)","not_null":true},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"size","type":"int","not_null":true},{"name":"max_size","type":"int","not_null":true},{"name":"growth","type":"int","not_null":true},{"name":"is_media_read_only","type":"bit","not_null":true},{"name":"is_read_only","type":"bit","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_percent_growth","type":"bit","not_null":true},{"name":"is_name_reserved","type":"bit","not_null":true},{"name":"is_persistent_log_buffer","type":"bit","not_null":true},{"name":"create_lsn","type":"numeric(25,0)"},{"name":"drop_lsn","type":"numeric(25,0)"},{"name":"read_only_lsn","type":"numeric(25,0)"},{"name":"read_write_lsn","type":"numeric(25,0)"},{"name":"differential_base_lsn","type":"numeric(25,0)"},{"name":"differential_base_guid","type":"uniqueidentifier"},{"name":"differential_base_time","type":"datetime"},{"name":"redo_start_lsn","type":"numeric(25,0)"},{"name":"redo_start_fork_guid","type":"uniqueidentifier"},{"name":"redo_target_lsn","type":"numeric(25,0)"},{"name":"redo_target_fork_guid","type":"uniqueidentifier"},{"name":"backup_lsn","type":"numeric(25,0)"},{"name":"credential_id","type":"int"}]} +{"schema":"sys","name":"master_key_passwords","kind":"v","columns":[{"name":"credential_id","type":"int","not_null":true},{"name":"family_guid","type":"uniqueidentifier"}]} +{"schema":"sys","name":"memory_optimized_tables_internal_attributes","kind":"v","columns":[{"name":"object_id","type":"int"},{"name":"xtp_object_id","type":"int","not_null":true},{"name":"type","type":"int"},{"name":"type_desc","type":"nvarchar(60)","not_null":true},{"name":"minor_id","type":"int","not_null":true}]} +{"schema":"sys","name":"message_type_xml_schema_collection_usages","kind":"v","columns":[{"name":"message_type_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true}]} +{"schema":"sys","name":"messages","kind":"v","columns":[{"name":"message_id","type":"int","not_null":true},{"name":"language_id","type":"smallint","not_null":true},{"name":"severity","type":"tinyint"},{"name":"is_event_logged","type":"bit","not_null":true},{"name":"text","type":"nvarchar(2048)","not_null":true}]} +{"schema":"sys","name":"module_assembly_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true}]} +{"schema":"sys","name":"numbered_procedure_parameters","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"procedure_number","type":"smallint","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"is_output","type":"bit","not_null":true},{"name":"is_cursor_ref","type":"bit","not_null":true}]} +{"schema":"sys","name":"numbered_procedures","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"procedure_number","type":"smallint"},{"name":"definition","type":"nvarchar(max)"}]} +{"schema":"sys","name":"objects","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true}]} +{"schema":"sys","name":"openkeys","kind":"v","columns":[{"name":"database_id","type":"int"},{"name":"database_name","type":"nvarchar(128)"},{"name":"key_id","type":"int"},{"name":"key_name","type":"nvarchar(128)"},{"name":"key_guid","type":"uniqueidentifier"},{"name":"opened_date","type":"datetime"},{"name":"status","type":"smallint"}]} +{"schema":"sys","name":"parameter_type_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"parameter_id","type":"int","not_null":true},{"name":"user_type_id","type":"int","not_null":true}]} +{"schema":"sys","name":"parameter_xml_schema_collection_usages","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"parameter_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true}]} +{"schema":"sys","name":"parameters","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"is_output","type":"bit","not_null":true},{"name":"is_cursor_ref","type":"bit","not_null":true},{"name":"has_default_value","type":"bit","not_null":true},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"default_value","type":"sql_variant"},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"is_readonly","type":"bit","not_null":true},{"name":"is_nullable","type":"bit"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"partition_functions","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"function_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"fanout","type":"int","not_null":true},{"name":"boundary_value_on_right","type":"bit","not_null":true},{"name":"is_system","type":"bit","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"partition_parameters","kind":"v","columns":[{"name":"function_id","type":"int","not_null":true},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"user_type_id","type":"int","not_null":true}]} +{"schema":"sys","name":"partition_range_values","kind":"v","columns":[{"name":"function_id","type":"int","not_null":true},{"name":"boundary_id","type":"int","not_null":true},{"name":"parameter_id","type":"int","not_null":true},{"name":"value","type":"sql_variant"}]} +{"schema":"sys","name":"partition_schemes","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"data_space_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_default","type":"bit"},{"name":"is_system","type":"bit"},{"name":"function_id","type":"int","not_null":true}]} +{"schema":"sys","name":"partitions","kind":"v","columns":[{"name":"partition_id","type":"bigint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"hobt_id","type":"bigint","not_null":true},{"name":"rows","type":"bigint"},{"name":"filestream_filegroup_id","type":"smallint","not_null":true},{"name":"data_compression","type":"tinyint","not_null":true},{"name":"data_compression_desc","type":"nvarchar(60)"},{"name":"xml_compression","type":"bit"},{"name":"xml_compression_desc","type":"varchar(3)"}]} +{"schema":"sys","name":"periods","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"period_type","type":"tinyint"},{"name":"period_type_desc","type":"nvarchar(60)"},{"name":"object_id","type":"int","not_null":true},{"name":"start_column_id","type":"int","not_null":true},{"name":"end_column_id","type":"int","not_null":true}]} +{"schema":"sys","name":"plan_guides","kind":"v","columns":[{"name":"plan_guide_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_disabled","type":"bit","not_null":true},{"name":"query_text","type":"nvarchar(max)"},{"name":"scope_type","type":"tinyint","not_null":true},{"name":"scope_type_desc","type":"nvarchar(60)"},{"name":"scope_object_id","type":"int"},{"name":"scope_batch","type":"nvarchar(max)"},{"name":"parameters","type":"nvarchar(max)"},{"name":"hints","type":"nvarchar(max)"}]} +{"schema":"sys","name":"procedures","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"is_auto_executed","type":"bit","not_null":true},{"name":"is_execution_replicated","type":"bit"},{"name":"is_repl_serializable_only","type":"bit"},{"name":"skips_repl_constraints","type":"bit"}]} +{"schema":"sys","name":"query_context_settings","kind":"v","columns":[{"name":"context_settings_id","type":"bigint","not_null":true},{"name":"set_options","type":"varbinary(8)"},{"name":"language_id","type":"smallint","not_null":true},{"name":"date_format","type":"smallint","not_null":true},{"name":"date_first","type":"tinyint","not_null":true},{"name":"status","type":"varbinary(2)"},{"name":"required_cursor_options","type":"int","not_null":true},{"name":"acceptable_cursor_options","type":"int","not_null":true},{"name":"merge_action_type","type":"smallint","not_null":true},{"name":"default_schema_id","type":"int","not_null":true},{"name":"is_replication_specific","type":"bit","not_null":true},{"name":"is_contained","type":"varbinary(1)"}]} +{"schema":"sys","name":"query_store_plan","kind":"v","columns":[{"name":"plan_id","type":"bigint","not_null":true},{"name":"query_id","type":"bigint","not_null":true},{"name":"plan_group_id","type":"bigint"},{"name":"engine_version","type":"nvarchar(32)"},{"name":"compatibility_level","type":"smallint","not_null":true},{"name":"query_plan_hash","type":"binary(8)","not_null":true},{"name":"query_plan","type":"nvarchar(max)"},{"name":"is_online_index_plan","type":"bit","not_null":true},{"name":"is_trivial_plan","type":"bit","not_null":true},{"name":"is_parallel_plan","type":"bit","not_null":true},{"name":"is_forced_plan","type":"bit","not_null":true},{"name":"is_natively_compiled","type":"bit","not_null":true},{"name":"force_failure_count","type":"bigint","not_null":true},{"name":"last_force_failure_reason","type":"int","not_null":true},{"name":"last_force_failure_reason_desc","type":"nvarchar(128)"},{"name":"count_compiles","type":"bigint"},{"name":"initial_compile_start_time","type":"datetimeoffset(7)","not_null":true},{"name":"last_compile_start_time","type":"datetimeoffset(7)"},{"name":"last_execution_time","type":"datetimeoffset(7)"},{"name":"avg_compile_duration","type":"float"},{"name":"last_compile_duration","type":"bigint"},{"name":"plan_forcing_type","type":"int","not_null":true},{"name":"plan_forcing_type_desc","type":"nvarchar(60)"},{"name":"has_compile_replay_script","type":"bit","not_null":true},{"name":"is_optimized_plan_forcing_disabled","type":"bit","not_null":true},{"name":"plan_type","type":"int","not_null":true},{"name":"plan_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"query_store_plan_feedback","kind":"v","columns":[{"name":"plan_feedback_id","type":"bigint","not_null":true},{"name":"plan_id","type":"bigint","not_null":true},{"name":"feature_id","type":"tinyint","not_null":true},{"name":"feature_desc","type":"nvarchar(60)"},{"name":"feedback_data","type":"nvarchar(max)"},{"name":"state","type":"int"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"create_time","type":"datetimeoffset(7)","not_null":true},{"name":"last_updated_time","type":"datetimeoffset(7)"},{"name":"replica_group_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"query_store_plan_forcing_locations","kind":"v","columns":[{"name":"plan_forcing_location_id","type":"bigint","not_null":true},{"name":"query_id","type":"bigint","not_null":true},{"name":"plan_id","type":"bigint","not_null":true},{"name":"replica_group_id","type":"bigint","not_null":true},{"name":"timestamp","type":"datetime","not_null":true},{"name":"plan_forcing_type","type":"int","not_null":true},{"name":"plan_forcing_type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"query_store_query","kind":"v","columns":[{"name":"query_id","type":"bigint","not_null":true},{"name":"query_text_id","type":"bigint","not_null":true},{"name":"context_settings_id","type":"bigint","not_null":true},{"name":"object_id","type":"bigint"},{"name":"batch_sql_handle","type":"varbinary(44)"},{"name":"query_hash","type":"binary(8)","not_null":true},{"name":"is_internal_query","type":"bit","not_null":true},{"name":"query_parameterization_type","type":"tinyint","not_null":true},{"name":"query_parameterization_type_desc","type":"nvarchar(60)"},{"name":"initial_compile_start_time","type":"datetimeoffset(7)","not_null":true},{"name":"last_compile_start_time","type":"datetimeoffset(7)"},{"name":"last_execution_time","type":"datetimeoffset(7)"},{"name":"last_compile_batch_sql_handle","type":"varbinary(44)"},{"name":"last_compile_batch_offset_start","type":"bigint"},{"name":"last_compile_batch_offset_end","type":"bigint"},{"name":"count_compiles","type":"bigint"},{"name":"avg_compile_duration","type":"float"},{"name":"last_compile_duration","type":"bigint"},{"name":"avg_bind_duration","type":"float"},{"name":"last_bind_duration","type":"bigint"},{"name":"avg_bind_cpu_time","type":"float"},{"name":"last_bind_cpu_time","type":"bigint"},{"name":"avg_optimize_duration","type":"float"},{"name":"last_optimize_duration","type":"bigint"},{"name":"avg_optimize_cpu_time","type":"float"},{"name":"last_optimize_cpu_time","type":"bigint"},{"name":"avg_compile_memory_kb","type":"float"},{"name":"last_compile_memory_kb","type":"bigint"},{"name":"max_compile_memory_kb","type":"bigint"},{"name":"is_clouddb_internal_query","type":"bit"}]} +{"schema":"sys","name":"query_store_query_hints","kind":"v","columns":[{"name":"query_hint_id","type":"bigint","not_null":true},{"name":"query_id","type":"bigint","not_null":true},{"name":"replica_group_id","type":"bigint","not_null":true},{"name":"query_hint_text","type":"nvarchar(max)"},{"name":"last_query_hint_failure_reason","type":"int","not_null":true},{"name":"last_query_hint_failure_reason_desc","type":"nvarchar(128)"},{"name":"query_hint_failure_count","type":"bigint","not_null":true},{"name":"source","type":"int"},{"name":"source_desc","type":"nvarchar(128)"},{"name":"comment","type":"nvarchar(max)"}]} +{"schema":"sys","name":"query_store_query_text","kind":"v","columns":[{"name":"query_text_id","type":"bigint","not_null":true},{"name":"query_sql_text","type":"nvarchar(max)"},{"name":"statement_sql_handle","type":"varbinary(44)"},{"name":"is_part_of_encrypted_module","type":"bit","not_null":true},{"name":"has_restricted_text","type":"bit","not_null":true}]} +{"schema":"sys","name":"query_store_query_variant","kind":"v","columns":[{"name":"query_variant_query_id","type":"bigint","not_null":true},{"name":"parent_query_id","type":"bigint","not_null":true},{"name":"dispatcher_plan_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"query_store_replicas","kind":"v","columns":[{"name":"replica_group_id","type":"bigint","not_null":true},{"name":"role_type","type":"smallint","not_null":true},{"name":"replica_name","type":"nvarchar(644)"}]} +{"schema":"sys","name":"query_store_runtime_stats","kind":"v","columns":[{"name":"runtime_stats_id","type":"bigint","not_null":true},{"name":"plan_id","type":"bigint","not_null":true},{"name":"runtime_stats_interval_id","type":"bigint","not_null":true},{"name":"execution_type","type":"tinyint","not_null":true},{"name":"execution_type_desc","type":"nvarchar(60)"},{"name":"first_execution_time","type":"datetimeoffset(7)","not_null":true},{"name":"last_execution_time","type":"datetimeoffset(7)","not_null":true},{"name":"count_executions","type":"bigint","not_null":true},{"name":"avg_duration","type":"float"},{"name":"last_duration","type":"bigint","not_null":true},{"name":"min_duration","type":"bigint","not_null":true},{"name":"max_duration","type":"bigint","not_null":true},{"name":"stdev_duration","type":"float"},{"name":"avg_cpu_time","type":"float"},{"name":"last_cpu_time","type":"bigint","not_null":true},{"name":"min_cpu_time","type":"bigint","not_null":true},{"name":"max_cpu_time","type":"bigint","not_null":true},{"name":"stdev_cpu_time","type":"float"},{"name":"avg_logical_io_reads","type":"float"},{"name":"last_logical_io_reads","type":"bigint","not_null":true},{"name":"min_logical_io_reads","type":"bigint","not_null":true},{"name":"max_logical_io_reads","type":"bigint","not_null":true},{"name":"stdev_logical_io_reads","type":"float"},{"name":"avg_logical_io_writes","type":"float"},{"name":"last_logical_io_writes","type":"bigint","not_null":true},{"name":"min_logical_io_writes","type":"bigint","not_null":true},{"name":"max_logical_io_writes","type":"bigint","not_null":true},{"name":"stdev_logical_io_writes","type":"float"},{"name":"avg_physical_io_reads","type":"float"},{"name":"last_physical_io_reads","type":"bigint","not_null":true},{"name":"min_physical_io_reads","type":"bigint","not_null":true},{"name":"max_physical_io_reads","type":"bigint","not_null":true},{"name":"stdev_physical_io_reads","type":"float"},{"name":"avg_clr_time","type":"float"},{"name":"last_clr_time","type":"bigint","not_null":true},{"name":"min_clr_time","type":"bigint","not_null":true},{"name":"max_clr_time","type":"bigint","not_null":true},{"name":"stdev_clr_time","type":"float"},{"name":"avg_dop","type":"float"},{"name":"last_dop","type":"bigint","not_null":true},{"name":"min_dop","type":"bigint","not_null":true},{"name":"max_dop","type":"bigint","not_null":true},{"name":"stdev_dop","type":"float"},{"name":"avg_query_max_used_memory","type":"float"},{"name":"last_query_max_used_memory","type":"bigint","not_null":true},{"name":"min_query_max_used_memory","type":"bigint","not_null":true},{"name":"max_query_max_used_memory","type":"bigint","not_null":true},{"name":"stdev_query_max_used_memory","type":"float"},{"name":"avg_rowcount","type":"float"},{"name":"last_rowcount","type":"bigint","not_null":true},{"name":"min_rowcount","type":"bigint","not_null":true},{"name":"max_rowcount","type":"bigint","not_null":true},{"name":"stdev_rowcount","type":"float"},{"name":"avg_num_physical_io_reads","type":"float"},{"name":"last_num_physical_io_reads","type":"bigint"},{"name":"min_num_physical_io_reads","type":"bigint"},{"name":"max_num_physical_io_reads","type":"bigint"},{"name":"stdev_num_physical_io_reads","type":"float"},{"name":"avg_log_bytes_used","type":"float"},{"name":"last_log_bytes_used","type":"bigint"},{"name":"min_log_bytes_used","type":"bigint"},{"name":"max_log_bytes_used","type":"bigint"},{"name":"stdev_log_bytes_used","type":"float"},{"name":"avg_tempdb_space_used","type":"float"},{"name":"last_tempdb_space_used","type":"bigint"},{"name":"min_tempdb_space_used","type":"bigint"},{"name":"max_tempdb_space_used","type":"bigint"},{"name":"stdev_tempdb_space_used","type":"float"},{"name":"avg_page_server_io_reads","type":"float"},{"name":"last_page_server_io_reads","type":"bigint"},{"name":"min_page_server_io_reads","type":"bigint"},{"name":"max_page_server_io_reads","type":"bigint"},{"name":"stdev_page_server_io_reads","type":"float"},{"name":"replica_group_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"query_store_runtime_stats_interval","kind":"v","columns":[{"name":"runtime_stats_interval_id","type":"bigint","not_null":true},{"name":"start_time","type":"datetimeoffset(7)","not_null":true},{"name":"end_time","type":"datetimeoffset(7)","not_null":true},{"name":"comment","type":"nvarchar(max)"}]} +{"schema":"sys","name":"query_store_wait_stats","kind":"v","columns":[{"name":"wait_stats_id","type":"bigint","not_null":true},{"name":"plan_id","type":"bigint","not_null":true},{"name":"runtime_stats_interval_id","type":"bigint","not_null":true},{"name":"wait_category","type":"smallint","not_null":true},{"name":"wait_category_desc","type":"nvarchar(60)"},{"name":"execution_type","type":"tinyint","not_null":true},{"name":"execution_type_desc","type":"nvarchar(60)"},{"name":"total_query_wait_time_ms","type":"bigint","not_null":true},{"name":"avg_query_wait_time_ms","type":"float"},{"name":"last_query_wait_time_ms","type":"bigint","not_null":true},{"name":"min_query_wait_time_ms","type":"bigint","not_null":true},{"name":"max_query_wait_time_ms","type":"bigint","not_null":true},{"name":"stdev_query_wait_time_ms","type":"float"},{"name":"replica_group_id","type":"bigint","not_null":true}]} +{"schema":"sys","name":"registered_search_properties","kind":"v","columns":[{"name":"property_list_id","type":"int","not_null":true},{"name":"property_id","type":"int","not_null":true},{"name":"property_name","type":"nvarchar(256)","not_null":true},{"name":"property_set_guid","type":"uniqueidentifier","not_null":true},{"name":"property_int_id","type":"int","not_null":true},{"name":"property_description","type":"nvarchar(512)"}]} +{"schema":"sys","name":"registered_search_property_lists","kind":"v","columns":[{"name":"property_list_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"remote_data_archive_databases","kind":"v","columns":[{"name":"remote_database_id","type":"int","not_null":true},{"name":"remote_database_name","type":"nvarchar(128)","not_null":true},{"name":"data_source_id","type":"int","not_null":true},{"name":"federated_service_account","type":"bit"}]} +{"schema":"sys","name":"remote_data_archive_tables","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"remote_database_id","type":"int","not_null":true},{"name":"remote_table_name","type":"nvarchar(128)"},{"name":"filter_predicate","type":"nvarchar(max)"},{"name":"migration_direction","type":"tinyint"},{"name":"migration_direction_desc","type":"nvarchar(60)"},{"name":"is_migration_paused","type":"bit"},{"name":"is_reconciled","type":"bit"}]} +{"schema":"sys","name":"remote_logins","kind":"v","columns":[{"name":"server_id","type":"int","not_null":true},{"name":"remote_name","type":"nvarchar(128)"},{"name":"local_principal_id","type":"int"},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"remote_service_bindings","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"remote_service_binding_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"remote_service_name","type":"nvarchar(256)"},{"name":"service_contract_id","type":"int","not_null":true},{"name":"remote_principal_id","type":"int"},{"name":"is_anonymous_on","type":"bit","not_null":true}]} +{"schema":"sys","name":"resource_governor_configuration","kind":"v","columns":[{"name":"classifier_function_id","type":"int","not_null":true},{"name":"is_enabled","type":"bit","not_null":true},{"name":"max_outstanding_io_per_volume","type":"int","not_null":true}]} +{"schema":"sys","name":"resource_governor_external_resource_pool_affinity","kind":"v","columns":[{"name":"external_pool_id","type":"int","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"cpu_mask","type":"bigint","not_null":true}]} +{"schema":"sys","name":"resource_governor_external_resource_pools","kind":"v","columns":[{"name":"external_pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"max_cpu_percent","type":"int","not_null":true},{"name":"max_memory_percent","type":"int","not_null":true},{"name":"max_processes","type":"int","not_null":true},{"name":"version","type":"bigint","not_null":true}]} +{"schema":"sys","name":"resource_governor_resource_pool_affinity","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"processor_group","type":"smallint","not_null":true},{"name":"scheduler_mask","type":"bigint","not_null":true}]} +{"schema":"sys","name":"resource_governor_resource_pools","kind":"v","columns":[{"name":"pool_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"min_cpu_percent","type":"int","not_null":true},{"name":"max_cpu_percent","type":"int","not_null":true},{"name":"min_memory_percent","type":"int","not_null":true},{"name":"max_memory_percent","type":"int","not_null":true},{"name":"cap_cpu_percent","type":"int","not_null":true},{"name":"min_iops_per_volume","type":"int","not_null":true},{"name":"max_iops_per_volume","type":"int","not_null":true}]} +{"schema":"sys","name":"resource_governor_workload_groups","kind":"v","columns":[{"name":"group_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"importance","type":"nvarchar(128)","not_null":true},{"name":"request_max_memory_grant_percent","type":"int","not_null":true},{"name":"request_max_cpu_time_sec","type":"int","not_null":true},{"name":"request_memory_grant_timeout_sec","type":"int","not_null":true},{"name":"max_dop","type":"int","not_null":true},{"name":"group_max_requests","type":"int","not_null":true},{"name":"pool_id","type":"int","not_null":true},{"name":"external_pool_id","type":"int","not_null":true},{"name":"request_max_memory_grant_percent_numeric","type":"float","not_null":true},{"name":"group_max_tempdb_data_percent","type":"float"},{"name":"group_max_tempdb_data_mb","type":"float"}]} +{"schema":"sys","name":"routes","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"route_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"remote_service_name","type":"nvarchar(256)"},{"name":"broker_instance","type":"nvarchar(128)"},{"name":"lifetime","type":"datetime"},{"name":"address","type":"nvarchar(256)"},{"name":"mirror_address","type":"nvarchar(256)"}]} +{"schema":"sys","name":"schemas","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"securable_classes","kind":"v","columns":[{"name":"class_desc","type":"nvarchar(60)"},{"name":"class","type":"int"}]} +{"schema":"sys","name":"security_policies","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_enabled","type":"bit","not_null":true},{"name":"is_not_for_replication","type":"bit","not_null":true},{"name":"uses_database_collation","type":"bit"},{"name":"is_schema_bound","type":"bit","not_null":true}]} +{"schema":"sys","name":"security_predicates","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"security_predicate_id","type":"int","not_null":true},{"name":"target_object_id","type":"int","not_null":true},{"name":"predicate_definition","type":"nvarchar(max)"},{"name":"predicate_type","type":"int"},{"name":"predicate_type_desc","type":"nvarchar(60)"},{"name":"operation","type":"int"},{"name":"operation_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"selective_xml_index_namespaces","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"is_default_uri","type":"bit"},{"name":"uri","type":"nvarchar(4000)"},{"name":"prefix","type":"nvarchar(128)"}]} +{"schema":"sys","name":"selective_xml_index_paths","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"path_id","type":"int"},{"name":"path","type":"nvarchar(4000)"},{"name":"name","type":"nvarchar(128)"},{"name":"path_type","type":"tinyint"},{"name":"path_type_desc","type":"nvarchar(128)"},{"name":"xml_component_id","type":"int"},{"name":"xquery_type_description","type":"nvarchar(4000)"},{"name":"is_xquery_type_inferred","type":"bit"},{"name":"xquery_max_length","type":"int"},{"name":"is_xquery_max_length_inferred","type":"bit"},{"name":"is_node","type":"bit"},{"name":"system_type_id","type":"tinyint"},{"name":"user_type_id","type":"tinyint"},{"name":"max_length","type":"smallint"},{"name":"precision","type":"tinyint"},{"name":"scale","type":"tinyint"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_singleton","type":"bit"}]} +{"schema":"sys","name":"sensitivity_classifications","kind":"v","columns":[{"name":"class","type":"int","not_null":true},{"name":"class_desc","type":"varchar(16)","not_null":true},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"label","type":"nvarchar(128)"},{"name":"label_id","type":"nvarchar(128)"},{"name":"information_type","type":"nvarchar(128)"},{"name":"information_type_id","type":"nvarchar(128)"},{"name":"rank","type":"int"},{"name":"rank_desc","type":"varchar(8)"}]} +{"schema":"sys","name":"sequences","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"start_value","type":"sql_variant","not_null":true},{"name":"increment","type":"sql_variant","not_null":true},{"name":"minimum_value","type":"sql_variant","not_null":true},{"name":"maximum_value","type":"sql_variant","not_null":true},{"name":"is_cycling","type":"bit"},{"name":"is_cached","type":"bit"},{"name":"cache_size","type":"int"},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint"},{"name":"current_value","type":"sql_variant","not_null":true},{"name":"is_exhausted","type":"bit","not_null":true},{"name":"last_used_value","type":"sql_variant"}]} +{"schema":"sys","name":"server_assembly_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true},{"name":"assembly_class","type":"nvarchar(128)"},{"name":"assembly_method","type":"nvarchar(128)"},{"name":"execute_as_principal_id","type":"int"}]} +{"schema":"sys","name":"server_audit_specification_details","kind":"v","columns":[{"name":"server_specification_id","type":"int","not_null":true},{"name":"audit_action_id","type":"char(4)","not_null":true},{"name":"audit_action_name","type":"nvarchar(60)"},{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"audited_principal_id","type":"int","not_null":true},{"name":"audited_result","type":"nvarchar(60)"},{"name":"is_group","type":"bit"}]} +{"schema":"sys","name":"server_audit_specifications","kind":"v","columns":[{"name":"server_specification_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"audit_guid","type":"uniqueidentifier"},{"name":"is_state_enabled","type":"bit"},{"name":"is_session_context_enabled","type":"bit"},{"name":"session_context_keys","type":"nvarchar(max)"}]} +{"schema":"sys","name":"server_audits","kind":"v","columns":[{"name":"audit_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"audit_guid","type":"uniqueidentifier"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"on_failure","type":"tinyint"},{"name":"on_failure_desc","type":"nvarchar(60)"},{"name":"is_state_enabled","type":"bit"},{"name":"queue_delay","type":"int"},{"name":"predicate","type":"nvarchar(3000)"},{"name":"is_operator_audit","type":"bit"}]} +{"schema":"sys","name":"server_event_notifications","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"parent_class","type":"tinyint","not_null":true},{"name":"parent_class_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"service_name","type":"nvarchar(256)"},{"name":"broker_instance","type":"nvarchar(128)"},{"name":"creator_sid","type":"varbinary(85)"},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"server_event_session_actions","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"event_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"package","type":"nvarchar(128)"},{"name":"module","type":"nvarchar(128)"}]} +{"schema":"sys","name":"server_event_session_events","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"event_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"package","type":"nvarchar(128)"},{"name":"module","type":"nvarchar(128)"},{"name":"predicate","type":"nvarchar(3000)"},{"name":"predicate_xml","type":"nvarchar(max)"}]} +{"schema":"sys","name":"server_event_session_fields","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"value","type":"sql_variant"}]} +{"schema":"sys","name":"server_event_session_targets","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"target_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"package","type":"nvarchar(128)"},{"name":"module","type":"nvarchar(128)"}]} +{"schema":"sys","name":"server_event_sessions","kind":"v","columns":[{"name":"event_session_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"event_retention_mode","type":"char(1)"},{"name":"event_retention_mode_desc","type":"nvarchar(60)"},{"name":"max_dispatch_latency","type":"int"},{"name":"max_memory","type":"int"},{"name":"max_event_size","type":"int"},{"name":"memory_partition_mode","type":"char(1)"},{"name":"memory_partition_mode_desc","type":"nvarchar(60)"},{"name":"track_causality","type":"bit"},{"name":"startup_state","type":"bit"},{"name":"has_long_running_target","type":"bit"},{"name":"max_duration","type":"bigint"}]} +{"schema":"sys","name":"server_events","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"type_desc","type":"nvarchar(128)","not_null":true},{"name":"is_trigger_event","type":"bit"},{"name":"event_group_type","type":"int"},{"name":"event_group_type_desc","type":"nvarchar(128)"}]} +{"schema":"sys","name":"server_file_audits","kind":"v","columns":[{"name":"audit_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"audit_guid","type":"uniqueidentifier"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"principal_id","type":"int"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"on_failure","type":"tinyint"},{"name":"on_failure_desc","type":"nvarchar(60)"},{"name":"is_state_enabled","type":"bit"},{"name":"queue_delay","type":"int"},{"name":"predicate","type":"nvarchar(3000)"},{"name":"max_file_size","type":"bigint"},{"name":"max_rollover_files","type":"int"},{"name":"max_files","type":"int"},{"name":"reserve_disk_space","type":"bit"},{"name":"log_file_path","type":"nvarchar(260)"},{"name":"log_file_name","type":"nvarchar(260)"},{"name":"retention_days","type":"int"}]} +{"schema":"sys","name":"server_memory_optimized_hybrid_buffer_pool_configuration","kind":"v","columns":[{"name":"is_configured","type":"sql_variant"},{"name":"is_enabled","type":"sql_variant"}]} +{"schema":"sys","name":"server_permissions","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"major_id","type":"int","not_null":true},{"name":"minor_id","type":"int","not_null":true},{"name":"grantee_principal_id","type":"int","not_null":true},{"name":"grantor_principal_id","type":"int","not_null":true},{"name":"type","type":"char(4)","not_null":true},{"name":"permission_name","type":"nvarchar(128)"},{"name":"state","type":"char(1)","not_null":true},{"name":"state_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"server_principal_credentials","kind":"v","columns":[{"name":"principal_id","type":"int","not_null":true},{"name":"credential_id","type":"int","not_null":true}]} +{"schema":"sys","name":"server_principals","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"sid","type":"varbinary(85)"},{"name":"type","type":"char(1)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_disabled","type":"bit"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"default_database_name","type":"nvarchar(128)"},{"name":"default_language_name","type":"nvarchar(128)"},{"name":"credential_id","type":"int"},{"name":"owning_principal_id","type":"int"},{"name":"is_fixed_role","type":"bit","not_null":true},{"name":"tenant_id","type":"uniqueidentifier"}]} +{"schema":"sys","name":"server_role_members","kind":"v","columns":[{"name":"role_principal_id","type":"int","not_null":true},{"name":"member_principal_id","type":"int","not_null":true}]} +{"schema":"sys","name":"server_sql_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"uses_quoted_identifier","type":"bit"},{"name":"execute_as_principal_id","type":"int"}]} +{"schema":"sys","name":"server_trigger_events","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"type_desc","type":"nvarchar(128)","not_null":true},{"name":"is_trigger_event","type":"bit"},{"name":"is_first","type":"bit"},{"name":"is_last","type":"bit"},{"name":"event_group_type","type":"int"},{"name":"event_group_type_desc","type":"nvarchar(128)"}]} +{"schema":"sys","name":"server_triggers","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"parent_class","type":"tinyint","not_null":true},{"name":"parent_class_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_disabled","type":"bit","not_null":true}]} +{"schema":"sys","name":"servers","kind":"v","columns":[{"name":"server_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"product","type":"nvarchar(128)","not_null":true},{"name":"provider","type":"nvarchar(128)","not_null":true},{"name":"data_source","type":"nvarchar(4000)"},{"name":"location","type":"nvarchar(4000)"},{"name":"provider_string","type":"nvarchar(4000)"},{"name":"catalog","type":"nvarchar(128)"},{"name":"connect_timeout","type":"int"},{"name":"query_timeout","type":"int"},{"name":"is_linked","type":"bit","not_null":true},{"name":"is_remote_login_enabled","type":"bit","not_null":true},{"name":"is_rpc_out_enabled","type":"bit","not_null":true},{"name":"is_data_access_enabled","type":"bit","not_null":true},{"name":"is_collation_compatible","type":"bit","not_null":true},{"name":"uses_remote_collation","type":"bit","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"lazy_schema_validation","type":"bit","not_null":true},{"name":"is_system","type":"bit","not_null":true},{"name":"is_publisher","type":"bit","not_null":true},{"name":"is_subscriber","type":"bit"},{"name":"is_distributor","type":"bit"},{"name":"is_nonsql_subscriber","type":"bit"},{"name":"is_remote_proc_transaction_promotion_enabled","type":"bit"},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_rda_server","type":"bit"}]} +{"schema":"sys","name":"service_broker_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"is_message_forwarding_enabled","type":"bit","not_null":true},{"name":"message_forwarding_size","type":"int","not_null":true},{"name":"connection_auth","type":"tinyint","not_null":true},{"name":"connection_auth_desc","type":"nvarchar(60)"},{"name":"certificate_id","type":"int","not_null":true},{"name":"encryption_algorithm","type":"tinyint","not_null":true},{"name":"encryption_algorithm_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"service_contract_message_usages","kind":"v","columns":[{"name":"service_contract_id","type":"int","not_null":true},{"name":"message_type_id","type":"int","not_null":true},{"name":"is_sent_by_initiator","type":"bit","not_null":true},{"name":"is_sent_by_target","type":"bit","not_null":true}]} +{"schema":"sys","name":"service_contract_usages","kind":"v","columns":[{"name":"service_id","type":"int","not_null":true},{"name":"service_contract_id","type":"int","not_null":true}]} +{"schema":"sys","name":"service_contracts","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"service_contract_id","type":"int","not_null":true},{"name":"principal_id","type":"int"}]} +{"schema":"sys","name":"service_message_types","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"message_type_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"validation","type":"char(2)","not_null":true},{"name":"validation_desc","type":"nvarchar(60)"},{"name":"xml_collection_id","type":"int"}]} +{"schema":"sys","name":"service_queue_usages","kind":"v","columns":[{"name":"service_id","type":"int","not_null":true},{"name":"service_queue_id","type":"int","not_null":true}]} +{"schema":"sys","name":"service_queues","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"max_readers","type":"smallint"},{"name":"activation_procedure","type":"nvarchar(776)"},{"name":"execute_as_principal_id","type":"int"},{"name":"is_activation_enabled","type":"bit","not_null":true},{"name":"is_receive_enabled","type":"bit","not_null":true},{"name":"is_enqueue_enabled","type":"bit","not_null":true},{"name":"is_retention_enabled","type":"bit","not_null":true},{"name":"is_poison_message_handling_enabled","type":"bit"}]} +{"schema":"sys","name":"services","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"service_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"service_queue_id","type":"int","not_null":true}]} +{"schema":"sys","name":"soap_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"is_sql_language_enabled","type":"bit","not_null":true},{"name":"wsdl_generator_procedure","type":"nvarchar(776)"},{"name":"default_database","type":"nvarchar(128)"},{"name":"default_namespace","type":"nvarchar(384)"},{"name":"default_result_schema","type":"tinyint"},{"name":"default_result_schema_desc","type":"nvarchar(60)"},{"name":"is_xml_charset_enforced","type":"bit","not_null":true},{"name":"is_session_enabled","type":"bit","not_null":true},{"name":"session_timeout","type":"int","not_null":true},{"name":"login_type","type":"nvarchar(60)"},{"name":"header_limit","type":"int","not_null":true}]} +{"schema":"sys","name":"spatial_index_tessellations","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"tessellation_scheme","type":"nvarchar(60)"},{"name":"bounding_box_xmin","type":"float"},{"name":"bounding_box_ymin","type":"float"},{"name":"bounding_box_xmax","type":"float"},{"name":"bounding_box_ymax","type":"float"},{"name":"level_1_grid","type":"smallint"},{"name":"level_1_grid_desc","type":"nvarchar(60)"},{"name":"level_2_grid","type":"smallint"},{"name":"level_2_grid_desc","type":"nvarchar(60)"},{"name":"level_3_grid","type":"smallint"},{"name":"level_3_grid_desc","type":"nvarchar(60)"},{"name":"level_4_grid","type":"smallint"},{"name":"level_4_grid_desc","type":"nvarchar(60)"},{"name":"cells_per_object","type":"int"}]} +{"schema":"sys","name":"spatial_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"spatial_index_type","type":"int","not_null":true},{"name":"spatial_index_type_desc","type":"nvarchar(60)"},{"name":"tessellation_scheme","type":"nvarchar(60)"},{"name":"has_filter","type":"bit","not_null":true},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"auto_created","type":"bit"}]} +{"schema":"sys","name":"spatial_reference_systems","kind":"v","columns":[{"name":"spatial_reference_id","type":"int"},{"name":"authority_name","type":"nvarchar(128)"},{"name":"authorized_spatial_reference_id","type":"int"},{"name":"well_known_text","type":"nvarchar(4000)"},{"name":"unit_of_measure","type":"nvarchar(128)"},{"name":"unit_conversion_factor","type":"float"}]} +{"schema":"sys","name":"sql_dependencies","kind":"v","columns":[{"name":"class","type":"tinyint","not_null":true},{"name":"class_desc","type":"nvarchar(60)"},{"name":"object_id","type":"int","not_null":true},{"name":"column_id","type":"int","not_null":true},{"name":"referenced_major_id","type":"int","not_null":true},{"name":"referenced_minor_id","type":"int","not_null":true},{"name":"is_selected","type":"bit","not_null":true},{"name":"is_updated","type":"bit","not_null":true},{"name":"is_select_all","type":"bit","not_null":true}]} +{"schema":"sys","name":"sql_expression_dependencies","kind":"v","columns":[{"name":"referencing_id","type":"int","not_null":true},{"name":"referencing_minor_id","type":"int","not_null":true},{"name":"referencing_class","type":"tinyint"},{"name":"referencing_class_desc","type":"nvarchar(60)"},{"name":"is_schema_bound_reference","type":"bit","not_null":true},{"name":"referenced_class","type":"tinyint"},{"name":"referenced_class_desc","type":"nvarchar(60)"},{"name":"referenced_server_name","type":"nvarchar(128)"},{"name":"referenced_database_name","type":"nvarchar(128)"},{"name":"referenced_schema_name","type":"nvarchar(128)"},{"name":"referenced_entity_name","type":"nvarchar(128)"},{"name":"referenced_id","type":"int"},{"name":"referenced_minor_id","type":"int","not_null":true},{"name":"is_caller_dependent","type":"bit","not_null":true},{"name":"is_ambiguous","type":"bit","not_null":true}]} +{"schema":"sys","name":"sql_logins","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int","not_null":true},{"name":"sid","type":"varbinary(85)"},{"name":"type","type":"char(1)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_disabled","type":"bit"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"default_database_name","type":"nvarchar(128)"},{"name":"default_language_name","type":"nvarchar(128)"},{"name":"credential_id","type":"int"},{"name":"is_policy_checked","type":"bit"},{"name":"is_expiration_checked","type":"bit"},{"name":"password_hash","type":"varbinary(256)"}]} +{"schema":"sys","name":"sql_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_ansi_nulls","type":"bit"},{"name":"uses_quoted_identifier","type":"bit"},{"name":"is_schema_bound","type":"bit"},{"name":"uses_database_collation","type":"bit"},{"name":"is_recompiled","type":"bit"},{"name":"null_on_null_input","type":"bit"},{"name":"execute_as_principal_id","type":"int"},{"name":"uses_native_compilation","type":"bit"},{"name":"inline_type","type":"bit"},{"name":"is_inlineable","type":"bit"}]} +{"schema":"sys","name":"stats","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"stats_id","type":"int","not_null":true},{"name":"auto_created","type":"bit"},{"name":"user_created","type":"bit"},{"name":"no_recompute","type":"bit"},{"name":"has_filter","type":"bit"},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"is_temporary","type":"bit"},{"name":"is_incremental","type":"bit"},{"name":"has_persisted_sample","type":"bit"},{"name":"stats_generation_method","type":"int","not_null":true},{"name":"stats_generation_method_desc","type":"varchar(80)","not_null":true},{"name":"auto_drop","type":"bit"},{"name":"replica_role_id","type":"tinyint"},{"name":"replica_role_desc","type":"nvarchar(60)"},{"name":"replica_name","type":"nvarchar(128)"}]} +{"schema":"sys","name":"stats_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"stats_id","type":"int","not_null":true},{"name":"stats_column_id","type":"int"},{"name":"column_id","type":"int"}]} +{"schema":"sys","name":"symmetric_keys","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"principal_id","type":"int"},{"name":"symmetric_key_id","type":"int","not_null":true},{"name":"key_length","type":"int","not_null":true},{"name":"key_algorithm","type":"char(2)","not_null":true},{"name":"algorithm_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"key_guid","type":"uniqueidentifier"},{"name":"key_thumbprint","type":"sql_variant"},{"name":"provider_type","type":"nvarchar(60)"},{"name":"cryptographic_provider_guid","type":"uniqueidentifier"},{"name":"cryptographic_provider_algid","type":"sql_variant"}]} +{"schema":"sys","name":"synonyms","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"base_object_name","type":"nvarchar(1035)"}]} +{"schema":"sys","name":"sysaltfiles","kind":"v","columns":[{"name":"fileid","type":"smallint"},{"name":"groupid","type":"smallint"},{"name":"size","type":"int","not_null":true},{"name":"maxsize","type":"int","not_null":true},{"name":"growth","type":"int","not_null":true},{"name":"status","type":"int"},{"name":"perf","type":"int"},{"name":"dbid","type":"smallint"},{"name":"name","type":"nvarchar(128)"},{"name":"filename","type":"nvarchar(260)"}]} +{"schema":"sys","name":"syscacheobjects","kind":"v","columns":[{"name":"bucketid","type":"int","not_null":true},{"name":"cacheobjtype","type":"nvarchar(50)","not_null":true},{"name":"objtype","type":"nvarchar(20)","not_null":true},{"name":"objid","type":"int"},{"name":"dbid","type":"smallint"},{"name":"dbidexec","type":"smallint"},{"name":"uid","type":"smallint"},{"name":"refcounts","type":"int","not_null":true},{"name":"usecounts","type":"int","not_null":true},{"name":"pagesused","type":"int"},{"name":"setopts","type":"int"},{"name":"langid","type":"smallint"},{"name":"dateformat","type":"smallint"},{"name":"status","type":"int"},{"name":"lasttime","type":"bigint"},{"name":"maxexectime","type":"bigint"},{"name":"avgexectime","type":"bigint"},{"name":"lastreads","type":"bigint"},{"name":"lastwrites","type":"bigint"},{"name":"sqlbytes","type":"int"},{"name":"sql","type":"nvarchar(3900)"}]} +{"schema":"sys","name":"syscharsets","kind":"v","columns":[{"name":"type","type":"smallint","not_null":true},{"name":"id","type":"tinyint","not_null":true},{"name":"csid","type":"tinyint","not_null":true},{"name":"status","type":"smallint"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"description","type":"nvarchar(255)","not_null":true},{"name":"binarydefinition","type":"varbinary(6000)"},{"name":"definition","type":"image"}]} +{"schema":"sys","name":"syscolumns","kind":"v","columns":[{"name":"name","type":"nvarchar(128)"},{"name":"id","type":"int","not_null":true},{"name":"xtype","type":"tinyint","not_null":true},{"name":"typestat","type":"tinyint"},{"name":"xusertype","type":"smallint"},{"name":"length","type":"smallint","not_null":true},{"name":"xprec","type":"tinyint","not_null":true},{"name":"xscale","type":"tinyint","not_null":true},{"name":"colid","type":"smallint"},{"name":"xoffset","type":"smallint"},{"name":"bitpos","type":"tinyint"},{"name":"reserved","type":"tinyint"},{"name":"colstat","type":"smallint"},{"name":"cdefault","type":"int","not_null":true},{"name":"domain","type":"int","not_null":true},{"name":"number","type":"smallint"},{"name":"colorder","type":"smallint"},{"name":"autoval","type":"varbinary(8000)"},{"name":"offset","type":"smallint"},{"name":"collationid","type":"int"},{"name":"language","type":"int"},{"name":"status","type":"tinyint"},{"name":"type","type":"tinyint","not_null":true},{"name":"usertype","type":"smallint"},{"name":"printfmt","type":"varchar(255)"},{"name":"prec","type":"smallint"},{"name":"scale","type":"int"},{"name":"iscomputed","type":"int"},{"name":"isoutparam","type":"int"},{"name":"isnullable","type":"int"},{"name":"collation","type":"nvarchar(128)"},{"name":"tdscollation","type":"binary(5)"}]} +{"schema":"sys","name":"syscomments","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"number","type":"smallint"},{"name":"colid","type":"smallint","not_null":true},{"name":"status","type":"smallint","not_null":true},{"name":"ctext","type":"varbinary(8000)"},{"name":"texttype","type":"smallint"},{"name":"language","type":"smallint"},{"name":"encrypted","type":"bit","not_null":true},{"name":"compressed","type":"bit","not_null":true},{"name":"text","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"sysconfigures","kind":"v","columns":[{"name":"value","type":"int"},{"name":"config","type":"int","not_null":true},{"name":"comment","type":"nvarchar(255)","not_null":true},{"name":"status","type":"smallint"}]} +{"schema":"sys","name":"sysconstraints","kind":"v","columns":[{"name":"constid","type":"int","not_null":true},{"name":"id","type":"int","not_null":true},{"name":"colid","type":"smallint"},{"name":"spare1","type":"tinyint"},{"name":"status","type":"int"},{"name":"actions","type":"int"},{"name":"error","type":"int"}]} +{"schema":"sys","name":"syscscontainers","kind":"v","columns":[{"name":"blob_container_id","type":"smallint","not_null":true},{"name":"blob_container_url","type":"nvarchar(261)"},{"name":"blob_container_type","type":"tinyint"}]} +{"schema":"sys","name":"syscurconfigs","kind":"v","columns":[{"name":"value","type":"int","not_null":true},{"name":"config","type":"smallint"},{"name":"comment","type":"nvarchar(255)","not_null":true},{"name":"status","type":"smallint"}]} +{"schema":"sys","name":"syscursorcolumns","kind":"v","columns":[{"name":"cursor_handle","type":"int","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"ordinal_position","type":"int","not_null":true},{"name":"column_characteristics_flags","type":"int","not_null":true},{"name":"column_size","type":"int","not_null":true},{"name":"data_type_sql","type":"int","not_null":true},{"name":"column_precision","type":"tinyint","not_null":true},{"name":"column_scale","type":"tinyint","not_null":true},{"name":"order_position","type":"int","not_null":true},{"name":"order_direction","type":"nvarchar(1)"},{"name":"hidden_column","type":"smallint","not_null":true},{"name":"columnid","type":"int","not_null":true},{"name":"objectid","type":"int","not_null":true},{"name":"dbid","type":"int","not_null":true},{"name":"dbname","type":"nvarchar(128)"}]} +{"schema":"sys","name":"syscursorrefs","kind":"v","columns":[{"name":"reference_name","type":"nvarchar(128)"},{"name":"cursor_scope","type":"tinyint","not_null":true},{"name":"cursor_handl","type":"int","not_null":true}]} +{"schema":"sys","name":"syscursors","kind":"v","columns":[{"name":"cursor_handle","type":"int","not_null":true},{"name":"cursor_name","type":"nvarchar(128)"},{"name":"status","type":"int","not_null":true},{"name":"model","type":"tinyint","not_null":true},{"name":"concurrency","type":"tinyint","not_null":true},{"name":"scrollable","type":"tinyint","not_null":true},{"name":"open_status","type":"tinyint","not_null":true},{"name":"cursor_rows","type":"numeric(10,0)"},{"name":"fetch_status","type":"smallint","not_null":true},{"name":"column_count","type":"smallint","not_null":true},{"name":"row_count","type":"numeric(10,0)"},{"name":"last_operation","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"syscursortables","kind":"v","columns":[{"name":"cursor_handle","type":"int","not_null":true},{"name":"table_owner","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)"},{"name":"optimizer_hint","type":"smallint","not_null":true},{"name":"lock_type","type":"smallint","not_null":true},{"name":"server_name","type":"nvarchar(128)"},{"name":"objectid","type":"int","not_null":true},{"name":"dbid","type":"int","not_null":true},{"name":"dbname","type":"nvarchar(128)"}]} +{"schema":"sys","name":"sysdatabases","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"dbid","type":"smallint"},{"name":"sid","type":"varbinary(85)"},{"name":"mode","type":"smallint"},{"name":"status","type":"int"},{"name":"status2","type":"int"},{"name":"crdate","type":"datetime","not_null":true},{"name":"reserved","type":"datetime"},{"name":"category","type":"int"},{"name":"cmptlevel","type":"tinyint","not_null":true},{"name":"filename","type":"nvarchar(260)"},{"name":"version","type":"smallint"}]} +{"schema":"sys","name":"sysdepends","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"depid","type":"int","not_null":true},{"name":"number","type":"smallint"},{"name":"depnumber","type":"smallint"},{"name":"status","type":"smallint"},{"name":"deptype","type":"tinyint","not_null":true},{"name":"depdbid","type":"smallint"},{"name":"depsiteid","type":"smallint"},{"name":"selall","type":"bit","not_null":true},{"name":"resultobj","type":"bit","not_null":true},{"name":"readobj","type":"bit","not_null":true}]} +{"schema":"sys","name":"sysdevices","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"size","type":"int"},{"name":"low","type":"int"},{"name":"high","type":"int"},{"name":"status","type":"smallint"},{"name":"cntrltype","type":"smallint"},{"name":"phyname","type":"nvarchar(260)"}]} +{"schema":"sys","name":"sysfilegroups","kind":"v","columns":[{"name":"groupid","type":"smallint"},{"name":"allocpolicy","type":"smallint"},{"name":"status","type":"int"},{"name":"groupname","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"sysfiles","kind":"v","columns":[{"name":"fileid","type":"smallint"},{"name":"groupid","type":"smallint"},{"name":"size","type":"int","not_null":true},{"name":"maxsize","type":"int","not_null":true},{"name":"growth","type":"int","not_null":true},{"name":"status","type":"int"},{"name":"perf","type":"int"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"filename","type":"nvarchar(260)"}]} +{"schema":"sys","name":"sysforeignkeys","kind":"v","columns":[{"name":"constid","type":"int","not_null":true},{"name":"fkeyid","type":"int","not_null":true},{"name":"rkeyid","type":"int","not_null":true},{"name":"fkey","type":"smallint"},{"name":"rkey","type":"smallint"},{"name":"keyno","type":"smallint"}]} +{"schema":"sys","name":"sysfulltextcatalogs","kind":"v","columns":[{"name":"ftcatid","type":"smallint"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"status","type":"smallint"},{"name":"path","type":"nvarchar(260)"}]} +{"schema":"sys","name":"sysindexes","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"status","type":"int"},{"name":"first","type":"binary(6)"},{"name":"indid","type":"smallint"},{"name":"root","type":"binary(6)"},{"name":"minlen","type":"smallint"},{"name":"keycnt","type":"smallint"},{"name":"groupid","type":"smallint"},{"name":"dpages","type":"int"},{"name":"reserved","type":"int"},{"name":"used","type":"int"},{"name":"rowcnt","type":"bigint"},{"name":"rowmodctr","type":"int"},{"name":"reserved3","type":"tinyint"},{"name":"reserved4","type":"tinyint"},{"name":"xmaxlen","type":"smallint"},{"name":"maxirow","type":"smallint"},{"name":"origfillfactor","type":"tinyint"},{"name":"statversion","type":"tinyint"},{"name":"reserved2","type":"int"},{"name":"firstiam","type":"binary(6)"},{"name":"impid","type":"smallint"},{"name":"lockflags","type":"smallint"},{"name":"pgmodctr","type":"int"},{"name":"keys","type":"varbinary(1088)"},{"name":"name","type":"nvarchar(128)"},{"name":"statblob","type":"image"},{"name":"maxlen","type":"int"},{"name":"rows","type":"int"}]} +{"schema":"sys","name":"sysindexkeys","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"indid","type":"smallint"},{"name":"colid","type":"smallint"},{"name":"keyno","type":"smallint"}]} +{"schema":"sys","name":"syslanguages","kind":"v","columns":[{"name":"langid","type":"smallint","not_null":true},{"name":"dateformat","type":"nchar(3)","not_null":true},{"name":"datefirst","type":"tinyint","not_null":true},{"name":"upgrade","type":"int"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"alias","type":"nvarchar(128)","not_null":true},{"name":"months","type":"nvarchar(372)"},{"name":"shortmonths","type":"nvarchar(132)"},{"name":"days","type":"nvarchar(217)"},{"name":"lcid","type":"int","not_null":true},{"name":"msglangid","type":"smallint","not_null":true}]} +{"schema":"sys","name":"syslockinfo","kind":"v","columns":[{"name":"rsc_text","type":"nchar(32)","not_null":true},{"name":"rsc_bin","type":"binary(16)","not_null":true},{"name":"rsc_valblk","type":"binary(16)","not_null":true},{"name":"rsc_dbid","type":"smallint","not_null":true},{"name":"rsc_indid","type":"smallint","not_null":true},{"name":"rsc_objid","type":"int","not_null":true},{"name":"rsc_type","type":"tinyint","not_null":true},{"name":"rsc_flag","type":"tinyint","not_null":true},{"name":"req_mode","type":"tinyint","not_null":true},{"name":"req_status","type":"tinyint","not_null":true},{"name":"req_refcnt","type":"smallint","not_null":true},{"name":"req_cryrefcnt","type":"smallint","not_null":true},{"name":"req_lifetime","type":"int","not_null":true},{"name":"req_spid","type":"int","not_null":true},{"name":"req_ecid","type":"int","not_null":true},{"name":"req_ownertype","type":"smallint","not_null":true},{"name":"req_transactionid","type":"bigint"},{"name":"req_transactionuow","type":"uniqueidentifier"}]} +{"schema":"sys","name":"syslogins","kind":"v","columns":[{"name":"sid","type":"varbinary(85)"},{"name":"status","type":"smallint"},{"name":"createdate","type":"datetime","not_null":true},{"name":"updatedate","type":"datetime","not_null":true},{"name":"accdate","type":"datetime","not_null":true},{"name":"totcpu","type":"int"},{"name":"totio","type":"int"},{"name":"spacelimit","type":"int"},{"name":"timelimit","type":"int"},{"name":"resultlimit","type":"int"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"dbname","type":"nvarchar(128)"},{"name":"password","type":"nvarchar(128)"},{"name":"language","type":"nvarchar(128)"},{"name":"denylogin","type":"int"},{"name":"hasaccess","type":"int"},{"name":"isntname","type":"int"},{"name":"isntgroup","type":"int"},{"name":"isntuser","type":"int"},{"name":"sysadmin","type":"int"},{"name":"securityadmin","type":"int"},{"name":"serveradmin","type":"int"},{"name":"setupadmin","type":"int"},{"name":"processadmin","type":"int"},{"name":"diskadmin","type":"int"},{"name":"dbcreator","type":"int"},{"name":"bulkadmin","type":"int"},{"name":"##ms_serverstatereader##","type":"int"},{"name":"##ms_serverstatemanager##","type":"int"},{"name":"##ms_definitionreader##","type":"int"},{"name":"##ms_databaseconnector##","type":"int"},{"name":"##ms_databasemanager##","type":"int"},{"name":"##ms_loginmanager##","type":"int"},{"name":"##ms_securitydefinitionreader##","type":"int"},{"name":"##ms_permissiondefinitionreader##","type":"int"},{"name":"##ms_serversecuritystatereader##","type":"int"},{"name":"##ms_serverpermissionstatereader##","type":"int"},{"name":"loginname","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"sysmembers","kind":"v","columns":[{"name":"memberuid","type":"smallint"},{"name":"groupuid","type":"smallint"}]} +{"schema":"sys","name":"sysmessages","kind":"v","columns":[{"name":"error","type":"int","not_null":true},{"name":"severity","type":"tinyint"},{"name":"dlevel","type":"smallint"},{"name":"description","type":"nvarchar(255)"},{"name":"msglangid","type":"smallint","not_null":true}]} +{"schema":"sys","name":"sysobjects","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"id","type":"int","not_null":true},{"name":"xtype","type":"char(2)","not_null":true},{"name":"uid","type":"smallint"},{"name":"info","type":"smallint"},{"name":"status","type":"int"},{"name":"base_schema_ver","type":"int"},{"name":"replinfo","type":"int"},{"name":"parent_obj","type":"int","not_null":true},{"name":"crdate","type":"datetime","not_null":true},{"name":"ftcatid","type":"smallint"},{"name":"schema_ver","type":"int"},{"name":"stats_schema_ver","type":"int"},{"name":"type","type":"char(2)"},{"name":"userstat","type":"smallint"},{"name":"sysstat","type":"smallint"},{"name":"indexdel","type":"smallint"},{"name":"refdate","type":"datetime","not_null":true},{"name":"version","type":"int"},{"name":"deltrig","type":"int"},{"name":"instrig","type":"int"},{"name":"updtrig","type":"int"},{"name":"seltrig","type":"int"},{"name":"category","type":"int"},{"name":"cache","type":"smallint"}]} +{"schema":"sys","name":"sysoledbusers","kind":"v","columns":[{"name":"rmtsrvid","type":"smallint"},{"name":"rmtloginame","type":"nvarchar(128)"},{"name":"rmtpassword","type":"nvarchar(128)"},{"name":"loginsid","type":"varbinary(85)"},{"name":"status","type":"smallint"},{"name":"changedate","type":"datetime","not_null":true}]} +{"schema":"sys","name":"sysopentapes","kind":"v","columns":[{"name":"opentape","type":"nvarchar(64)","not_null":true}]} +{"schema":"sys","name":"sysperfinfo","kind":"v","columns":[{"name":"object_name","type":"nchar(128)","not_null":true},{"name":"counter_name","type":"nchar(128)","not_null":true},{"name":"instance_name","type":"nchar(128)"},{"name":"cntr_value","type":"bigint","not_null":true},{"name":"cntr_type","type":"int","not_null":true}]} +{"schema":"sys","name":"syspermissions","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"grantee","type":"smallint"},{"name":"grantor","type":"smallint"},{"name":"actadd","type":"smallint"},{"name":"actmod","type":"smallint"},{"name":"seladd","type":"varbinary(4000)"},{"name":"selmod","type":"varbinary(4000)"},{"name":"updadd","type":"varbinary(4000)"},{"name":"updmod","type":"varbinary(4000)"},{"name":"refadd","type":"varbinary(4000)"},{"name":"refmod","type":"varbinary(4000)"}]} +{"schema":"sys","name":"sysprocesses","kind":"v","columns":[{"name":"spid","type":"smallint","not_null":true},{"name":"kpid","type":"smallint","not_null":true},{"name":"blocked","type":"smallint","not_null":true},{"name":"waittype","type":"binary(2)","not_null":true},{"name":"waittime","type":"bigint","not_null":true},{"name":"lastwaittype","type":"nchar(32)","not_null":true},{"name":"waitresource","type":"nchar(256)","not_null":true},{"name":"dbid","type":"smallint","not_null":true},{"name":"uid","type":"smallint"},{"name":"cpu","type":"int","not_null":true},{"name":"physical_io","type":"bigint","not_null":true},{"name":"memusage","type":"int","not_null":true},{"name":"login_time","type":"datetime","not_null":true},{"name":"last_batch","type":"datetime","not_null":true},{"name":"ecid","type":"smallint","not_null":true},{"name":"open_tran","type":"smallint","not_null":true},{"name":"status","type":"nchar(30)","not_null":true},{"name":"sid","type":"binary(86)","not_null":true},{"name":"hostname","type":"nchar(128)","not_null":true},{"name":"program_name","type":"nchar(128)","not_null":true},{"name":"hostprocess","type":"nchar(10)","not_null":true},{"name":"cmd","type":"nchar(26)","not_null":true},{"name":"nt_domain","type":"nchar(128)","not_null":true},{"name":"nt_username","type":"nchar(128)","not_null":true},{"name":"net_address","type":"nchar(12)","not_null":true},{"name":"net_library","type":"nchar(12)","not_null":true},{"name":"loginame","type":"nchar(128)","not_null":true},{"name":"context_info","type":"binary(128)","not_null":true},{"name":"sql_handle","type":"binary(20)","not_null":true},{"name":"stmt_start","type":"int","not_null":true},{"name":"stmt_end","type":"int","not_null":true},{"name":"request_id","type":"int","not_null":true},{"name":"page_resource","type":"varbinary(8)"}]} +{"schema":"sys","name":"sysprotects","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"uid","type":"smallint"},{"name":"action","type":"tinyint"},{"name":"protecttype","type":"tinyint"},{"name":"columns","type":"varbinary(8000)"},{"name":"grantor","type":"smallint"}]} +{"schema":"sys","name":"sysreferences","kind":"v","columns":[{"name":"constid","type":"int","not_null":true},{"name":"fkeyid","type":"int","not_null":true},{"name":"rkeyid","type":"int"},{"name":"rkeyindid","type":"smallint"},{"name":"keycnt","type":"smallint"},{"name":"forkeys","type":"varbinary(32)"},{"name":"refkeys","type":"varbinary(32)"},{"name":"fkeydbid","type":"smallint"},{"name":"rkeydbid","type":"smallint"},{"name":"fkey1","type":"smallint"},{"name":"fkey2","type":"smallint"},{"name":"fkey3","type":"smallint"},{"name":"fkey4","type":"smallint"},{"name":"fkey5","type":"smallint"},{"name":"fkey6","type":"smallint"},{"name":"fkey7","type":"smallint"},{"name":"fkey8","type":"smallint"},{"name":"fkey9","type":"smallint"},{"name":"fkey10","type":"smallint"},{"name":"fkey11","type":"smallint"},{"name":"fkey12","type":"smallint"},{"name":"fkey13","type":"smallint"},{"name":"fkey14","type":"smallint"},{"name":"fkey15","type":"smallint"},{"name":"fkey16","type":"smallint"},{"name":"rkey1","type":"smallint"},{"name":"rkey2","type":"smallint"},{"name":"rkey3","type":"smallint"},{"name":"rkey4","type":"smallint"},{"name":"rkey5","type":"smallint"},{"name":"rkey6","type":"smallint"},{"name":"rkey7","type":"smallint"},{"name":"rkey8","type":"smallint"},{"name":"rkey9","type":"smallint"},{"name":"rkey10","type":"smallint"},{"name":"rkey11","type":"smallint"},{"name":"rkey12","type":"smallint"},{"name":"rkey13","type":"smallint"},{"name":"rkey14","type":"smallint"},{"name":"rkey15","type":"smallint"},{"name":"rkey16","type":"smallint"}]} +{"schema":"sys","name":"sysremotelogins","kind":"v","columns":[{"name":"remoteserverid","type":"smallint"},{"name":"remoteusername","type":"nvarchar(128)"},{"name":"status","type":"smallint"},{"name":"sid","type":"varbinary(85)"},{"name":"changedate","type":"datetime","not_null":true}]} +{"schema":"sys","name":"sysservers","kind":"v","columns":[{"name":"srvid","type":"smallint"},{"name":"srvstatus","type":"smallint"},{"name":"srvname","type":"nvarchar(128)","not_null":true},{"name":"srvproduct","type":"nvarchar(128)","not_null":true},{"name":"providername","type":"nvarchar(128)","not_null":true},{"name":"datasource","type":"nvarchar(4000)"},{"name":"location","type":"nvarchar(4000)"},{"name":"providerstring","type":"nvarchar(4000)"},{"name":"schemadate","type":"datetime","not_null":true},{"name":"topologyx","type":"int"},{"name":"topologyy","type":"int"},{"name":"catalog","type":"nvarchar(128)"},{"name":"srvcollation","type":"nvarchar(128)"},{"name":"connecttimeout","type":"int"},{"name":"querytimeout","type":"int"},{"name":"srvnetname","type":"char(30)"},{"name":"isremote","type":"bit"},{"name":"rpc","type":"bit","not_null":true},{"name":"pub","type":"bit","not_null":true},{"name":"sub","type":"bit"},{"name":"dist","type":"bit"},{"name":"dpub","type":"bit"},{"name":"rpcout","type":"bit","not_null":true},{"name":"dataaccess","type":"bit","not_null":true},{"name":"collationcompatible","type":"bit","not_null":true},{"name":"system","type":"bit","not_null":true},{"name":"useremotecollation","type":"bit","not_null":true},{"name":"lazyschemavalidation","type":"bit","not_null":true},{"name":"collation","type":"nvarchar(128)"},{"name":"nonsqlsub","type":"bit"}]} +{"schema":"sys","name":"system_columns","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"column_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_ansi_padded","type":"bit","not_null":true},{"name":"is_rowguidcol","type":"bit","not_null":true},{"name":"is_identity","type":"bit","not_null":true},{"name":"is_computed","type":"bit","not_null":true},{"name":"is_filestream","type":"bit","not_null":true},{"name":"is_replicated","type":"bit","not_null":true},{"name":"is_non_sql_subscribed","type":"bit","not_null":true},{"name":"is_merge_published","type":"bit","not_null":true},{"name":"is_dts_replicated","type":"bit","not_null":true},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_sparse","type":"bit","not_null":true},{"name":"is_column_set","type":"bit","not_null":true},{"name":"generated_always_type","type":"tinyint"},{"name":"generated_always_type_desc","type":"nvarchar(60)"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"is_hidden","type":"bit","not_null":true},{"name":"is_masked","type":"bit","not_null":true},{"name":"graph_type","type":"int"},{"name":"graph_type_desc","type":"nvarchar(60)"},{"name":"is_data_deletion_filter_column","type":"bit","not_null":true},{"name":"ledger_view_column_type","type":"int"},{"name":"ledger_view_column_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_column","type":"bit","not_null":true},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"system_components_surface_area_configuration","kind":"v","columns":[{"name":"component_name","type":"nvarchar(128)"},{"name":"database_name","type":"nvarchar(128)"},{"name":"schema_name","type":"nvarchar(128)"},{"name":"object_name","type":"nvarchar(128)","not_null":true},{"name":"state","type":"tinyint"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"system_internals_allocation_units","kind":"v","columns":[{"name":"allocation_unit_id","type":"bigint","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"container_id","type":"bigint","not_null":true},{"name":"filegroup_id","type":"smallint","not_null":true},{"name":"total_pages","type":"bigint","not_null":true},{"name":"used_pages","type":"bigint","not_null":true},{"name":"data_pages","type":"bigint","not_null":true},{"name":"first_page","type":"binary(6)","not_null":true},{"name":"root_page","type":"binary(6)","not_null":true},{"name":"first_iam_page","type":"binary(6)","not_null":true}]} +{"schema":"sys","name":"system_internals_partition_columns","kind":"v","columns":[{"name":"partition_id","type":"bigint","not_null":true},{"name":"partition_column_id","type":"int","not_null":true},{"name":"modified_count","type":"bigint","not_null":true},{"name":"max_inrow_length","type":"smallint"},{"name":"is_replicated","type":"bit"},{"name":"is_logged_for_replication","type":"bit"},{"name":"is_dropped","type":"bit"},{"name":"system_type_id","type":"tinyint"},{"name":"max_length","type":"smallint"},{"name":"precision","type":"tinyint"},{"name":"scale","type":"tinyint"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_filestream","type":"bit"},{"name":"key_ordinal","type":"smallint","not_null":true},{"name":"is_nullable","type":"bit"},{"name":"is_descending_key","type":"bit"},{"name":"is_uniqueifier","type":"bit"},{"name":"leaf_offset","type":"smallint"},{"name":"internal_offset","type":"smallint"},{"name":"leaf_bit_position","type":"tinyint"},{"name":"internal_bit_position","type":"tinyint"},{"name":"leaf_null_bit","type":"smallint"},{"name":"internal_null_bit","type":"smallint"},{"name":"is_anti_matter","type":"bit"},{"name":"partition_column_guid","type":"uniqueidentifier"},{"name":"is_sparse","type":"bit"},{"name":"has_default","type":"bit","not_null":true},{"name":"default_value","type":"sql_variant"},{"name":"hobt_column_id","type":"int","not_null":true},{"name":"is_csilocator","type":"bit"},{"name":"is_added_with_skip_segments","type":"bit"}]} +{"schema":"sys","name":"system_internals_partitions","kind":"v","columns":[{"name":"partition_id","type":"bigint","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"index_id","type":"int","not_null":true},{"name":"partition_number","type":"int","not_null":true},{"name":"rows","type":"bigint","not_null":true},{"name":"filestream_filegroup_id","type":"smallint","not_null":true},{"name":"is_orphaned","type":"bit"},{"name":"dropped_lob_column_state","type":"tinyint"},{"name":"is_unique","type":"bit"},{"name":"is_replicated","type":"bit"},{"name":"is_logged_for_replication","type":"bit"},{"name":"is_sereplicated","type":"bit","not_null":true},{"name":"max_null_bit_used","type":"smallint","not_null":true},{"name":"max_leaf_length","type":"int","not_null":true},{"name":"min_leaf_length","type":"smallint","not_null":true},{"name":"max_internal_length","type":"smallint","not_null":true},{"name":"min_internal_length","type":"smallint","not_null":true},{"name":"allows_nullable_keys","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"is_data_row_format","type":"bit"},{"name":"is_not_versioned","type":"bit"},{"name":"filestream_guid","type":"uniqueidentifier"},{"name":"ownertype","type":"tinyint","not_null":true},{"name":"is_columnstore","type":"bit"},{"name":"optimize_for_sequential_key","type":"bit"}]} +{"schema":"sys","name":"system_objects","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"}]} +{"schema":"sys","name":"system_parameters","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"parameter_id","type":"int","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"is_output","type":"bit","not_null":true},{"name":"is_cursor_ref","type":"bit","not_null":true},{"name":"has_default_value","type":"bit","not_null":true},{"name":"is_xml_document","type":"bit","not_null":true},{"name":"default_value","type":"sql_variant"},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"is_readonly","type":"bit","not_null":true},{"name":"is_nullable","type":"bit"},{"name":"encryption_type","type":"int"},{"name":"encryption_type_desc","type":"nvarchar(64)"},{"name":"encryption_algorithm_name","type":"nvarchar(128)"},{"name":"column_encryption_key_id","type":"int"},{"name":"column_encryption_key_database_name","type":"nvarchar(128)"},{"name":"vector_dimensions","type":"int"},{"name":"vector_base_type","type":"tinyint"},{"name":"vector_base_type_desc","type":"nvarchar(10)"}]} +{"schema":"sys","name":"system_sql_modules","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"definition","type":"nvarchar(max)"},{"name":"uses_ansi_nulls","type":"bit","not_null":true},{"name":"uses_quoted_identifier","type":"bit","not_null":true},{"name":"is_schema_bound","type":"bit","not_null":true},{"name":"uses_database_collation","type":"bit","not_null":true},{"name":"is_recompiled","type":"bit","not_null":true},{"name":"null_on_null_input","type":"bit","not_null":true},{"name":"execute_as_principal_id","type":"int"},{"name":"uses_native_compilation","type":"bit","not_null":true},{"name":"inline_type","type":"bit","not_null":true},{"name":"is_inlineable","type":"bit","not_null":true}]} +{"schema":"sys","name":"system_views","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int"},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit"},{"name":"is_published","type":"bit"},{"name":"is_schema_published","type":"bit"},{"name":"is_replicated","type":"bit","not_null":true},{"name":"has_replication_filter","type":"bit","not_null":true},{"name":"has_opaque_metadata","type":"bit","not_null":true},{"name":"has_unchecked_assembly_data","type":"bit","not_null":true},{"name":"with_check_option","type":"bit","not_null":true},{"name":"is_date_correlation_view","type":"bit","not_null":true},{"name":"is_tracked_by_cdc","type":"bit","not_null":true},{"name":"has_snapshot","type":"bit","not_null":true},{"name":"ledger_view_type","type":"tinyint"},{"name":"ledger_view_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_view","type":"bit","not_null":true}]} +{"schema":"sys","name":"systypes","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"xtype","type":"tinyint","not_null":true},{"name":"status","type":"tinyint"},{"name":"xusertype","type":"smallint"},{"name":"length","type":"smallint","not_null":true},{"name":"xprec","type":"tinyint","not_null":true},{"name":"xscale","type":"tinyint","not_null":true},{"name":"tdefault","type":"int","not_null":true},{"name":"domain","type":"int","not_null":true},{"name":"uid","type":"smallint"},{"name":"reserved","type":"smallint"},{"name":"collationid","type":"int"},{"name":"usertype","type":"smallint"},{"name":"variable","type":"bit","not_null":true},{"name":"allownulls","type":"bit"},{"name":"type","type":"tinyint","not_null":true},{"name":"printfmt","type":"varchar(255)"},{"name":"prec","type":"smallint"},{"name":"scale","type":"tinyint"},{"name":"collation","type":"nvarchar(128)"}]} +{"schema":"sys","name":"sysusers","kind":"v","columns":[{"name":"uid","type":"smallint"},{"name":"status","type":"smallint"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"sid","type":"varbinary(85)"},{"name":"roles","type":"varbinary(2048)"},{"name":"createdate","type":"datetime","not_null":true},{"name":"updatedate","type":"datetime","not_null":true},{"name":"altuid","type":"smallint"},{"name":"password","type":"varbinary(256)"},{"name":"gid","type":"smallint"},{"name":"environ","type":"varchar(255)"},{"name":"hasdbaccess","type":"int"},{"name":"islogin","type":"int"},{"name":"isntname","type":"int"},{"name":"isntgroup","type":"int"},{"name":"isntuser","type":"int"},{"name":"issqluser","type":"int"},{"name":"isaliased","type":"int"},{"name":"issqlrole","type":"int"},{"name":"isapprole","type":"int"}]} +{"schema":"sys","name":"table_types","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_user_defined","type":"bit","not_null":true},{"name":"is_assembly_type","type":"bit","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_table_type","type":"bit","not_null":true},{"name":"type_table_object_id","type":"int","not_null":true},{"name":"is_memory_optimized","type":"bit"}]} +{"schema":"sys","name":"tables","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"lob_data_space_id","type":"int","not_null":true},{"name":"filestream_data_space_id","type":"int"},{"name":"max_column_id_used","type":"int","not_null":true},{"name":"lock_on_bulk_load","type":"bit","not_null":true},{"name":"uses_ansi_nulls","type":"bit"},{"name":"is_replicated","type":"bit"},{"name":"has_replication_filter","type":"bit"},{"name":"is_merge_published","type":"bit"},{"name":"is_sync_tran_subscribed","type":"bit"},{"name":"has_unchecked_assembly_data","type":"bit","not_null":true},{"name":"text_in_row_limit","type":"int"},{"name":"large_value_types_out_of_row","type":"bit"},{"name":"is_tracked_by_cdc","type":"bit"},{"name":"lock_escalation","type":"tinyint"},{"name":"lock_escalation_desc","type":"nvarchar(60)"},{"name":"is_filetable","type":"bit"},{"name":"is_memory_optimized","type":"bit"},{"name":"durability","type":"tinyint"},{"name":"durability_desc","type":"nvarchar(60)"},{"name":"temporal_type","type":"tinyint"},{"name":"temporal_type_desc","type":"nvarchar(60)"},{"name":"history_table_id","type":"int"},{"name":"is_remote_data_archive_enabled","type":"bit"},{"name":"is_external","type":"bit","not_null":true},{"name":"history_retention_period","type":"int"},{"name":"history_retention_period_unit","type":"int"},{"name":"history_retention_period_unit_desc","type":"nvarchar(10)"},{"name":"is_node","type":"bit"},{"name":"is_edge","type":"bit"},{"name":"data_retention_period","type":"int"},{"name":"data_retention_period_unit","type":"int"},{"name":"data_retention_period_unit_desc","type":"nvarchar(10)"},{"name":"ledger_type","type":"tinyint"},{"name":"ledger_type_desc","type":"nvarchar(60)"},{"name":"ledger_view_id","type":"int"},{"name":"is_dropped_ledger_table","type":"bit"}]} +{"schema":"sys","name":"tcp_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"port","type":"int","not_null":true},{"name":"is_dynamic_port","type":"bit","not_null":true},{"name":"ip_address","type":"varchar(45)"}]} +{"schema":"sys","name":"time_zone_info","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"current_utc_offset","type":"nvarchar(6)","not_null":true},{"name":"is_currently_dst","type":"bit","not_null":true}]} +{"schema":"sys","name":"trace_categories","kind":"v","columns":[{"name":"category_id","type":"smallint","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"type","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"trace_columns","kind":"v","columns":[{"name":"trace_column_id","type":"smallint","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"type_name","type":"nvarchar(128)"},{"name":"max_size","type":"int"},{"name":"is_filterable","type":"bit","not_null":true},{"name":"is_repeatable","type":"bit","not_null":true},{"name":"is_repeated_base","type":"bit","not_null":true}]} +{"schema":"sys","name":"trace_event_bindings","kind":"v","columns":[{"name":"trace_event_id","type":"smallint","not_null":true},{"name":"trace_column_id","type":"smallint","not_null":true}]} +{"schema":"sys","name":"trace_events","kind":"v","columns":[{"name":"trace_event_id","type":"smallint","not_null":true},{"name":"category_id","type":"smallint","not_null":true},{"name":"name","type":"nvarchar(128)"}]} +{"schema":"sys","name":"trace_subclass_values","kind":"v","columns":[{"name":"trace_event_id","type":"smallint","not_null":true},{"name":"trace_column_id","type":"smallint","not_null":true},{"name":"subclass_name","type":"nvarchar(128)"},{"name":"subclass_value","type":"smallint"}]} +{"schema":"sys","name":"traces","kind":"v","columns":[{"name":"id","type":"int","not_null":true},{"name":"status","type":"int","not_null":true},{"name":"path","type":"nvarchar(260)"},{"name":"max_size","type":"bigint"},{"name":"stop_time","type":"datetime"},{"name":"max_files","type":"int"},{"name":"is_rowset","type":"bit"},{"name":"is_rollover","type":"bit"},{"name":"is_shutdown","type":"bit"},{"name":"is_default","type":"bit"},{"name":"buffer_count","type":"int"},{"name":"buffer_size","type":"int"},{"name":"file_position","type":"bigint"},{"name":"reader_spid","type":"int"},{"name":"start_time","type":"datetime"},{"name":"last_event_time","type":"datetime"},{"name":"event_count","type":"bigint"},{"name":"dropped_event_count","type":"int"}]} +{"schema":"sys","name":"transmission_queue","kind":"v","columns":[{"name":"conversation_handle","type":"uniqueidentifier","not_null":true},{"name":"to_service_name","type":"nvarchar(256)"},{"name":"to_broker_instance","type":"nvarchar(128)"},{"name":"from_service_name","type":"nvarchar(256)"},{"name":"service_contract_name","type":"nvarchar(256)"},{"name":"enqueue_time","type":"datetime","not_null":true},{"name":"message_sequence_number","type":"bigint","not_null":true},{"name":"message_type_name","type":"nvarchar(256)"},{"name":"is_conversation_error","type":"bit","not_null":true},{"name":"is_end_of_dialog","type":"bit","not_null":true},{"name":"message_body","type":"varbinary(max)"},{"name":"transmission_status","type":"nvarchar(4000)"},{"name":"priority","type":"tinyint","not_null":true}]} +{"schema":"sys","name":"trigger_event_types","kind":"v","columns":[{"name":"type","type":"int","not_null":true},{"name":"type_name","type":"nvarchar(64)"},{"name":"parent_type","type":"int"}]} +{"schema":"sys","name":"trigger_events","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"type","type":"int","not_null":true},{"name":"type_desc","type":"nvarchar(128)","not_null":true},{"name":"is_first","type":"bit"},{"name":"is_last","type":"bit"},{"name":"event_group_type","type":"int"},{"name":"event_group_type_desc","type":"nvarchar(128)"},{"name":"is_trigger_event","type":"bit"}]} +{"schema":"sys","name":"triggers","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"parent_class","type":"tinyint","not_null":true},{"name":"parent_class_desc","type":"nvarchar(60)"},{"name":"parent_id","type":"int","not_null":true},{"name":"type","type":"char(2)","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_disabled","type":"bit","not_null":true},{"name":"is_not_for_replication","type":"bit","not_null":true},{"name":"is_instead_of_trigger","type":"bit","not_null":true}]} +{"schema":"sys","name":"trusted_assemblies","kind":"v","columns":[{"name":"hash","type":"varbinary(8000)"},{"name":"description","type":"nvarchar(4000)"},{"name":"create_date","type":"datetime2(7)","not_null":true},{"name":"created_by","type":"nvarchar(128)","not_null":true}]} +{"schema":"sys","name":"type_assembly_usages","kind":"v","columns":[{"name":"user_type_id","type":"int","not_null":true},{"name":"assembly_id","type":"int","not_null":true}]} +{"schema":"sys","name":"types","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"system_type_id","type":"tinyint","not_null":true},{"name":"user_type_id","type":"int","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"max_length","type":"smallint","not_null":true},{"name":"precision","type":"tinyint","not_null":true},{"name":"scale","type":"tinyint","not_null":true},{"name":"collation_name","type":"nvarchar(128)"},{"name":"is_nullable","type":"bit"},{"name":"is_user_defined","type":"bit","not_null":true},{"name":"is_assembly_type","type":"bit","not_null":true},{"name":"default_object_id","type":"int","not_null":true},{"name":"rule_object_id","type":"int","not_null":true},{"name":"is_table_type","type":"bit","not_null":true}]} +{"schema":"sys","name":"user_token","kind":"v","columns":[{"name":"principal_id","type":"int"},{"name":"sid","type":"varbinary(85)"},{"name":"name","type":"nvarchar(128)"},{"name":"type","type":"nvarchar(128)"},{"name":"usage","type":"nvarchar(128)"}]} +{"schema":"sys","name":"vector_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"has_filter","type":"bit","not_null":true},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"auto_created","type":"bit"},{"name":"vector_index_type","type":"nvarchar(60)"},{"name":"distance_metric","type":"nvarchar(60)"},{"name":"build_parameters","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"via_endpoints","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"endpoint_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"protocol","type":"tinyint","not_null":true},{"name":"protocol_desc","type":"nvarchar(60)"},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"state","type":"tinyint"},{"name":"state_desc","type":"nvarchar(60)"},{"name":"is_admin_endpoint","type":"bit","not_null":true},{"name":"discriminator","type":"nvarchar(128)"}]} +{"schema":"sys","name":"views","kind":"v","columns":[{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"object_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"schema_id","type":"int","not_null":true},{"name":"parent_object_id","type":"int","not_null":true},{"name":"type","type":"char(2)"},{"name":"type_desc","type":"nvarchar(60)"},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true},{"name":"is_ms_shipped","type":"bit","not_null":true},{"name":"is_published","type":"bit","not_null":true},{"name":"is_schema_published","type":"bit","not_null":true},{"name":"is_replicated","type":"bit"},{"name":"has_replication_filter","type":"bit"},{"name":"has_opaque_metadata","type":"bit","not_null":true},{"name":"has_unchecked_assembly_data","type":"bit","not_null":true},{"name":"with_check_option","type":"bit","not_null":true},{"name":"is_date_correlation_view","type":"bit","not_null":true},{"name":"is_tracked_by_cdc","type":"bit"},{"name":"has_snapshot","type":"bit"},{"name":"ledger_view_type","type":"tinyint"},{"name":"ledger_view_type_desc","type":"nvarchar(60)"},{"name":"is_dropped_ledger_view","type":"bit"}]} +{"schema":"sys","name":"xml_indexes","kind":"v","columns":[{"name":"object_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(128)"},{"name":"index_id","type":"int","not_null":true},{"name":"type","type":"tinyint","not_null":true},{"name":"type_desc","type":"nvarchar(60)"},{"name":"is_unique","type":"bit"},{"name":"data_space_id","type":"int","not_null":true},{"name":"ignore_dup_key","type":"bit"},{"name":"is_primary_key","type":"bit"},{"name":"is_unique_constraint","type":"bit"},{"name":"fill_factor","type":"tinyint","not_null":true},{"name":"is_padded","type":"bit"},{"name":"is_disabled","type":"bit"},{"name":"is_hypothetical","type":"bit"},{"name":"is_ignored_in_optimization","type":"bit"},{"name":"allow_row_locks","type":"bit"},{"name":"allow_page_locks","type":"bit"},{"name":"using_xml_index_id","type":"int"},{"name":"secondary_type","type":"char(1)"},{"name":"secondary_type_desc","type":"nvarchar(60)"},{"name":"has_filter","type":"bit","not_null":true},{"name":"filter_definition","type":"nvarchar(max)"},{"name":"xml_index_type","type":"tinyint"},{"name":"xml_index_type_description","type":"nvarchar(60)"},{"name":"path_id","type":"int"},{"name":"auto_created","type":"bit"}]} +{"schema":"sys","name":"xml_schema_attributes","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"is_default_fixed","type":"bit","not_null":true},{"name":"must_be_qualified","type":"bit","not_null":true},{"name":"default_value","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"xml_schema_collections","kind":"v","columns":[{"name":"xml_collection_id","type":"int","not_null":true},{"name":"schema_id","type":"int","not_null":true},{"name":"principal_id","type":"int"},{"name":"name","type":"nvarchar(128)","not_null":true},{"name":"create_date","type":"datetime","not_null":true},{"name":"modify_date","type":"datetime","not_null":true}]} +{"schema":"sys","name":"xml_schema_component_placements","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"placement_id","type":"int","not_null":true},{"name":"placed_xml_component_id","type":"int","not_null":true},{"name":"is_default_fixed","type":"bit","not_null":true},{"name":"min_occurences","type":"int","not_null":true},{"name":"max_occurences","type":"int","not_null":true},{"name":"default_value","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"xml_schema_components","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"}]} +{"schema":"sys","name":"xml_schema_elements","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"is_default_fixed","type":"bit","not_null":true},{"name":"is_abstract","type":"bit","not_null":true},{"name":"is_nillable","type":"bit","not_null":true},{"name":"must_be_qualified","type":"bit","not_null":true},{"name":"is_extension_blocked","type":"bit","not_null":true},{"name":"is_restriction_blocked","type":"bit","not_null":true},{"name":"is_substitution_blocked","type":"bit","not_null":true},{"name":"is_final_extension","type":"bit","not_null":true},{"name":"is_final_restriction","type":"bit","not_null":true},{"name":"default_value","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"xml_schema_facets","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"facet_id","type":"int","not_null":true},{"name":"kind","type":"char(2)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"is_fixed","type":"bit","not_null":true},{"name":"value","type":"nvarchar(4000)"}]} +{"schema":"sys","name":"xml_schema_model_groups","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"compositor","type":"char(1)","not_null":true},{"name":"compositor_desc","type":"nvarchar(60)"}]} +{"schema":"sys","name":"xml_schema_namespaces","kind":"v","columns":[{"name":"xml_collection_id","type":"int","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"xml_namespace_id","type":"int","not_null":true}]} +{"schema":"sys","name":"xml_schema_types","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"is_abstract","type":"bit","not_null":true},{"name":"allows_mixed_content","type":"bit","not_null":true},{"name":"is_extension_blocked","type":"bit","not_null":true},{"name":"is_restriction_blocked","type":"bit","not_null":true},{"name":"is_final_extension","type":"bit","not_null":true},{"name":"is_final_restriction","type":"bit","not_null":true},{"name":"is_final_list_member","type":"bit","not_null":true},{"name":"is_final_union_member","type":"bit","not_null":true}]} +{"schema":"sys","name":"xml_schema_wildcard_namespaces","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"namespace","type":"nvarchar(4000)","not_null":true}]} +{"schema":"sys","name":"xml_schema_wildcards","kind":"v","columns":[{"name":"xml_component_id","type":"int","not_null":true},{"name":"xml_collection_id","type":"int","not_null":true},{"name":"xml_namespace_id","type":"int","not_null":true},{"name":"is_qualified","type":"bit","not_null":true},{"name":"name","type":"nvarchar(4000)"},{"name":"symbol_space","type":"char(1)","not_null":true},{"name":"symbol_space_desc","type":"nvarchar(60)"},{"name":"kind","type":"char(1)","not_null":true},{"name":"kind_desc","type":"nvarchar(60)"},{"name":"derivation","type":"char(1)","not_null":true},{"name":"derivation_desc","type":"nvarchar(60)"},{"name":"base_xml_component_id","type":"int"},{"name":"scoping_xml_component_id","type":"int"},{"name":"process_content","type":"char(1)","not_null":true},{"name":"process_content_desc","type":"nvarchar(60)"},{"name":"disallow_namespaces","type":"bit","not_null":true}]} +{"schema":"information_schema","name":"check_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"check_clause","type":"nvarchar(4000)"}]} +{"schema":"information_schema","name":"column_domain_usage","kind":"v","columns":[{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"column_privileges","kind":"v","columns":[{"name":"grantor","type":"nvarchar(128)"},{"name":"grantee","type":"nvarchar(128)"},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"privilege_type","type":"varchar(10)"},{"name":"is_grantable","type":"varchar(3)"}]} +{"schema":"information_schema","name":"columns","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"ordinal_position","type":"int"},{"name":"column_default","type":"nvarchar(4000)"},{"name":"is_nullable","type":"varchar(3)"},{"name":"data_type","type":"nvarchar(128)"},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"constraint_column_usage","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true}]} +{"schema":"information_schema","name":"constraint_table_usage","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true}]} +{"schema":"information_schema","name":"domain_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)","not_null":true},{"name":"is_deferrable","type":"varchar(2)","not_null":true},{"name":"initially_deferred","type":"varchar(2)","not_null":true}]} +{"schema":"information_schema","name":"domains","kind":"v","columns":[{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)","not_null":true},{"name":"data_type","type":"nvarchar(128)"},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"domain_default","type":"nvarchar(4000)"}]} +{"schema":"information_schema","name":"key_column_usage","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"ordinal_position","type":"int","not_null":true}]} +{"schema":"information_schema","name":"parameters","kind":"v","columns":[{"name":"specific_catalog","type":"nvarchar(128)"},{"name":"specific_schema","type":"nvarchar(128)"},{"name":"specific_name","type":"nvarchar(128)","not_null":true},{"name":"ordinal_position","type":"int","not_null":true},{"name":"parameter_mode","type":"nvarchar(10)"},{"name":"is_result","type":"nvarchar(10)"},{"name":"as_locator","type":"nvarchar(10)"},{"name":"parameter_name","type":"nvarchar(128)"},{"name":"data_type","type":"nvarchar(128)","not_null":true},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"interval_type","type":"nvarchar(30)"},{"name":"interval_precision","type":"smallint"},{"name":"user_defined_type_catalog","type":"nvarchar(128)"},{"name":"user_defined_type_schema","type":"nvarchar(128)"},{"name":"user_defined_type_name","type":"nvarchar(128)"},{"name":"scope_catalog","type":"nvarchar(128)"},{"name":"scope_schema","type":"nvarchar(128)"},{"name":"scope_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"referential_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"unique_constraint_catalog","type":"nvarchar(128)"},{"name":"unique_constraint_schema","type":"nvarchar(128)"},{"name":"unique_constraint_name","type":"nvarchar(128)"},{"name":"match_option","type":"varchar(7)"},{"name":"update_rule","type":"varchar(11)"},{"name":"delete_rule","type":"varchar(11)"}]} +{"schema":"information_schema","name":"routine_columns","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"},{"name":"ordinal_position","type":"int","not_null":true},{"name":"column_default","type":"nvarchar(4000)"},{"name":"is_nullable","type":"varchar(3)"},{"name":"data_type","type":"nvarchar(128)"},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"domain_catalog","type":"nvarchar(128)"},{"name":"domain_schema","type":"nvarchar(128)"},{"name":"domain_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"routines","kind":"v","columns":[{"name":"specific_catalog","type":"nvarchar(128)"},{"name":"specific_schema","type":"nvarchar(128)"},{"name":"specific_name","type":"nvarchar(128)","not_null":true},{"name":"routine_catalog","type":"nvarchar(128)"},{"name":"routine_schema","type":"nvarchar(128)"},{"name":"routine_name","type":"nvarchar(128)","not_null":true},{"name":"routine_type","type":"nvarchar(20)"},{"name":"module_catalog","type":"nvarchar(128)"},{"name":"module_schema","type":"nvarchar(128)"},{"name":"module_name","type":"nvarchar(128)"},{"name":"udt_catalog","type":"nvarchar(128)"},{"name":"udt_schema","type":"nvarchar(128)"},{"name":"udt_name","type":"nvarchar(128)"},{"name":"data_type","type":"nvarchar(128)"},{"name":"character_maximum_length","type":"int"},{"name":"character_octet_length","type":"int"},{"name":"collation_catalog","type":"nvarchar(128)"},{"name":"collation_schema","type":"nvarchar(128)"},{"name":"collation_name","type":"nvarchar(128)"},{"name":"character_set_catalog","type":"nvarchar(128)"},{"name":"character_set_schema","type":"nvarchar(128)"},{"name":"character_set_name","type":"nvarchar(128)"},{"name":"numeric_precision","type":"tinyint"},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"datetime_precision","type":"smallint"},{"name":"interval_type","type":"nvarchar(30)"},{"name":"interval_precision","type":"smallint"},{"name":"type_udt_catalog","type":"nvarchar(128)"},{"name":"type_udt_schema","type":"nvarchar(128)"},{"name":"type_udt_name","type":"nvarchar(128)"},{"name":"scope_catalog","type":"nvarchar(128)"},{"name":"scope_schema","type":"nvarchar(128)"},{"name":"scope_name","type":"nvarchar(128)"},{"name":"maximum_cardinality","type":"bigint"},{"name":"dtd_identifier","type":"nvarchar(128)"},{"name":"routine_body","type":"nvarchar(30)"},{"name":"routine_definition","type":"nvarchar(4000)"},{"name":"external_name","type":"nvarchar(128)"},{"name":"external_language","type":"nvarchar(30)"},{"name":"parameter_style","type":"nvarchar(30)"},{"name":"is_deterministic","type":"nvarchar(10)"},{"name":"sql_data_access","type":"nvarchar(30)"},{"name":"is_null_call","type":"nvarchar(10)"},{"name":"sql_path","type":"nvarchar(128)"},{"name":"schema_level_routine","type":"nvarchar(10)"},{"name":"max_dynamic_result_sets","type":"smallint"},{"name":"is_user_defined_cast","type":"nvarchar(10)"},{"name":"is_implicitly_invocable","type":"nvarchar(10)"},{"name":"created","type":"datetime","not_null":true},{"name":"last_altered","type":"datetime","not_null":true}]} +{"schema":"information_schema","name":"schemata","kind":"v","columns":[{"name":"catalog_name","type":"nvarchar(128)"},{"name":"schema_name","type":"nvarchar(128)","not_null":true},{"name":"schema_owner","type":"nvarchar(128)"},{"name":"default_character_set_catalog","type":"nvarchar(128)"},{"name":"default_character_set_schema","type":"nvarchar(128)"},{"name":"default_character_set_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"sequences","kind":"v","columns":[{"name":"sequence_catalog","type":"nvarchar(128)"},{"name":"sequence_schema","type":"nvarchar(128)"},{"name":"sequence_name","type":"nvarchar(128)","not_null":true},{"name":"data_type","type":"nvarchar(128)","not_null":true},{"name":"numeric_precision","type":"tinyint","not_null":true},{"name":"numeric_precision_radix","type":"smallint"},{"name":"numeric_scale","type":"int"},{"name":"start_value","type":"sql_variant","not_null":true},{"name":"minimum_value","type":"sql_variant","not_null":true},{"name":"maximum_value","type":"sql_variant","not_null":true},{"name":"increment","type":"sql_variant","not_null":true},{"name":"cycle_option","type":"bit"},{"name":"declared_data_type","type":"nvarchar(128)","not_null":true},{"name":"declared_numeric_precision","type":"tinyint","not_null":true},{"name":"declared_numeric_scale","type":"tinyint","not_null":true}]} +{"schema":"information_schema","name":"table_constraints","kind":"v","columns":[{"name":"constraint_catalog","type":"nvarchar(128)"},{"name":"constraint_schema","type":"nvarchar(128)"},{"name":"constraint_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)"},{"name":"constraint_type","type":"varchar(11)"},{"name":"is_deferrable","type":"varchar(2)","not_null":true},{"name":"initially_deferred","type":"varchar(2)","not_null":true}]} +{"schema":"information_schema","name":"table_privileges","kind":"v","columns":[{"name":"grantor","type":"nvarchar(128)"},{"name":"grantee","type":"nvarchar(128)"},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"privilege_type","type":"varchar(10)"},{"name":"is_grantable","type":"varchar(3)"}]} +{"schema":"information_schema","name":"tables","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"table_type","type":"varchar(10)"}]} +{"schema":"information_schema","name":"view_column_usage","kind":"v","columns":[{"name":"view_catalog","type":"nvarchar(128)"},{"name":"view_schema","type":"nvarchar(128)"},{"name":"view_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"column_name","type":"nvarchar(128)"}]} +{"schema":"information_schema","name":"view_table_usage","kind":"v","columns":[{"name":"view_catalog","type":"nvarchar(128)"},{"name":"view_schema","type":"nvarchar(128)"},{"name":"view_name","type":"nvarchar(128)","not_null":true},{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true}]} +{"schema":"information_schema","name":"views","kind":"v","columns":[{"name":"table_catalog","type":"nvarchar(128)"},{"name":"table_schema","type":"nvarchar(128)"},{"name":"table_name","type":"nvarchar(128)","not_null":true},{"name":"view_definition","type":"nvarchar(4000)"},{"name":"check_option","type":"varchar(7)"},{"name":"is_updatable","type":"varchar(2)","not_null":true}]} diff --git a/internal/goldeneye/README.md b/internal/goldeneye/README.md index d7158fcb13..e4e8374fff 100644 --- a/internal/goldeneye/README.md +++ b/internal/goldeneye/README.md @@ -10,15 +10,18 @@ the tests compare it with what is committed, byte for byte. A difference means the committed dialect has drifted from the database. It is a nested Go module, so its only dependencies beyond the standard -library are the PostgreSQL and MySQL drivers, and it never shares code with -the analysis that reads the files: the files are the contract. Run it from -this directory: +library are the database clients — PostgreSQL's, MySQL's and SQL Server's +drivers, and Spanner's gRPC client with what it stands on — and it never +shares code with the analysis that reads the files: the files are the +contract. Run it from this directory: ```bash go run ./cmd/goldeneye install clickhouse # download the pinned clickhouse binary once +go run ./cmd/goldeneye install duckdb # download the current DuckDB 2.0 preview build once go run ./cmd/goldeneye install sqlite # build the pinned sqlite3 shells once; needs a C compiler go run ./cmd/goldeneye check # check every engine whose database is available go run ./cmd/goldeneye check postgresql # check one engine +go run ./cmd/goldeneye check spanner # SPANNER_SERVER_URI=localhost:15000, a Spanner Omni container go run ./cmd/goldeneye generate [engine] # rewrite the generated files from the database go test ./... # the same checks as tests; engines without a database skip ``` @@ -60,10 +63,20 @@ the hand-written files alone, and the checks do not look at them. knows a system schema when it sees one. The server has to be the major release pinned in `mysql.Major`, since every release adds to `information_schema`. -- **`duckdb`** reads the DuckDB CLI named by `DUCKDB`, or `duckdb` on `PATH`: - `types.jsonl`, `functions.jsonl` and `operators.jsonl` come from - `duckdb_types()` and `duckdb_functions()`. The CLI has to be the DuckDB 2.0 - build darkwing is pinned against, which has no release to download yet. +- **`duckdb`** reads the DuckDB CLI named by `DUCKDB`, or the one `install` + put in the user cache directory, or `duckdb` on `PATH`: `types.jsonl`, + `functions.jsonl` and `operators.jsonl` come from `duckdb_types()` and + `duckdb_functions()`. The CLI has to be a DuckDB 2.0 build, the release + darkwing is pinned against, which has no release to download yet: until + 2.0 is out, `install` downloads the current build of DuckDB's v2.0 + preview channel, `duckdb.DefaultVersion`, a rolling tarball per platform + under `artifacts.duckdb.org` with no per-build download and no checksum + to pin, so what a run logs is the version the CLI reports, and + `duckdb.GeneratedFrom` records the build the committed dialect came + from. A check against a later build reports what the later build added; + regenerate, and update `GeneratedFrom`, to move the dialect along. Once + 2.0 is released, the installer should pin the release and its checksums + the way the clickhouse one does. - **`clickhouse`** needs no server: `types.jsonl` comes from `system.data_type_families` of an ephemeral `clickhouse local` process, every family that is not an alias becoming a type carrying the spellings @@ -74,6 +87,43 @@ the hand-written files alone, and the checks do not look at them. `clickhouse/install.go`, and a download that does not match is discarded. ClickHouse describes its functions no further than their names, so `functions.jsonl` is hand-written. +- **`mssql`** reads a live server named by `MSSQL_SERVER_URI`, in any form + the go-mssqldb driver accepts, such as + `sqlserver://sa:password@127.0.0.1:1433?encrypt=disable`. SQL Server keeps + no catalog of its intrinsic functions or its operators — GETDATE and LEN + are not objects — so `types.jsonl` and `functions.jsonl` are hand-written. + What it does describe is its catalog: `relations.jsonl` is every view of + the `sys` and `INFORMATION_SCHEMA` schemas, listed from a database of its + own, since the views a query sees are the ones a user database has and + `master` lists internal views no query can name; each view's columns are + what `sys.dm_exec_describe_first_result_set` says a `SELECT *` from it + returns, the type spelled the way a declaration spells it — + `nvarchar(128)`, `decimal(10,2)`, `varbinary(max)` — and the nullability + the server computes. Names are written in lower case, since SQL Server + matches them in any case under its default collations and sqlc's parser + lowercases every identifier. Both schemas hold nothing but views, so no + table is seeded that codegen would take for a model. The server has to + be the major release pinned in `mssql.Major`, since every release adds + to the catalog views. +- **`spanner`** reads a live Spanner Omni server — the downloadable + Spanner, run from its container image — named by `SPANNER_SERVER_URI`, + the gRPC endpoint such as `localhost:15000`, reached without TLS or + credentials as Omni is, and writes into `internal/engine/googlesql/dialect`, + since sqlc's engine is named after the language Spanner speaks. Spanner + keeps no catalog of its types, functions or operators, so `types.jsonl`, + `functions.jsonl` and `operators.jsonl` are hand-written. What it does + describe is its information schema: `relations.jsonl` is every view of + `INFORMATION_SCHEMA` and `SPANNER_SYS`, read from `INFORMATION_SCHEMA` + itself in a database created for the purpose in the instance Omni's + single server provides, `projects/default/instances/default`. Names are + kept as the catalog spells them, in upper case: Spanner matches a name + in any case, but sqlc's GoogleSQL engine matches one as it is spelled, + so a query reaches these views by their upper-case names until the + engine folds case; a column's type is spelled in lower case the way the seed + spells one, an `ARRAY` as `T` with the array flag, a `STRUCT` as + `struct(a: t)` and a `PROTO` as `proto('p.M')`, since a seed writes + a type's arguments in parentheses. The container image is pinned in the + gen workflow and `docker-compose.yml`. - **`sqlite`** needs no server either: `functions.jsonl` comes from `pragma_function_list` of a `sqlite3` shell run against an in-memory database. Which functions a SQLite has is decided when it is compiled, so @@ -117,9 +167,10 @@ the hand-written files alone, and the checks do not look at them. - `endtoend/` — finds the analyze cases, splits their query files, and compares an engine's answer with a case's committed output. - `analysis/` — the shape of that answer: the JSON `sqlc analyze` prints. -- `postgresql/`, `mysql/`, `duckdb/`, `clickhouse/`, `sqlite/` — one package - per engine, each exposing `Locate`, `Version` and `Generate`, `Analyze` - where the engine has an analysis check, and tests that run the checks. +- `postgresql/`, `mysql/`, `mssql/`, `spanner/`, `duckdb/`, `clickhouse/`, + `sqlite/` — one package per engine, each exposing `Locate`, `Version` and + `Generate`, `Analyze` where the engine has an analysis check, and tests + that run the checks. - `cmd/goldeneye/` — the command. ## Analysis checks @@ -195,4 +246,97 @@ asks for `--ast` is skipped, since only sqlc can print that. is why a column read from a table, directly or through a derived table, is spelled the way the table declares it. +- **`duckdb`** runs each case through the CLI, which loads the schema and + fixture into an in-memory database of their own, one process per + question, and is asked four things about each query. What its + parameters are: the query is prepared and explained as JSON with a + string sentinel bound to each parameter, `EXECUTE q('goldeneye_1', + ...)`, and the unoptimized logical plan the CLI prints under + `explain_output = 'all'` shows each as `CAST('goldeneye_k' AS T)`, `T` + being the type the binder gave the parameter, or bare when that type is + `VARCHAR`; a sentinel the binder converts on the spot, as an `INSERT`'s + `VALUES` are, is bound to NULL instead. What its result columns are: `DESCRIBE`, with each parameter + replaced by a NULL of its type, names and types them; DuckDB describes + no DML, so a `RETURNING` column is the target table's column it names. + Which table a result column is read from and which column a parameter + stands in for: DuckDB prints a plan with every column by its bare name + and every aliased expression by its alias, so these are read from the + query text, the select list's items, a star expanded to its table's + columns, and the operand beside each parameter, resolved against the + `FROM` clause and the catalog, `duckdb_columns()`, from which a column + read from a table takes its declared type and nullability; a parameter + the query casts takes the cast's type as DuckDB spells it, and one + inside a subquery, whose tables the statement's scope does not name, + takes the binder's. And whether + an expression can be NULL, which DuckDB does not track: the query is + run, with each parameter bound to a value of its type, over the fixture + and over no rows, and a column is nullable when either run returns a + NULL for it. DuckDB spells an enum column by its labels whether the + schema named the type or not, so labels that are those of an enum the + schema created name that type, and a spelling `types.jsonl` lists as an + alias — `json`, which DuckDB's own catalog lists as a spelling of + `varchar` — is reported by the dialect's name for it. +- **`mssql`** describes each case in a database of its own on the server + named by `MSSQL_SERVER_URI`, without running anything: the schema is + loaded one statement at a time, since a `CREATE TYPE` has to be its own + batch before a table can use the type, and the server is asked three + things about each query. What a driver would see: + `sys.dm_exec_describe_first_result_set` describes each result column — + its name, its type spelled the way a declaration spells it, whether it + can be NULL, and which table column it is read from. What each parameter + would be: `sp_describe_undeclared_parameters` says what type the server + would give each parameter the query leaves undeclared, which is the type + of a `CAST(@p AS T)`; it describes a parameter only when it is used + once, so each appearance of a repeated one becomes a variable of its + own. And what each parameter stands in for: the estimated showplan, + compiled with `SET SHOWPLAN_XML ON` and the parameters declared as those + types, prints every column as a reference naming its table and every + variable as `@variable`, and a parameter's partner is the column on the + other side of the `Compare` it is an operand of, the column an `Assign` + sets to it, or the column of a seek whose range expression it is, with a + named expression such as `Expr1002` followed to its definition; a + parameter under a `CONVERT` the query wrote has no partner, since the + cast says what it is. A parameter with a partner is described as that + column, from the catalog of the case's database. Three things the + describing function keeps to itself: a `json` or `vector` column is + described by the `nvarchar(max)` it is sent to a driver as, so a column + read from a table is typed from `sys.columns` instead; a type the + schema created is reported beside the system type it stands on, and the + dialect reports it by its own name; and a spelling `types.jsonl` lists + as an alias — `numeric`, `timestamp` — is reported by the dialect's name + for it, `decimal`, `rowversion`. One thing it says that sqlc does not: a + computed column — a cast, an arithmetic — is nullable whatever its + arguments, since a conversion that fails under `ANSI_WARNINGS OFF` + yields NULL, where sqlc follows the arguments, and a computed column + names the column it is computed from, as the one an update through the + result set would write, where sqlc gives an expression no table. The + cases compute over nullable columns, and a computed column is reported + without a table. +- **`spanner`** creates a database of each case's own from its schema in + the instance named by `SPANNER_SERVER_URI`, writes its fixture there in a + read-write transaction, and compiles each query in `PLAN` mode, which + runs nothing: a DML statement is compiled in a read-write transaction + that is rolled back. The server reports the name and type of each + result column and the type of each parameter the query leaves + undeclared, the way the wire spells them — `STRING`, `ARRAY` — + without the length a declaration gives a `STRING(10)` or whether a + column can be NULL, and the query plan, which says where each comes + from: the children of `Serialize Result` after the relation it + serializes are the result columns, a `Scan` of a table defines a + variable per column it reads, and a comparison is a `Function` whose + description reads `($col = @param)`. A result column the plan reads + from a table column, directly or through the variables a join or a + batch passes it through, is described from the case's + `INFORMATION_SCHEMA`, with its declared length and nullability; one the + plan reads as a parameter is the column the parameter is compared with, + which is why the optimizer substituted it. A parameter compared with a + table column is described as that column. A DML plan lists the values + it writes before the columns it returns — the table's key columns, then + the columns an `UPDATE` sets or an `INSERT` inserts, read from the + statement — and a parameter written to a column is described as it, + while a `THEN RETURN` column is the table's column of that name. Two + things Spanner does not say: whether an expression can be NULL, which + is reported as it is not, and anything about a `STRUCT` returned as a + column, which Spanner rejects. + The other engines have no analysis check yet. diff --git a/internal/goldeneye/cmd/goldeneye/main.go b/internal/goldeneye/cmd/goldeneye/main.go index 1d46f03b6a..2eb6f80309 100644 --- a/internal/goldeneye/cmd/goldeneye/main.go +++ b/internal/goldeneye/cmd/goldeneye/main.go @@ -6,6 +6,7 @@ // Usage, from internal/goldeneye: // // go run ./cmd/goldeneye install clickhouse # download the pinned clickhouse binary +// go run ./cmd/goldeneye install duckdb # download the current DuckDB 2.0 preview build // go run ./cmd/goldeneye install sqlite # build the pinned sqlite3 shells from source // go run ./cmd/goldeneye generate [engine] # rewrite the generated files from the database // go run ./cmd/goldeneye check [engine] # compare the committed files and analyze cases with the database @@ -29,8 +30,10 @@ import ( "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" "github.com/sqlc-dev/sqlc/internal/goldeneye/duckdb" "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" + "github.com/sqlc-dev/sqlc/internal/goldeneye/mssql" "github.com/sqlc-dev/sqlc/internal/goldeneye/mysql" "github.com/sqlc-dev/sqlc/internal/goldeneye/postgresql" + "github.com/sqlc-dev/sqlc/internal/goldeneye/spanner" "github.com/sqlc-dev/sqlc/internal/goldeneye/sqlite" ) @@ -42,23 +45,30 @@ func main() { } const usage = `usage: - goldeneye install clickhouse|sqlite [-version V] + goldeneye install clickhouse|duckdb|sqlite [-version V] put the pinned release of an engine into the user cache directory: clickhouse is - downloaded, sqlite is built from the downloaded amalgamation with cc or $CC + downloaded, duckdb is downloaded from its v2.0 preview channel, sqlite is built from + the downloaded amalgamation with cc or $CC goldeneye generate [engine] rewrite the generated dialect files from the database, for every available engine or one goldeneye check [engine] compare the committed dialect files and analyze cases with the database, for every available engine or one - postgresql and mysql read the server POSTGRESQL_SERVER_URI and MYSQL_SERVER_URI name + postgresql, mysql, mssql and spanner read the server POSTGRESQL_SERVER_URI, MYSQL_SERVER_URI, + MSSQL_SERVER_URI and SPANNER_SERVER_URI name -engines: clickhouse, duckdb, mysql, postgresql, sqlite` +engines: clickhouse, duckdb, mssql, mysql, postgresql, spanner, sqlite` // engine is one database goldeneye knows how to read a dialect from. type engine struct { name string // dir is the engine directory the dialect lives under, when it is not - // named after the engine: MySQL's is dolphin, after its parser. + // named after the engine: MySQL's is dolphin, after its parser, and + // Spanner's is googlesql, after the language. dir string + // cases is the name of the analyze case directories under + // internal/endtoend/testdata, when it is not the engine's name: + // Spanner's are googlesql's. + cases string // locate finds the database — a binary or a connection URL — or says // why it is not available. locate func() (string, error) @@ -72,11 +82,13 @@ type engine struct { } var engines = []engine{ - {clickhouse.Engine, "", clickhouse.Locate, clickhouse.Version, clickhouse.Generate, clickhouse.Analyze}, - {duckdb.Engine, "", duckdb.Locate, duckdb.Version, duckdb.Generate, nil}, - {mysql.Engine, mysql.Dir, mysql.Locate, mysql.Version, mysql.Generate, mysql.Analyze}, - {postgresql.Engine, "", postgresql.Locate, postgresql.Version, postgresql.Generate, nil}, - {sqlite.Engine, "", sqlite.Locate, sqlite.Version, sqlite.Generate, sqlite.Analyze}, + {clickhouse.Engine, "", "", clickhouse.Locate, clickhouse.Version, clickhouse.Generate, clickhouse.Analyze}, + {duckdb.Engine, "", "", duckdb.Locate, duckdb.Version, duckdb.Generate, duckdb.Analyze}, + {mssql.Engine, "", "", mssql.Locate, mssql.Version, mssql.Generate, mssql.Analyze}, + {mysql.Engine, mysql.Dir, "", mysql.Locate, mysql.Version, mysql.Generate, mysql.Analyze}, + {postgresql.Engine, "", "", postgresql.Locate, postgresql.Version, postgresql.Generate, nil}, + {spanner.Engine, spanner.Dir, spanner.Cases, spanner.Locate, spanner.Version, spanner.Generate, spanner.Analyze}, + {sqlite.Engine, "", "", sqlite.Locate, sqlite.Version, sqlite.Generate, sqlite.Analyze}, } // dialectDir returns the engine's dialect directory. @@ -96,6 +108,7 @@ type installer struct { var installers = map[string]installer{ clickhouse.Engine: {clickhouse.DefaultVersion, clickhouse.Install}, + duckdb.Engine: {duckdb.DefaultVersion, duckdb.Install}, sqlite.Engine: {sqlite.DefaultVersion, sqlite.Install}, } @@ -121,11 +134,11 @@ func run(ctx context.Context, args []string, stdout, stderr io.Writer) error { func install(ctx context.Context, args []string, stdout, stderr io.Writer) error { if len(args) == 0 { - return errors.New("install takes the engine to install: clickhouse or sqlite") + return errors.New("install takes the engine to install: clickhouse, duckdb or sqlite") } inst, ok := installers[args[0]] if !ok { - return fmt.Errorf("install takes the engine to install, clickhouse or sqlite, not %q", args[0]) + return fmt.Errorf("install takes the engine to install, clickhouse, duckdb or sqlite, not %q", args[0]) } fs := flag.NewFlagSet("install "+args[0], flag.ContinueOnError) fs.SetOutput(stderr) @@ -233,7 +246,11 @@ func checkAnalyzeCases(ctx context.Context, e engine, handle string, stderr io.W if e.analyze == nil { return nil } - cases, err := endtoend.Cases(e.name) + name := e.cases + if name == "" { + name = e.name + } + cases, err := endtoend.Cases(name) if err != nil { return err } diff --git a/internal/goldeneye/duckdb/analyze.go b/internal/goldeneye/duckdb/analyze.go new file mode 100644 index 0000000000..08283aebf5 --- /dev/null +++ b/internal/goldeneye/duckdb/analyze.go @@ -0,0 +1,846 @@ +package duckdb + +import ( + "bytes" + "context" + "encoding/csv" + "encoding/json" + "errors" + "fmt" + "io" + "os" + "os/exec" + "regexp" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// The analyze cases are checked against the DuckDB CLI, which runs each +// case's schema and fixture into an in-memory database of their own, one +// process per question, and is asked four things about each query. What +// its parameters are: the query is prepared and explained, as JSON, with +// a string sentinel bound to each parameter, and the unoptimized logical +// plan the CLI prints first shows each as CAST('goldeneye_k' AS T), T +// being the type the binder gave the parameter, or bare when that type +// is VARCHAR. What its result columns are: +// DESCRIBE, with each parameter replaced by a NULL of that type, names and +// types them. Which column each is read from and which column a parameter +// stands in for: DuckDB prints a plan with every column by its bare name, +// so these are read from the query text, the select list's items and the +// operand beside each parameter resolved against the FROM clause and the +// catalog, from which a column read from a table takes its declared type +// and nullability. And whether an expression can be NULL, which DuckDB +// does not track: the query is run, with each parameter bound to a value +// of its type, over the fixture and over no rows, and a column is nullable +// when either run returns a NULL for it. + +// placeholder is one parameter of a query as sqlc numbers them: a $n by +// its number, and each $name, sqlc.arg name or ? in turn at its first +// appearance, taking the lowest number no $n took. +type placeholder struct { + Number int + Name string +} + +var ( + numberedRe = regexp.MustCompile(`^\$([0-9]+)`) + namedRe = regexp.MustCompile(`^\$([A-Za-z_][A-Za-z0-9_]*)`) + sqlcArgRe = regexp.MustCompile(`^sqlc\.(n?arg|slice)\(\s*'?([A-Za-z_][A-Za-z0-9_]*)'?\s*\)`) +) + +// bind rewrites the query so that every parameter is a $k numbered as +// sqlc numbers it, and lists the parameters in that order. +func bind(query string) (string, []placeholder) { + type occurrence struct { + start, end int + number int // for $n + name string // for $name or sqlc.arg, "" for ? + } + var occ []occurrence + i := 0 + for i < len(query) { + c := query[i] + switch { + case c == '\'' || c == '"': + i = quotedEnd(query, i) + case strings.HasPrefix(query[i:], "--"): + end := strings.IndexByte(query[i:], '\n') + if end < 0 { + i = len(query) + } else { + i += end + } + case strings.HasPrefix(query[i:], "/*"): + end := strings.Index(query[i:], "*/") + if end < 0 { + i = len(query) + } else { + i += end + 2 + } + case c == '?': + occ = append(occ, occurrence{start: i, end: i + 1}) + i++ + case c == '$' && numberedRe.MatchString(query[i:]): + m := numberedRe.FindStringSubmatch(query[i:]) + n, _ := strconv.Atoi(m[1]) + occ = append(occ, occurrence{start: i, end: i + len(m[0]), number: n}) + i += len(m[0]) + case c == '$' && namedRe.MatchString(query[i:]): + m := namedRe.FindStringSubmatch(query[i:]) + occ = append(occ, occurrence{start: i, end: i + len(m[0]), name: m[1]}) + i += len(m[0]) + case c == 's' && sqlcArgRe.MatchString(query[i:]): + m := sqlcArgRe.FindStringSubmatch(query[i:]) + occ = append(occ, occurrence{start: i, end: i + len(m[0]), name: m[2]}) + i += len(m[0]) + default: + i++ + } + } + taken := map[int]bool{} + for _, o := range occ { + if o.number > 0 { + taken[o.number] = true + } + } + byName := map[string]int{} + next := 1 + assign := func(o occurrence) int { + if o.number > 0 { + return o.number + } + if n, ok := byName[o.name]; ok && o.name != "" { + return n + } + for taken[next] { + next++ + } + n := next + taken[n] = true + if o.name != "" { + byName[o.name] = n + } + return n + } + var phs []placeholder + numbered := map[int]bool{} + var out strings.Builder + last := 0 + for _, o := range occ { + n := assign(o) + if !numbered[n] { + numbered[n] = true + phs = append(phs, placeholder{Number: n, Name: o.name}) + } + out.WriteString(query[last:o.start]) + out.WriteString("$" + strconv.Itoa(n)) + last = o.end + } + out.WriteString(query[last:]) + for i := 1; i < len(phs); i++ { + for j := i; j > 0 && phs[j-1].Number > phs[j].Number; j-- { + phs[j-1], phs[j] = phs[j], phs[j-1] + } + } + return out.String(), phs +} + +// nullMarker is what a NULL is printed as when the CLI prints CSV, unlike +// any value a case holds. +const nullMarker = "" + +// analyzer holds the CLI a case runs through, the case's schema and +// fixture, and the catalog of the schema. +type analyzer struct { + binary string + schema string // the schema's statements, each ending in ; + fixture string // the fixture's, or "" + tables map[string][]column + enums map[string][]string // the labels of each enum type the schema created + // canonical names the type the dialect reports a spelling as, for + // each alias types.jsonl lists: DuckDB spells a JSON column json, + // which its own catalog lists as a spelling of varchar. + canonical map[string]string +} + +// readAliases reads the aliases the generated types.jsonl gives each +// type, keyed by alias. +func readAliases() (map[string]string, error) { + dir, err := dialect.Dir(Engine) + if err != nil { + return nil, err + } + types, err := dialect.ReadTypes(dir) + if err != nil { + return nil, err + } + canonical := map[string]string{} + for _, t := range types { + for _, alias := range t.Aliases { + canonical[strings.ToLower(alias)] = strings.ToLower(t.Name) + } + } + return canonical, nil +} + +// run executes a script in a fresh in-memory database loaded with the +// schema and, unless told otherwise, the fixture, and returns what the +// CLI printed in the mode asked for: "json" prints one JSON array per +// statement that returns rows, "csv" prints rows with a header and NULL +// as nullMarker, and "" prints the CLI's own text, which is how EXPLAIN +// draws a plan. A statement that fails ends the script with DuckDB's own +// error message. +func (a *analyzer) run(ctx context.Context, script, mode string, withFixture bool) (string, error) { + args := []string{"-bail"} + switch mode { + case "json": + args = append(args, "-json") + case "csv": + args = append(args, "-csv", "-header", "-nullvalue", nullMarker) + } + args = append(args, ":memory:") + cmd := exec.CommandContext(ctx, a.binary, args...) + prelude := a.schema + if withFixture { + prelude += a.fixture + } + cmd.Stdin = strings.NewReader(prelude + script) + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + if err := cmd.Run(); err != nil { + msg := strings.TrimSpace(stderr.String()) + if msg == "" { + msg = err.Error() + } + return "", errors.New(msg) + } + return stdout.String(), nil +} + +// query runs one statement and decodes the rows it printed. +func (a *analyzer) query(ctx context.Context, statement string) ([]map[string]json.RawMessage, error) { + out, err := a.run(ctx, statement+";\n", "json", true) + if err != nil { + return nil, err + } + var rows []map[string]json.RawMessage + dec := json.NewDecoder(strings.NewReader(out)) + for { + var rs []map[string]json.RawMessage + err := dec.Decode(&rs) + if errors.Is(err, io.EOF) { + break + } + if err != nil { + return nil, fmt.Errorf("decoding duckdb output: %w", err) + } + rows = append(rows, rs...) + } + return rows, nil +} + +func str(v json.RawMessage) string { + var s string + json.Unmarshal(v, &s) + return s +} + +// column is what the catalog says about a column of a table. +type column struct { + name string + spelling string // the type as DuckDB spells it + typ *analysis.TypeExpr + nullable bool +} + +// statements joins a script's statements, each ending in a semicolon. +func statements(src string) string { + s := strings.TrimRight(strings.TrimSpace(src), ";") + if s == "" { + return "" + } + return s + ";\n" +} + +// Analyze runs a case's queries through the CLI and returns what DuckDB +// reports in the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, binary string, c endtoend.Case) ([]byte, error) { + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + a := &analyzer{binary: binary, schema: statements(string(schema)), fixture: statements(string(fixture))} + if a.canonical, err = readAliases(); err != nil { + return nil, err + } + if err := a.readCatalog(ctx); err != nil { + return nil, err + } + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := a.analyzeQuery(ctx, q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return analysis.Encode(out) +} + +// Check compares what DuckDB reports for a case with the output the case +// committed, returning a diff when they differ. +func Check(ctx context.Context, binary string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, binary, c) + if err != nil { + return "", err + } + return c.Compare(got) +} + +// readCatalog reads the tables and enum types the schema created. +func (a *analyzer) readCatalog(ctx context.Context) error { + rows, err := a.query(ctx, `SELECT type_name, labels FROM duckdb_types() WHERE database_name = 'memory' AND NOT internal AND logical_type = 'ENUM' ORDER BY type_name`) + if err != nil { + return err + } + a.enums = map[string][]string{} + for _, row := range rows { + var labels []string + json.Unmarshal(row["labels"], &labels) + a.enums[strings.ToLower(str(row["type_name"]))] = labels + } + rows, err = a.query(ctx, `SELECT table_name, column_name, data_type, is_nullable FROM duckdb_columns() WHERE database_name = 'memory' ORDER BY table_oid, column_index`) + if err != nil { + return err + } + a.tables = map[string][]column{} + for _, row := range rows { + table := strings.ToLower(str(row["table_name"])) + var nullable bool + json.Unmarshal(row["is_nullable"], &nullable) + spelling := str(row["data_type"]) + a.tables[table] = append(a.tables[table], column{ + name: str(row["column_name"]), + spelling: spelling, + typ: a.parseType(spelling), + nullable: nullable, + }) + } + return nil +} + +// lookup finds a column of a table, which DuckDB matches in any case. +func (a *analyzer) lookup(table, name string) (column, bool) { + for _, col := range a.tables[strings.ToLower(table)] { + if strings.EqualFold(col.name, name) { + return col, true + } + } + return column{}, false +} + +// resolve finds the table a reference names in a scope: the table its +// qualifier aliases, or the one table of the scope that has the column. +func (a *analyzer) resolve(sc scope, r ref) (string, column, bool) { + tables := sc.tables + if sc.target.name != "" { + tables = append([]tableRef{sc.target}, tables...) + } + if r.qualifier != "" { + if sc.ctes[r.qualifier] { + return "", column{}, false + } + for _, t := range tables { + if t.alias == r.qualifier || (t.alias == "" && t.name == r.qualifier) { + col, ok := a.lookup(t.name, r.column) + return t.name, col, ok + } + } + return "", column{}, false + } + var found string + var fc column + for _, t := range tables { + if col, ok := a.lookup(t.name, r.column); ok { + if found != "" && found != t.name { + return "", column{}, false + } + found, fc = t.name, col + } + } + return found, fc, found != "" +} + +// describe reads what the catalog says about a column read from a table. +func describe(table string, col column) analysis.Column { + return analysis.Column{Name: col.name, Type: withNullable(col.typ, col.nullable), Table: table} +} + +func withNullable(t *analysis.TypeExpr, nullable bool) *analysis.TypeExpr { + if t == nil { + return nil + } + out := *t + out.Nullable = nullable + return &out +} + +// binding is what is known about one parameter: the type the binder gave +// it, spelled as DuckDB spells it, and the column it stands in for. +type binding struct { + spelling string + typ *analysis.TypeExpr + column *analysis.Column +} + +var ( + sentinelCastRe = regexp.MustCompile(`CAST\('goldeneye_([0-9]+)' AS `) + sentinelRe = regexp.MustCompile(`'goldeneye_([0-9]+)'`) + sentinelErrRe = regexp.MustCompile(`goldeneye_([0-9]+)`) +) + +// explain prepares the query, explains it with a sentinel bound to each +// parameter and returns the type the binder gave each, keyed by number. +// A parameter whose sentinel the binder converts on the spot, as an +// INSERT's VALUES are, is bound to NULL instead and reported by nothing: +// the error names the sentinel for most types, and for the rest the +// parameters not yet bound to NULL are tried in turn. +func (a *analyzer) explain(ctx context.Context, sql string, phs []placeholder) (map[int]string, error) { + null := map[int]bool{} + for attempt := 0; attempt <= len(phs); attempt++ { + args := make([]string, len(phs)) + for i, ph := range phs { + if null[ph.Number] { + args[i] = "NULL" + } else { + args[i] = fmt.Sprintf("'goldeneye_%d'", ph.Number) + } + } + script := "PREPARE goldeneye AS " + sql + ";\nSET explain_output = 'all';\nEXPLAIN (FORMAT json) EXECUTE goldeneye(" + strings.Join(args, ", ") + ");\n" + out, err := a.run(ctx, script, "", true) + if err != nil { + if !strings.Contains(err.Error(), "Conversion Error") && !strings.Contains(err.Error(), "can't be cast") { + return nil, err + } + retry := false + if m := sentinelErrRe.FindStringSubmatch(err.Error()); m != nil { + n, _ := strconv.Atoi(m[1]) + if !null[n] { + null[n] = true + retry = true + } + } + if !retry { + for _, ph := range phs { + if !null[ph.Number] { + null[ph.Number] = true + retry = true + break + } + } + } + if !retry { + return nil, err + } + continue + } + return sentinelTypes(out) + } + return nil, errors.New("could not bind the parameters") +} + +// planNode is one operator of a plan the CLI prints as JSON. Its +// extra_info holds the operator's expressions, each a string or a list +// of strings. +type planNode struct { + Name string `json:"name"` + Children []planNode `json:"children"` + ExtraInfo map[string]json.RawMessage `json:"extra_info"` +} + +// sentinelTypes reads the type each sentinel is cast to out of the plans +// the CLI printed, one JSON array per plan: the unoptimized logical plan +// comes first, and the first cast of a sentinel wins. A sentinel the +// plan prints bare is a VARCHAR, which the binder needs no cast for. +func sentinelTypes(out string) (map[int]string, error) { + var texts []string + var walk func(n planNode) + walk = func(n planNode) { + for _, raw := range n.ExtraInfo { + var one string + if json.Unmarshal(raw, &one) == nil { + texts = append(texts, one) + continue + } + var many []string + if json.Unmarshal(raw, &many) == nil { + texts = append(texts, many...) + } + } + for _, c := range n.Children { + walk(c) + } + } + dec := json.NewDecoder(strings.NewReader(out)) + for { + var plan []planNode + err := dec.Decode(&plan) + if errors.Is(err, io.EOF) { + break + } + if err != nil { + return nil, fmt.Errorf("decoding the plan: %w", err) + } + for _, n := range plan { + walk(n) + } + } + types := map[int]string{} + for _, text := range texts { + for _, m := range sentinelCastRe.FindAllStringSubmatchIndex(text, -1) { + n, _ := strconv.Atoi(text[m[2]:m[3]]) + if _, ok := types[n]; ok { + continue + } + // The type runs to the parenthesis closing the CAST. + depth := 1 + i := m[1] + for ; i < len(text); i++ { + if text[i] == '(' { + depth++ + } else if text[i] == ')' { + depth-- + if depth == 0 { + break + } + } + } + types[n] = strings.Join(strings.Fields(text[m[1]:i]), " ") + } + } + for _, text := range texts { + for _, m := range sentinelRe.FindAllStringSubmatchIndex(text, -1) { + n, _ := strconv.Atoi(text[m[2]:m[3]]) + if _, ok := types[n]; !ok && !strings.HasSuffix(text[:m[0]], "CAST(") { + types[n] = "VARCHAR" + } + } + } + return types, nil +} + +// analyzeQuery describes one query. +func (a *analyzer) analyzeQuery(ctx context.Context, q endtoend.Query) (analysis.Query, error) { + sql, phs := bind(q.SQL) + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + t := text(tokenize(sql)) + sc := t.readScope() + + // Parameters: a partner column first, then the cast the query wraps + // the parameter in, then the type the binder gave it. + bindings := map[int]*binding{} + var casts []string + var castNumbers []int + for _, ph := range phs { + k := strconv.Itoa(ph.Number) + b := &binding{} + bindings[ph.Number] = b + if t.inSubquery(k) { + // A parameter inside a subquery is compared with a column of + // the subquery's own tables, which the statement's scope does + // not name. + if typ, ok := t.castOf(k); ok { + casts = append(casts, typ) + castNumbers = append(castNumbers, ph.Number) + } + continue + } + if sc.kind == "insert" { + if pos, ok := t.valuesPosition(k); ok { + cols := t.insertColumns() + if cols == nil { + for _, col := range a.tables[sc.target.name] { + cols = append(cols, col.name) + } + } + if pos < len(cols) { + if col, ok := a.lookup(sc.target.name, cols[pos]); ok { + c := describe(sc.target.name, col) + b.column, b.spelling, b.typ = &c, col.spelling, col.typ + continue + } + } + } + } + if r, ok := t.partner(k); ok { + if table, col, ok := a.resolve(sc, r); ok { + c := describe(table, col) + b.column, b.spelling, b.typ = &c, col.spelling, col.typ + continue + } + } + if typ, ok := t.castOf(k); ok { + casts = append(casts, typ) + castNumbers = append(castNumbers, ph.Number) + } + } + if len(casts) > 0 { + // DuckDB spells the cast's type: VARCHAR(5) is VARCHAR, mood is + // ENUM('sad', 'ok'). + var items []string + for i, typ := range casts { + items = append(items, fmt.Sprintf("CAST(NULL AS %s) AS p%d", typ, i)) + } + rows, err := a.query(ctx, "DESCRIBE SELECT "+strings.Join(items, ", ")) + if err != nil { + return analysis.Query{}, err + } + for i, row := range rows { + if i < len(castNumbers) { + b := bindings[castNumbers[i]] + b.spelling = str(row["column_type"]) + b.typ = a.parseType(b.spelling) + } + } + } + if len(phs) > 0 { + types, err := a.explain(ctx, sql, phs) + if err != nil { + return analysis.Query{}, err + } + for n, spelling := range types { + if b := bindings[n]; b != nil && b.typ == nil { + b.spelling = spelling + b.typ = a.parseType(spelling) + } + } + } + + // Result columns. + var columns []analysis.Column + switch sc.kind { + case "select": + rows, err := a.query(ctx, "DESCRIBE "+a.substitute(sql, phs, bindings, false)) + if err != nil { + return analysis.Query{}, err + } + for _, row := range rows { + columns = append(columns, analysis.Column{Name: str(row["column_name"]), Type: a.parseType(str(row["column_type"]))}) + } + a.attribute(sc, t.selectItems(), columns) + default: + // A RETURNING column is the target table's column it names; + // DuckDB describes no DML, so an expression is typed by nothing. + for _, it := range t.returningItems() { + switch { + case it.star: + for _, col := range a.tables[sc.target.name] { + columns = append(columns, describe(sc.target.name, col)) + } + case it.ref != nil: + if table, col, ok := a.resolve(sc, *it.ref); ok { + c := describe(table, col) + c.Name = it.name + columns = append(columns, c) + continue + } + columns = append(columns, analysis.Column{Name: it.name}) + default: + columns = append(columns, analysis.Column{Name: it.name}) + } + } + } + if len(columns) > 0 { + nullable := a.observe(ctx, sql, phs, bindings, len(columns)) + for i := range columns { + if columns[i].Table == "" && columns[i].Type != nil && nullable[i] { + columns[i].Type = withNullable(columns[i].Type, true) + } + } + } + aq.Columns = append(aq.Columns, columns...) + + for _, ph := range phs { + b := bindings[ph.Number] + ac := analysis.Column{Type: b.typ} + if b.column != nil { + ac = *b.column + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} + +// attribute says which table each result column is read from, by +// matching the select list's items, a star expanded to its table's +// columns, against the columns DuckDB described. A list that expands to +// another number of columns than DuckDB describes attributes nothing. +func (a *analyzer) attribute(sc scope, items []item, columns []analysis.Column) { + var origins []*analysis.Column + for _, it := range items { + switch { + case it.star && it.ref == nil: + for _, t := range sc.tables { + for _, col := range a.tables[t.name] { + c := describe(t.name, col) + origins = append(origins, &c) + } + } + case it.star: + table, ok := a.aliased(sc, it.ref.qualifier) + if !ok { + return + } + for _, col := range a.tables[table] { + c := describe(table, col) + origins = append(origins, &c) + } + case it.ref != nil: + if table, col, ok := a.resolve(sc, *it.ref); ok { + c := describe(table, col) + origins = append(origins, &c) + } else { + origins = append(origins, nil) + } + default: + origins = append(origins, nil) + } + } + if len(origins) != len(columns) { + return + } + for i, o := range origins { + if o != nil { + columns[i].Type = o.Type + columns[i].Table = o.Table + } + } +} + +// aliased finds the table a qualifier names in a scope. +func (a *analyzer) aliased(sc scope, qualifier string) (string, bool) { + for _, t := range sc.tables { + if t.alias == qualifier || (t.alias == "" && t.name == qualifier) { + if _, ok := a.tables[t.name]; ok { + return t.name, true + } + } + } + return "", false +} + +// substitute replaces each parameter with a NULL of its type, or with a +// value of its type when values is set, for DuckDB to describe or run the +// query. A parameter of unknown type becomes a bare NULL. Strings, +// quoted identifiers and comments are left alone. +func (a *analyzer) substitute(sql string, phs []placeholder, bindings map[int]*binding, values bool) string { + repl := map[int]string{} + for _, ph := range phs { + r := "NULL" + if b := bindings[ph.Number]; b != nil && b.spelling != "" { + r = "CAST(NULL AS " + b.spelling + ")" + if values { + // The value is chosen by the type as spelled, since an + // alias such as JSON takes values its canonical type + // does not. + if v, ok := a.zero(a.parseTypeWith(b.spelling, false)); ok { + r = "CAST('" + strings.ReplaceAll(v, "'", "''") + "' AS " + b.spelling + ")" + } + } + } + repl[ph.Number] = r + } + var out strings.Builder + i := 0 + for i < len(sql) { + c := sql[i] + switch { + case c == '\'' || c == '"': + end := quotedEnd(sql, i) + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "--"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + end = len(sql) + } else { + end += i + } + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + end = len(sql) + } else { + end += i + 2 + } + out.WriteString(sql[i:end]) + i = end + case c == '$' && numberedRe.MatchString(sql[i:]): + m := numberedRe.FindStringSubmatch(sql[i:]) + n, _ := strconv.Atoi(m[1]) + if r, ok := repl[n]; ok { + out.WriteString(r) + } else { + out.WriteString(m[0]) + } + i += len(m[0]) + default: + out.WriteByte(c) + i++ + } + } + return out.String() +} + +// observe runs the query with a value bound to each parameter, over the +// fixture and over no rows, and reports which of the first n result +// columns came back NULL in either run. A run the CLI rejects observes +// nothing. +func (a *analyzer) observe(ctx context.Context, sql string, phs []placeholder, bindings map[int]*binding, n int) []bool { + nullable := make([]bool, n) + statement := a.substitute(sql, phs, bindings, true) + ";\n" + runs := []bool{true} + if a.fixture != "" { + runs = append(runs, false) + } + for _, withFixture := range runs { + out, err := a.run(ctx, statement, "csv", withFixture) + if err != nil { + continue + } + records, err := csv.NewReader(strings.NewReader(out)).ReadAll() + if err != nil { + continue + } + for _, rec := range records[min(1, len(records)):] { + for j, v := range rec { + if j < n && v == nullMarker { + nullable[j] = true + } + } + } + } + return nullable +} diff --git a/internal/goldeneye/duckdb/duckdb.go b/internal/goldeneye/duckdb/duckdb.go index ab0a614a62..9232117f8c 100644 --- a/internal/goldeneye/duckdb/duckdb.go +++ b/internal/goldeneye/duckdb/duckdb.go @@ -1,9 +1,15 @@ // Package duckdb generates the DuckDB dialect seed under // internal/engine/duckdb/dialect — types.jsonl, functions.jsonl and // operators.jsonl — from a live DuckDB CLI, the same way the postgresql -// package generates PostgreSQL's from a live server. The CLI must be the -// DuckDB 2.0 build darkwing is pinned against; it is located through the -// DUCKDB environment variable, falling back to "duckdb" on PATH. +// package generates PostgreSQL's from a live server, and verifies the +// DuckDB analyze cases under internal/endtoend/testdata against the same +// CLI. +// +// The CLI is a DuckDB 2.0 build, the release darkwing is pinned against, +// which has no release to download yet: Install fetches the current build +// of DuckDB's v2.0 preview channel into the user cache directory. The CLI +// is located through the DUCKDB environment variable, then the cached +// build, then "duckdb" on PATH. package duckdb import ( @@ -23,14 +29,19 @@ import ( const Engine = "duckdb" // Locate finds the DuckDB CLI: the DUCKDB environment variable wins, then -// "duckdb" on PATH. +// the cached build of DefaultVersion, then "duckdb" on PATH. func Locate() (string, error) { if path := os.Getenv("DUCKDB"); path != "" { return path, nil } + if path, err := cachedBinary(DefaultVersion); err == nil { + if _, err := os.Stat(path); err == nil { + return path, nil + } + } path, err := exec.LookPath("duckdb") if err != nil { - return "", errors.New("no duckdb CLI found: set DUCKDB to the DuckDB 2.0 binary darkwing is pinned against, or put duckdb on PATH") + return "", errors.New("no duckdb CLI found: run `go run ./cmd/goldeneye install duckdb` in internal/goldeneye, set DUCKDB to a DuckDB 2.0 binary, or put duckdb on PATH") } return path, nil } @@ -124,9 +135,11 @@ ORDER BY type_name`, &rows) // Group the dump's one-row-per-spelling by logical type: the spelling // matching the logical type id is the canonical name, the rest are - // aliases. + // aliases. A spelling is listed once per schema it is visible in, so + // an alias is kept once. grouped := map[string]*dialect.Type{} var order []string + seen := map[string]bool{} for _, row := range rows { logical := strings.ToLower(row.LogicalType) if metaTypes[logical] { @@ -141,7 +154,8 @@ ORDER BY type_name`, &rows) if t.Category == "U" { t.Category = categoryLetter(row.Category) } - if name := strings.ToLower(row.TypeName); name != logical { + if name := strings.ToLower(row.TypeName); name != logical && !seen[logical+"\x00"+name] { + seen[logical+"\x00"+name] = true t.Aliases = append(t.Aliases, name) } } diff --git a/internal/goldeneye/duckdb/duckdb_test.go b/internal/goldeneye/duckdb/duckdb_test.go index 57608c35e9..5d600da7f4 100644 --- a/internal/goldeneye/duckdb/duckdb_test.go +++ b/internal/goldeneye/duckdb/duckdb_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" ) // TestDialect verifies the committed DuckDB dialect against what the DuckDB @@ -35,3 +36,31 @@ func TestDialect(t *testing.T) { t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) } } + +// TestAnalyzeCases verifies every DuckDB analyze case under +// internal/endtoend/testdata against what the CLI reports. It skips +// unless a CLI is found. +func TestAnalyzeCases(t *testing.T) { + binary, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Engine) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no duckdb analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), binary, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what DuckDB reports (-committed +duckdb):\n%s", c.Output, diff) + } + }) + } +} diff --git a/internal/goldeneye/duckdb/install.go b/internal/goldeneye/duckdb/install.go new file mode 100644 index 0000000000..e7ac08077e --- /dev/null +++ b/internal/goldeneye/duckdb/install.go @@ -0,0 +1,136 @@ +package duckdb + +import ( + "archive/tar" + "compress/gzip" + "context" + "errors" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "strings" +) + +// DefaultVersion is the DuckDB preview channel the CLI is downloaded from: +// the v2.0 development builds, which DuckDB publishes as a rolling tarball +// per platform under https://artifacts.duckdb.org// until 2.0 is +// released. A channel has no per-build download and no checksum to pin, +// so Install fetches whatever build the channel holds and the version the +// CLI reports is what a run logs; GeneratedFrom records the build the +// committed dialect came from, and a check against a later build reports +// what the later build added. Once 2.0 is released, pin the release and +// its checksums here the way the clickhouse package does. +const DefaultVersion = "v2.0-cyanoptera" + +// GeneratedFrom is the build the committed dialect was generated from, as +// `duckdb --version` reports it. Update it when regenerating. +const GeneratedFrom = "v2.0.0-alpha41396 (Cyanoptera) d41e527b18" + +// channelURL is the download address of a channel's CLI tarball for a +// platform. DuckDB publishes one macOS build for both architectures. +func channelURL(channel, goos, goarch string) (string, error) { + var name string + switch { + case goos == "linux" && (goarch == "amd64" || goarch == "arm64"): + name = "duckdb-cli-linux-" + goarch + ".tar.gz" + case goos == "darwin": + name = "duckdb-cli-osx-universal.tar.gz" + default: + return "", fmt.Errorf("no DuckDB %s build is published for %s/%s", channel, goos, goarch) + } + return "https://artifacts.duckdb.org/" + channel + "/" + name, nil +} + +// cachedBinary is where Install puts the binary for a channel. +func cachedBinary(channel string) (string, error) { + dir, err := os.UserCacheDir() + if err != nil { + return "", err + } + return filepath.Join(dir, "sqlc-duckdb", channel, "duckdb"), nil +} + +// Install downloads the channel's current CLI into the cache and returns +// its path. It is a no-op when the channel is already cached: remove the +// cached directory to fetch the channel's newer build. +func Install(ctx context.Context, channel, goos, goarch string, progress io.Writer) (string, error) { + dest, err := cachedBinary(channel) + if err != nil { + return "", err + } + if _, err := os.Stat(dest); err == nil { + return dest, nil + } + url, err := channelURL(channel, goos, goarch) + if err != nil { + return "", err + } + if err := os.MkdirAll(filepath.Dir(dest), 0o755); err != nil { + return "", err + } + + fmt.Fprintf(progress, "downloading %s\n", url) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) + if err != nil { + return "", err + } + resp, err := http.DefaultClient.Do(req) + if err != nil { + return "", err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return "", fmt.Errorf("downloading %s: %s", url, resp.Status) + } + + // Write next to the destination and rename so a partial download never + // masquerades as an installed binary. + tmp, err := os.CreateTemp(filepath.Dir(dest), "duckdb-*.partial") + if err != nil { + return "", err + } + defer os.Remove(tmp.Name()) + src, err := binaryInTarball(resp.Body) + if err != nil { + tmp.Close() + return "", fmt.Errorf("downloading %s: %w", url, err) + } + if _, err := io.Copy(tmp, src); err != nil { + tmp.Close() + return "", err + } + if err := tmp.Close(); err != nil { + return "", err + } + if err := os.Chmod(tmp.Name(), 0o755); err != nil { + return "", err + } + if err := os.Rename(tmp.Name(), dest); err != nil { + return "", err + } + return dest, nil +} + +// binaryInTarball positions a reader at the duckdb binary inside a CLI +// tarball, which holds it at the top level. +func binaryInTarball(r io.Reader) (io.Reader, error) { + gz, err := gzip.NewReader(r) + if err != nil { + return nil, err + } + tr := tar.NewReader(gz) + for { + hdr, err := tr.Next() + if errors.Is(err, io.EOF) { + return nil, errors.New("tarball does not contain duckdb") + } + if err != nil { + return nil, err + } + if hdr.Typeflag == tar.TypeReg && strings.TrimPrefix(hdr.Name, "./") == "duckdb" { + return tr, nil + } + } +} diff --git a/internal/goldeneye/duckdb/text.go b/internal/goldeneye/duckdb/text.go new file mode 100644 index 0000000000..1c749a6a54 --- /dev/null +++ b/internal/goldeneye/duckdb/text.go @@ -0,0 +1,657 @@ +package duckdb + +import ( + "strings" +) + +// DuckDB prints a plan with every column by its bare name and every +// aliased expression by its alias, and describes a query no further than +// its result columns' names and types, so which table a result column is +// read from and which column a parameter is compared with are read from +// the query text: the select list's items, the FROM clause's tables and +// aliases, and the operand beside each parameter. The text is tokenized +// and read at the top level of the statement, outside the parentheses a +// subquery or a CTE body sits in. + +// token is one lexical element of a query. +type token struct { + kind byte // 'w' word, 'q' quoted identifier, 's' string, 'n' number, 'p' parameter, 'o' operator or punctuation + text string +} + +var operators = []string{"::", "<>", "!=", "<=", ">=", "!~~", "~~", "->>", "->", "||", "=", "<", ">", "(", ")", ",", ".", "*", "+", "-", "/", "%", "[", "]", ";", "^", "&", "|", "~", "!", ":"} + +// tokenize splits a query into tokens, dropping comments. A parameter is +// $ followed by digits, which is how bind spells every parameter. +func tokenize(src string) []token { + var out []token + i := 0 + for i < len(src) { + c := src[i] + switch { + case c == ' ' || c == '\t' || c == '\n' || c == '\r': + i++ + case strings.HasPrefix(src[i:], "--"): + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + i = len(src) + } else { + i += end + } + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + i = len(src) + } else { + i += end + 2 + } + case c == '\'': + end := quotedEnd(src, i) + out = append(out, token{'s', src[i:end]}) + i = end + case c == '"': + end := quotedEnd(src, i) + out = append(out, token{'q', strings.ReplaceAll(src[i+1:end-1], `""`, `"`)}) + i = end + case c == '$' && i+1 < len(src) && isDigit(src[i+1]): + end := i + 1 + for end < len(src) && isDigit(src[end]) { + end++ + } + out = append(out, token{'p', src[i+1 : end]}) + i = end + case isDigit(c) || (c == '.' && i+1 < len(src) && isDigit(src[i+1])): + end := i + for end < len(src) && (isDigit(src[end]) || src[end] == '.' || src[end] == 'e' || src[end] == 'E' || src[end] == '_') { + end++ + } + out = append(out, token{'n', src[i:end]}) + i = end + case isWordStart(c): + end := i + for end < len(src) && isWordByte(src[end]) { + end++ + } + out = append(out, token{'w', src[i:end]}) + i = end + default: + matched := false + for _, op := range operators { + if strings.HasPrefix(src[i:], op) { + out = append(out, token{'o', op}) + i += len(op) + matched = true + break + } + } + if !matched { + out = append(out, token{'o', string(c)}) + i++ + } + } + } + return out +} + +// quotedEnd returns the index just past the quoted token starting at i, +// whose delimiter is escaped by doubling it. +func quotedEnd(s string, i int) int { + q := s[i] + j := i + 1 + for j < len(s) { + switch { + case s[j] == q && j+1 < len(s) && s[j+1] == q: + j += 2 + case s[j] == q: + return j + 1 + default: + j++ + } + } + return len(s) +} + +func isDigit(c byte) bool { return c >= '0' && c <= '9' } +func isWordStart(c byte) bool { + return c == '_' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= 0x80 +} +func isWordByte(c byte) bool { return isWordStart(c) || isDigit(c) } + +// text is a tokenized query. +type text []token + +func (t text) at(i int) token { + if i < 0 || i >= len(t) { + return token{} + } + return t[i] +} + +// isWord reports whether token i is the keyword, in any case. +func (t text) isWord(i int, word string) bool { + tok := t.at(i) + return tok.kind == 'w' && strings.EqualFold(tok.text, word) +} + +// isOp reports whether token i is the operator. +func (t text) isOp(i int, op string) bool { + tok := t.at(i) + return tok.kind == 'o' && tok.text == op +} + +// isName reports whether token i can name something: a word or a quoted +// identifier. +func (t text) isName(i int) bool { + k := t.at(i).kind + return k == 'w' || k == 'q' +} + +// group returns the index of the parenthesis closing the one at i. +func (t text) group(i int) int { + depth := 0 + for j := i; j < len(t); j++ { + switch { + case t.isOp(j, "("): + depth++ + case t.isOp(j, ")"): + depth-- + if depth == 0 { + return j + } + } + } + return len(t) - 1 +} + +// ref is a column reference: a qualifier, empty for none, and a column, +// or "*" for every column of the qualifier. +type ref struct { + qualifier, column string +} + +// readRef reads a dotted name starting at i, returning the parts and the +// index after them. +func (t text) readRef(i int) ([]string, int) { + var parts []string + for t.isName(i) || t.isOp(i, "*") { + parts = append(parts, t.at(i).text) + if !t.isOp(i+1, ".") { + return parts, i + 1 + } + i += 2 + } + return parts, i +} + +// keywords that end a list of tables or select items at the top level. +var clauseKeywords = map[string]bool{ + "where": true, "group": true, "order": true, "limit": true, "offset": true, "having": true, + "qualify": true, "window": true, "returning": true, "set": true, "values": true, "select": true, + "union": true, "except": true, "intersect": true, "on": true, "from": true, "join": true, + "left": true, "right": true, "full": true, "inner": true, "cross": true, "outer": true, + "natural": true, "asof": true, "semi": true, "anti": true, "positional": true, "lateral": true, + "using": true, "with": true, "into": true, "default": true, "fetch": true, "for": true, + "tablesample": true, "sample": true, "by": true, "repeatable": true, +} + +// typeWords are the words a multi-word type name continues with: +// TIMESTAMP WITH TIME ZONE, DOUBLE PRECISION, CHARACTER VARYING. +var typeWords = map[string]bool{"with": true, "without": true, "time": true, "zone": true, "precision": true, "varying": true} + +// tableRef is one table of a statement's scope, by name and alias. +type tableRef struct { + name, alias string +} + +// scope is what the statement reads and writes: the tables of its FROM, +// JOIN and USING clauses and the table a DML statement targets, with the +// names of its CTEs, which are not tables. +type scope struct { + kind string // select, insert, update, delete + target tableRef + tables []tableRef + ctes map[string]bool +} + +// readScope reads a statement's scope from its top-level tokens. +func (t text) readScope() scope { + sc := scope{ctes: map[string]bool{}} + i := 0 + // WITH name [(cols)] AS (...), ... + if t.isWord(0, "with") { + i = 1 + if t.isWord(i, "recursive") { + i++ + } + for t.isName(i) { + sc.ctes[strings.ToLower(t.at(i).text)] = true + i++ + if t.isOp(i, "(") { + i = t.group(i) + 1 + } + if t.isWord(i, "as") { + i++ + } + if t.isWord(i, "not") || t.isWord(i, "materialized") { + for !t.isOp(i, "(") && i < len(t) { + i++ + } + } + if t.isOp(i, "(") { + i = t.group(i) + 1 + } + if t.isOp(i, ",") { + i++ + continue + } + break + } + } + sc.kind = "select" + switch { + case t.isWord(i, "insert"): + sc.kind = "insert" + for i < len(t) && !t.isWord(i, "into") { + i++ + } + sc.target, i = t.readTable(i + 1) + case t.isWord(i, "update"): + sc.kind = "update" + sc.target, i = t.readTable(i + 1) + case t.isWord(i, "delete"): + sc.kind = "delete" + if t.isWord(i+1, "from") { + i++ + } + sc.target, i = t.readTable(i + 1) + } + for ; i < len(t); i++ { + switch { + case t.isOp(i, "("): + i = t.group(i) + case t.isWord(i, "from") || t.isWord(i, "join"): + i = t.readTables(i+1, &sc.tables) - 1 + case t.isWord(i, "using") && !t.isOp(i+1, "("): + i = t.readTables(i+1, &sc.tables) - 1 + } + } + // A CTE is not a table, whatever table shares its name. + tables := sc.tables[:0] + for _, ref := range sc.tables { + if !sc.ctes[ref.name] { + tables = append(tables, ref) + } + } + sc.tables = tables + return sc +} + +// readTable reads a table name with an optional alias. +func (t text) readTable(i int) (tableRef, int) { + parts, j := t.readRef(i) + if len(parts) == 0 { + return tableRef{}, i + } + ref := tableRef{name: strings.ToLower(parts[len(parts)-1])} + if t.isWord(j, "as") { + j++ + } + if t.isName(j) && !clauseKeywords[strings.ToLower(t.at(j).text)] { + ref.alias = strings.ToLower(t.at(j).text) + j++ + } + return ref, j +} + +// readTables reads a comma-separated list of table references, skipping +// subqueries and table functions, and returns the index after it. +func (t text) readTables(i int, into *[]tableRef) int { + for i < len(t) { + if t.isOp(i, "(") { + // A derived table or a table function's arguments. + i = t.group(i) + 1 + if t.isWord(i, "as") { + i++ + } + if t.isName(i) && !clauseKeywords[strings.ToLower(t.at(i).text)] { + i++ + } + } else if t.isName(i) && !clauseKeywords[strings.ToLower(t.at(i).text)] { + ref, j := t.readTable(i) + if t.isOp(j, "(") { + // A table function: its result is not a table. + j = t.group(j) + 1 + } else { + *into = append(*into, ref) + } + i = j + } else { + return i + } + if t.isOp(i, ",") { + i++ + continue + } + return i + } + return i +} + +// item is one entry of a select list or a RETURNING list. +type item struct { + star bool // every column of qualifier, or of every table + ref *ref // a column reference, when the item is one + name string // the alias, or the column name of a reference +} + +// items splits a select or RETURNING list into its items, given the index +// of the first token after the keyword. +func (t text) items(start int) []item { + var out []item + i := start + for i < len(t) { + end := i + for end < len(t) && !t.isOp(end, ",") && !(t.at(end).kind == 'w' && clauseKeywords[strings.ToLower(t.at(end).text)] && !t.isWord(end, "on")) && !t.isOp(end, ";") { + if t.isOp(end, "(") { + end = t.group(end) + } + end++ + } + if end > i { + out = append(out, t.item(i, end)) + } + if !t.isOp(end, ",") { + break + } + i = end + 1 + } + return out +} + +// item classifies the tokens of one select item. +func (t text) item(start, end int) item { + parts, j := t.readRef(start) + if len(parts) > 0 && parts[len(parts)-1] == "*" { + it := item{star: true} + if len(parts) > 1 { + it.ref = &ref{qualifier: strings.ToLower(parts[len(parts)-2]), column: "*"} + } + return it + } + var it item + if len(parts) > 0 && j == end { + it.ref = &ref{column: parts[len(parts)-1]} + if len(parts) > 1 { + it.ref.qualifier = strings.ToLower(parts[len(parts)-2]) + } + it.name = parts[len(parts)-1] + return it + } + if len(parts) > 0 && j == end-1 && t.isName(end-1) { + // A reference followed by a bare alias. + it.ref = &ref{column: parts[len(parts)-1]} + if len(parts) > 1 { + it.ref.qualifier = strings.ToLower(parts[len(parts)-2]) + } + it.name = t.at(end - 1).text + return it + } + if len(parts) > 0 && j == end-2 && t.isWord(end-2, "as") && t.isName(end-1) { + it.ref = &ref{column: parts[len(parts)-1]} + if len(parts) > 1 { + it.ref.qualifier = strings.ToLower(parts[len(parts)-2]) + } + it.name = t.at(end - 1).text + return it + } + if t.isWord(end-2, "as") && t.isName(end-1) { + it.name = t.at(end - 1).text + } + return it +} + +// selectItems finds the statement's select list: the items after its +// top-level SELECT, or every column when a FROM-first query has none. +func (t text) selectItems() []item { + for i := 0; i < len(t); i++ { + switch { + case t.isOp(i, "("): + i = t.group(i) + case t.isWord(i, "select"): + j := i + 1 + if t.isWord(j, "distinct") || t.isWord(j, "all") { + j++ + if t.isWord(j, "on") && t.isOp(j+1, "(") { + j = t.group(j+1) + 1 + } + } + return t.items(j) + } + } + if t.isWord(0, "from") { + return []item{{star: true}} + } + return nil +} + +// returningItems finds the items of a top-level RETURNING clause. +func (t text) returningItems() []item { + for i := 0; i < len(t); i++ { + switch { + case t.isOp(i, "("): + i = t.group(i) + case t.isWord(i, "returning"): + return t.items(i + 1) + } + } + return nil +} + +// inSubquery reports whether parameter k sits inside a subquery: a +// parenthesis that a SELECT, WITH, FROM or VALUES opens. +func (t text) inSubquery(k string) bool { + i := t.find(k) + depth := 0 + for j := i - 1; j >= 0; j-- { + switch { + case t.isOp(j, ")"): + depth++ + case t.isOp(j, "("): + if depth > 0 { + depth-- + continue + } + if t.isWord(j+1, "select") || t.isWord(j+1, "with") || t.isWord(j+1, "from") || t.isWord(j+1, "values") { + return true + } + } + } + return false +} + +// find returns the index of parameter k. +func (t text) find(k string) int { + for i, tok := range t { + if tok.kind == 'p' && tok.text == k { + return i + } + } + return -1 +} + +var comparisons = map[string]bool{"=": true, "<>": true, "!=": true, "<": true, ">": true, "<=": true, ">=": true, "~~": true, "!~~": true} + +// partner finds the column a parameter is compared with or assigned to: +// the column reference on the other side of the comparison, LIKE or IN +// it is an operand of, or the column a SET assigns it to. +func (t text) partner(k string) (ref, bool) { + i := t.find(k) + if i < 0 { + return ref{}, false + } + // col op $k, col [NOT] LIKE $k, col IN ($k, ...) + j := i - 1 + if t.isOp(j, "(") || t.isOp(j, ",") { + for j >= 0 && (t.isOp(j, ",") || t.at(j).kind == 'p' || t.at(j).kind == 's' || t.at(j).kind == 'n') { + j-- + } + if t.isOp(j, "(") { + j-- + } + } + if t.at(j).kind == 'o' && comparisons[t.at(j).text] || t.isWord(j, "like") || t.isWord(j, "ilike") || t.isWord(j, "glob") || t.isWord(j, "in") { + if t.isWord(j-1, "not") { + j-- + } + if r, ok := t.refEnding(j - 1); ok { + return r, true + } + } + // $k op col + j = i + 1 + if t.at(j).kind == 'o' && comparisons[t.at(j).text] { + if r, ok := t.refStarting(j + 1); ok { + return r, true + } + } + return ref{}, false +} + +// refEnding reads the column reference whose last token is at i. +func (t text) refEnding(i int) (ref, bool) { + if !t.isName(i) { + return ref{}, false + } + r := ref{column: t.at(i).text} + if t.isOp(i-1, ".") && t.isName(i-2) { + r.qualifier = strings.ToLower(t.at(i - 2).text) + } + return r, true +} + +// refStarting reads the column reference starting at i, which must not be +// a function call. +func (t text) refStarting(i int) (ref, bool) { + parts, j := t.readRef(i) + if len(parts) == 0 || t.isOp(j, "(") { + return ref{}, false + } + r := ref{column: parts[len(parts)-1]} + if len(parts) > 1 { + r.qualifier = strings.ToLower(parts[len(parts)-2]) + } + return r, true +} + +// castOf returns the type a parameter is cast to, as $k::T or CAST($k AS +// T), spelled as the query spells it. +func (t text) castOf(k string) (string, bool) { + i := t.find(k) + if i < 0 { + return "", false + } + if t.isOp(i+1, "::") { + return t.typeText(i + 2), true + } + if t.isWord(i-2, "cast") && t.isOp(i-1, "(") && t.isWord(i+1, "as") { + return t.typeText(i + 2), true + } + return "", false +} + +// typeText reads a type starting at i: a dotted name, optional arguments +// in parentheses and any number of [] or [N] suffixes. +func (t text) typeText(i int) string { + start := i + _, i = t.readRef(i) + for t.at(i).kind == 'w' && typeWords[strings.ToLower(t.at(i).text)] { + // Multi-word names: TIMESTAMP WITH TIME ZONE. + i++ + } + if t.isOp(i, "(") { + i = t.group(i) + 1 + } + for t.isOp(i, "[") { + for i < len(t) && !t.isOp(i, "]") { + i++ + } + i++ + } + var b strings.Builder + for j := start; j < i && j < len(t); j++ { + tok := t.at(j) + if j > start && (tok.kind == 'w' || tok.kind == 'q' || tok.kind == 'n' || tok.kind == 's') && (t.at(j-1).kind == 'w' || t.at(j-1).kind == 'q' || t.isOp(j-1, ",")) { + b.WriteByte(' ') + } + b.WriteString(tok.text) + } + return b.String() +} + +// valuesPosition reports, for a parameter inside an INSERT's VALUES, the +// index of the column it is a value for, counting positions within its +// row. +func (t text) valuesPosition(k string) (int, bool) { + i := t.find(k) + if i < 0 { + return 0, false + } + for j := 0; j < len(t); j++ { + if t.isOp(j, "(") { + j = t.group(j) + continue + } + if !t.isWord(j, "values") { + continue + } + // Rows follow, each a parenthesised list. + for r := j + 1; t.isOp(r, "("); r = t.group(r) + 2 { + end := t.group(r) + if i < r || i > end { + if !t.isOp(end+1, ",") { + break + } + continue + } + pos, depth := 0, 0 + for q := r + 1; q < i; q++ { + switch { + case t.isOp(q, "("): + depth++ + case t.isOp(q, ")"): + depth-- + case t.isOp(q, ",") && depth == 0: + pos++ + } + } + return pos, true + } + return 0, false + } + return 0, false +} + +// insertColumns lists the columns an INSERT names, or nil for all. +func (t text) insertColumns() []string { + for i := 0; i < len(t); i++ { + if t.isWord(i, "into") { + _, j := t.readRef(i + 1) + if t.isWord(j, "as") { + j += 2 + } else if t.isName(j) && !clauseKeywords[strings.ToLower(t.at(j).text)] { + j++ + } + if !t.isOp(j, "(") { + return nil + } + var cols []string + for q := j + 1; q < t.group(j); q++ { + if t.isName(q) { + cols = append(cols, t.at(q).text) + } + } + return cols + } + } + return nil +} diff --git a/internal/goldeneye/duckdb/types.go b/internal/goldeneye/duckdb/types.go new file mode 100644 index 0000000000..f97cb7608c --- /dev/null +++ b/internal/goldeneye/duckdb/types.go @@ -0,0 +1,220 @@ +package duckdb + +import ( + "sort" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" +) + +// parseType reads a type the way DuckDB spells one — DECIMAL(10,2), +// INTEGER[], INTEGER[3], STRUCT(a INTEGER, b VARCHAR), MAP(VARCHAR, +// INTEGER), UNION(num INTEGER, str VARCHAR), ENUM('a', 'b'), TIMESTAMP +// WITH TIME ZONE — into an expression in lower case, named the way the +// dialect names it when the spelling is one of the aliases types.jsonl +// lists. DuckDB spells an enum column by its labels whether the schema +// named the type or not, so labels that are those of an enum the schema +// created name that type. +func (a *analyzer) parseType(s string) *analysis.TypeExpr { + return a.parseTypeWith(s, true) +} + +// parseTypeWith reads a type, naming an alias as the dialect does when +// canonical is set and as DuckDB spells it otherwise. +func (a *analyzer) parseTypeWith(s string, canonical bool) *analysis.TypeExpr { + s = strings.TrimSpace(s) + if strings.HasSuffix(s, "]") { + open := strings.LastIndexByte(s, '[') + if open > 0 { + t := &analysis.TypeExpr{Name: "array", Args: []analysis.TypeArg{{Type: a.parseTypeWith(s[:open], canonical)}}} + if n, err := strconv.ParseInt(strings.TrimSpace(s[open+1:len(s)-1]), 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } + return t + } + } + name, args := s, "" + if open := strings.IndexByte(s, '('); open >= 0 && strings.HasSuffix(s, ")") { + name, args = strings.TrimSpace(s[:open]), s[open+1:len(s)-1] + } + name = strings.ToLower(name) + if c, ok := a.canonical[name]; ok && canonical { + name = c + } + t := &analysis.TypeExpr{Name: name} + if args == "" { + return t + } + switch name { + case "struct", "union": + for _, f := range splitTop(args, ',') { + f = strings.TrimSpace(f) + label, typ := f, "" + if strings.HasPrefix(f, `"`) { + end := quotedEnd(f, 0) + label, typ = strings.ReplaceAll(f[1:end-1], `""`, `"`), f[end:] + } else if i := strings.IndexByte(f, ' '); i > 0 { + label, typ = f[:i], f[i+1:] + } + t.Args = append(t.Args, analysis.TypeArg{Label: label, Type: a.parseTypeWith(typ, canonical)}) + } + case "enum": + var labels []string + for _, l := range splitTop(args, ',') { + l = strings.TrimSpace(l) + if strings.HasPrefix(l, "'") && strings.HasSuffix(l, "'") && len(l) >= 2 { + l = strings.ReplaceAll(l[1:len(l)-1], "''", "'") + } + labels = append(labels, l) + } + if named, ok := a.enumNamed(labels); ok { + return &analysis.TypeExpr{Name: named} + } + for _, l := range labels { + l := l + t.Args = append(t.Args, analysis.TypeArg{String: &l}) + } + default: + for _, arg := range splitTop(args, ',') { + arg = strings.TrimSpace(arg) + if n, err := strconv.ParseInt(arg, 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } else { + t.Args = append(t.Args, analysis.TypeArg{Type: a.parseTypeWith(arg, canonical)}) + } + } + } + return t +} + +// enumNamed finds the enum type the schema created with these labels, +// the first by name when two share them. +func (a *analyzer) enumNamed(labels []string) (string, bool) { + names := make([]string, 0, len(a.enums)) + for name := range a.enums { + names = append(names, name) + } + sort.Strings(names) + for _, name := range names { + have := a.enums[name] + if len(have) != len(labels) { + continue + } + same := true + for i := range have { + if have[i] != labels[i] { + same = false + break + } + } + if same { + return name, true + } + } + return "", false +} + +// splitTop splits on a separator outside parentheses, brackets and +// quotes. +func splitTop(s string, sep byte) []string { + var out []string + depth, start := 0, 0 + var quote byte + for i := 0; i < len(s); i++ { + c := s[i] + switch { + case quote != 0: + if c == quote { + quote = 0 + } + case c == '\'' || c == '"': + quote = c + case c == '(' || c == '[': + depth++ + case c == ')' || c == ']': + depth-- + case c == sep && depth == 0: + out = append(out, s[start:i]) + start = i + 1 + } + } + return append(out, s[start:]) +} + +// zero is a value of a type, spelled as a string DuckDB casts to the type: +// what a parameter is bound to when the query is run to see which of its +// columns can be NULL. A type no value is known for reports false, and +// the parameter is bound to NULL. +func (a *analyzer) zero(t *analysis.TypeExpr) (string, bool) { + if t == nil { + return "", false + } + switch t.Name { + case "tinyint", "smallint", "integer", "bigint", "hugeint", "utinyint", "usmallint", "uinteger", "ubigint", "uhugeint", + "decimal", "float", "double", "bignum", "varint": + return "1", true + case "varchar", "text", "char", "bpchar": + return "x", true + case "json": + return "{}", true + case "blob": + return "", true + case "bit": + return "0", true + case "boolean": + return "true", true + case "uuid": + return "00000000-0000-0000-0000-000000000000", true + case "date": + return "2000-01-01", true + case "time", "time with time zone": + return "00:00:00", true + case "timestamp", "timestamp with time zone", "timestamp_s", "timestamp_ms", "timestamp_ns", "datetime": + return "2000-01-01 00:00:00", true + case "interval": + return "1 day", true + case "map": + return "{}", true + case "array": + if len(t.Args) == 0 || t.Args[0].Type == nil { + return "", false + } + elem, ok := a.zero(t.Args[0].Type) + if !ok { + return "", false + } + n := 1 + if len(t.Args) > 1 && t.Args[1].Int != nil { + n = int(*t.Args[1].Int) + } + elems := make([]string, n) + for i := range elems { + elems[i] = elem + } + return "[" + strings.Join(elems, ", ") + "]", true + case "struct": + var fields []string + for _, f := range t.Args { + v, ok := a.zero(f.Type) + if !ok { + return "", false + } + fields = append(fields, f.Label+": "+v) + } + return "{" + strings.Join(fields, ", ") + "}", true + case "union": + if len(t.Args) == 0 { + return "", false + } + return a.zero(t.Args[0].Type) + case "enum": + if len(t.Args) > 0 && t.Args[0].String != nil { + return *t.Args[0].String, true + } + } + if labels, ok := a.enums[t.Name]; ok && len(labels) > 0 { + return labels[0], true + } + return "", false +} diff --git a/internal/goldeneye/go.mod b/internal/goldeneye/go.mod index 12b6b80610..58114729ef 100644 --- a/internal/goldeneye/go.mod +++ b/internal/goldeneye/go.mod @@ -3,13 +3,50 @@ module github.com/sqlc-dev/sqlc/internal/goldeneye go 1.26.0 require ( + cloud.google.com/go/spanner v1.95.1 github.com/go-sql-driver/mysql v1.10.0 github.com/jackc/pgx/v5 v5.10.0 + github.com/microsoft/go-mssqldb v1.11.0 + google.golang.org/api v0.297.0 + google.golang.org/grpc v1.83.2 + google.golang.org/protobuf v1.36.12 ) require ( + cloud.google.com/go v0.123.0 // indirect + cloud.google.com/go/auth v0.23.2 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect + cloud.google.com/go/compute/metadata v0.9.0 // indirect + cloud.google.com/go/iam v1.12.0 // indirect + cloud.google.com/go/longrunning v1.2.0 // indirect filippo.io/edwards25519 v1.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/google/s2a-go v0.1.9 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.20 // indirect + github.com/googleapis/gax-go/v2 v2.24.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect - golang.org/x/text v0.29.0 // indirect + github.com/shopspring/decimal v1.4.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect + go.opentelemetry.io/otel v1.44.0 // indirect + go.opentelemetry.io/otel/metric v1.44.0 // indirect + go.opentelemetry.io/otel/trace v1.44.0 // indirect + golang.org/x/crypto v0.55.0 // indirect + golang.org/x/net v0.58.0 // indirect + golang.org/x/oauth2 v0.36.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/text v0.41.0 // indirect + golang.org/x/time v0.15.0 // indirect + google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 // indirect ) diff --git a/internal/goldeneye/go.sum b/internal/goldeneye/go.sum index dc11e8d5f8..e312586f9b 100644 --- a/internal/goldeneye/go.sum +++ b/internal/goldeneye/go.sum @@ -1,10 +1,68 @@ +cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= +cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= +cloud.google.com/go/auth v0.23.2 h1:pxSCpfiji41hpzpPdMCftEUCezpgpqmmDdYiAjCKXxo= +cloud.google.com/go/auth v0.23.2/go.mod h1:4DhBRcqvtljQN3dJ57qtqbib5ZGCYE5f2crfiiC2EM0= +cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= +cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= +cloud.google.com/go/iam v1.12.0 h1:Aki3bX9aHUDKPHfnRJfDcTdVedvy6quGBQcTqx3DRXk= +cloud.google.com/go/iam v1.12.0/go.mod h1:FEZ4lXpADAC2AIpQY7LANNjjwyQ2jK439CI2VaD+sLY= +cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM= +cloud.google.com/go/longrunning v1.2.0/go.mod h1:5KMQALFGOCtFoi2xSOA1u3H7WKlhmckgiyFw7+LGQp0= +cloud.google.com/go/spanner v1.95.1 h1:9HYr+AAeAOubn0NZAYv34dFHQ3NbIUcWHZmgJvufPzk= +cloud.google.com/go/spanner v1.95.1/go.mod h1:Z2+83J5oVDmd1n5ntVMmjEuiNoXOpAyNeG7y1tuEHk0= filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.0 h1:4gRPBpN1f6xt88yi4WR26m7XaD9OlWtVT6bWPdGUIok= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.0/go.mod h1:G7QVLxw1j1JVyrO1MA95S8m8HStaaleDZYTcfGgjB2o= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0 h1:CU4+EJeJi3TKYWEcYuSdWsjzw0nVsK/H0MSQOiPcymU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0/go.mod h1:q0+UTSRvShwUCrR/s5HtyInYphN7Wvxb7snFM3u+SLA= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 h1:MaKvxE6D0KkjOg6Wd9M00iqP5PR0kUxCfiezes4JweM= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0/go.mod h1:i2h9fsTFKZorh8RdV2IcSUf/Qj98GlTkrTvUbX/s8as= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= +github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 h1:RHK7bS+HQMslb1sZpAokUt+zTVmue0hKSs2C791hhzU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw= github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= +github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.20 h1:t/xL64VUoN69MuMRQuJETqYGOw4Z9mSRJK9epIEtwFk= +github.com/googleapis/enterprise-certificate-proxy v0.3.20/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w= +github.com/googleapis/gax-go/v2 v2.24.0 h1:myMaPYyF9MecEmvQqMqomIwn9t/4KCZN9qnwsS76wlg= +github.com/googleapis/gax-go/v2 v2.24.0/go.mod h1:IaTHBDd7NHxSCiu0vEs8pQZu4dGZrWwuSoxCnk16OFM= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= @@ -13,18 +71,67 @@ github.com/jackc/pgx/v5 v5.10.0 h1:VhSvgU2jSli8o3AqIEOTJr7rZwAEUVo4E4XhR94Zfr0= github.com/jackc/pgx/v5 v5.10.0/go.mod h1:mal1tBGAFfLHvZzaYh77YS/eC6IX9OWbRV1QIIM0Jn4= github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/microsoft/go-mssqldb v1.11.0 h1:YbDqolEjGH9hBfvKzONTf5/dbl9RKXmizMJE93lVxNs= +github.com/microsoft/go-mssqldb v1.11.0/go.mod h1:goQLDOPlMN/l1REhnNPElMoY/yX+fUWn1+7UoFJPH9Y= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= -golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= -golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg= +go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= +go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc= +go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc= +go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo= +go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58= +go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0= +go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI= +go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA= +go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= +go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= +golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= +golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= +golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= +golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= +golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= +golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/api v0.297.0 h1:WktxTsnnx0yZNnsR6j0q6hR21RnnK81FHTOPy/ux4OE= +google.golang.org/api v0.297.0/go.mod h1:S4m8x0M6OkQpkOzGk1y9JG2sm4fFQrMh6dxzjCTszhE= +google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d h1:C9v1o0/4quuhOAfmRXA2j+we0PqZIp8traLdeogF3Ms= +google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d/go.mod h1:Wz2wFJntZFmLGo7pLDXZ3wYk5hyc0Mb+SkHhDDXT+lU= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d h1:QwnJwPte4XXAkhPu26LTDIahnsMSUV0kK8HkxbC+Pc4= +google.golang.org/genproto/googleapis/api v0.0.0-20260715232425-e75dac1f907d/go.mod h1:WRrQ7/7N19PypuT0fxLOL5Lq0waoiRri4FbtHDEKrGE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 h1:cYNAzI2sUwhmCcoj9TxvihSrqsxt6uIkj3rDRhSDmW4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA= +google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= +google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/goldeneye/mssql/analyze.go b/internal/goldeneye/mssql/analyze.go new file mode 100644 index 0000000000..e4caaf640e --- /dev/null +++ b/internal/goldeneye/mssql/analyze.go @@ -0,0 +1,725 @@ +package mssql + +import ( + "context" + "database/sql" + "fmt" + "os" + "regexp" + "strconv" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// The analyze cases are checked against a live server, which is asked +// three things about each query, none of which runs it. What a driver +// would see: sys.dm_exec_describe_first_result_set describes each result +// column — its name, its type spelled the way a declaration spells it, +// whether it can be NULL, and which table column it is read from. What +// each parameter would be: sp_describe_undeclared_parameters says what +// type the server would give each parameter the query leaves undeclared. +// And what each parameter stands in for: the estimated showplan, compiled +// with the parameters declared as those types, says which column each is +// compared with or assigned to, and a parameter with such a partner is +// described as that column, from the catalog of the case's database. +// +// Two things the describing function keeps to itself: a json or vector +// column is described by the nvarchar(max) it is sent to a driver as, so +// a column read from a table is typed from the catalog instead, and a +// type SQL Server calls timestamp is written as the rowversion the +// dialect names it. + +// placeholder is one parameter of a query as sqlc numbers them: each ? +// in turn, and each @name or sqlc.arg name once, at its first appearance. +// Each appearance becomes a variable of its own, since the server +// describes an undeclared parameter only when it is used once. +type placeholder struct { + Number int + Name string + Vars []string // the variables its appearances became, without the @ +} + +var identRe = regexp.MustCompile(`^@([A-Za-z_][A-Za-z0-9_]*)`) + +// bind rewrites the query so that every parameter is a variable used once, +// and lists the parameters in sqlc's order. The query's own @name +// references are kept, since that is how sqlc's SQL Server queries name +// their parameters; a sqlc.arg becomes one, and each ? in turn becomes +// one named after its position. +func bind(query string) (string, []placeholder) { + positional := 0 + sql := endtoend.Rewrite(query, func(name, _ string) string { + if name == "" { + positional++ + name = "p" + strconv.Itoa(positional) + } + return "@" + name + }) + var ( + phs []placeholder + numbers = map[string]int{} + out strings.Builder + ) + i := 0 + for i < len(sql) { + c := sql[i] + switch { + case c == '\'' || c == '"' || c == '[': + end := skipQuoted(sql, i) + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "--"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + end = len(sql) + } else { + end += i + } + out.WriteString(sql[i:end]) + i = end + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + end = len(sql) + } else { + end += i + 2 + } + out.WriteString(sql[i:end]) + i = end + case c == '@' && (i == 0 || !isWordByte(sql[i-1])) && identRe.MatchString(sql[i:]): + m := identRe.FindStringSubmatch(sql[i:]) + name := m[1] + n, ok := numbers[name] + if !ok { + n = len(phs) + 1 + numbers[name] = n + phs = append(phs, placeholder{Number: n, Name: name}) + } + ph := &phs[n-1] + v := name + if k := len(ph.Vars); k > 0 { + v = fmt.Sprintf("%s__%d", name, k+1) + } + ph.Vars = append(ph.Vars, v) + out.WriteString("@" + v) + i += len(m[0]) + default: + out.WriteByte(c) + i++ + } + } + return out.String(), phs +} + +func isWordByte(c byte) bool { + return c == '_' || c == '@' || c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' +} + +// skipQuoted returns the index just past the quoted token starting at i: a +// string, a double-quoted identifier or a bracketed one, whose closing +// delimiter is escaped by doubling it. +func skipQuoted(s string, i int) int { + open := s[i] + close := open + if open == '[' { + close = ']' + } + j := i + 1 + for j < len(s) { + switch { + case s[j] == close && j+1 < len(s) && s[j+1] == close: + j += 2 + case s[j] == close: + return j + 1 + default: + j++ + } + } + return len(s) +} + +// splitStatements splits a script into the statements it is made of, on +// the semicolons outside strings, brackets, comments and BEGIN ... END +// blocks, and on the GO lines a T-SQL script separates batches with. A +// CREATE TYPE has to be its own batch before a table can use the type, so +// a schema is loaded one statement at a time; a trigger or procedure +// body keeps its semicolons, since a BEGIN, or a CASE, opens a block that +// its END closes. +func splitStatements(src string) []string { + var stmts []string + flush := func(s string) { + if s = strings.TrimSpace(s); s != "" && !strings.EqualFold(s, "go") { + stmts = append(stmts, s) + } + } + start := 0 + i := 0 + depth := 0 + if isGoLine(src, 0) { + for i < len(src) && src[i] != '\n' { + i++ + } + start = i + } + for i < len(src) { + c := src[i] + switch { + case c == '\'' || c == '"' || c == '[': + i = skipQuoted(src, i) + case strings.HasPrefix(src[i:], "--"): + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + i = len(src) + } else { + i += end + } + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + i = len(src) + } else { + i += end + 2 + } + case isWordByte(c): + end := i + for end < len(src) && isWordByte(src[end]) { + end++ + } + switch word := strings.ToLower(src[i:end]); word { + case "begin": + // BEGIN TRAN[SACTION] and BEGIN DISTRIBUTED are statements, + // not blocks. + if !nextWordIn(src, end, "tran", "transaction", "distributed") { + depth++ + } + case "case": + depth++ + case "end": + if depth > 0 { + depth-- + } + } + i = end + case c == ';' && depth == 0: + flush(src[start:i]) + start = i + 1 + i++ + case c == '\n' && isGoLine(src, i+1): + flush(src[start:i]) + i++ + for i < len(src) && src[i] != '\n' { + i++ + } + start = i + depth = 0 + default: + i++ + } + } + flush(src[start:]) + return stmts +} + +// nextWordIn reports whether the word after position i, past spaces and +// comments, is one of the words. +func nextWordIn(src string, i int, words ...string) bool { + for i < len(src) { + switch { + case src[i] == ' ' || src[i] == '\t' || src[i] == '\n' || src[i] == '\r': + i++ + case strings.HasPrefix(src[i:], "--"): + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + return false + } + i += end + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + return false + } + i += end + 2 + default: + end := i + for end < len(src) && isWordByte(src[end]) { + end++ + } + for _, w := range words { + if strings.EqualFold(src[i:end], w) { + return true + } + } + return false + } + } + return false +} + +// isGoLine reports whether the line starting at i is a GO batch separator. +func isGoLine(src string, i int) bool { + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + end = len(src) + } else { + end += i + } + return strings.EqualFold(strings.TrimSpace(src[i:end]), "go") +} + +// column is what the catalog says about a column of the case's database. +type column struct { + name string + typ *analysis.TypeExpr + nullable bool +} + +// relation is a table or view of the case's database, by schema and name, +// in lower case. +type relation struct { + schema, name string +} + +// analyzer holds the session a case is described in and the catalog of +// the case's database. +type analyzer struct { + conn *sql.Conn + catalog map[relation][]column + // userTypes are the alias types the schema created, by name in lower + // case, which the server reports beside the system type they stand on + // and the dialect reports by their own name. + userTypes map[string]bool + // canonical names the type the dialect reports a spelling as, for each + // alias types.jsonl lists: SQL Server spells numeric and timestamp in + // its catalog, which the dialect names decimal and rowversion. + canonical map[string]string +} + +var dbNameRe = regexp.MustCompile(`[^A-Za-z0-9_]+`) + +// Analyze loads a case's schema and fixture into a database of their own +// on the server, describes its queries there and returns what SQL Server +// reports in the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, dsn string, c endtoend.Case) ([]byte, error) { + conn, err := open(ctx, dsn) + if err != nil { + return nil, err + } + defer conn.Close() + if err := checkVersion(ctx, conn); err != nil { + return nil, err + } + + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + + db := quote("goldeneye_" + dbNameRe.ReplaceAllString(c.Name, "_")) + for _, stmt := range []string{ + "USE master", + "DROP DATABASE IF EXISTS " + db, + "CREATE DATABASE " + db, + "USE " + db, + } { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, err + } + } + defer conn.ExecContext(context.WithoutCancel(ctx), "USE master; DROP DATABASE IF EXISTS "+db) + for _, stmt := range splitStatements(string(schema)) { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Schema, err) + } + } + for _, stmt := range splitStatements(string(fixture)) { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Fixture, err) + } + } + + a := &analyzer{conn: conn} + if a.canonical, err = readAliases(); err != nil { + return nil, err + } + if err := a.readCatalog(ctx); err != nil { + return nil, err + } + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := a.analyzeQuery(ctx, q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return analysis.Encode(out) +} + +// readAliases reads the aliases the hand-written types.jsonl gives each +// type, keyed by alias. +func readAliases() (map[string]string, error) { + dir, err := dialect.Dir(Engine) + if err != nil { + return nil, err + } + types, err := dialect.ReadTypes(dir) + if err != nil { + return nil, err + } + canonical := map[string]string{} + for _, t := range types { + for _, alias := range t.Aliases { + canonical[strings.ToLower(alias)] = strings.ToLower(t.Name) + } + } + return canonical, nil +} + +// Check compares what SQL Server reports for a case with the output the +// case committed, returning a diff when they differ. +func Check(ctx context.Context, dsn string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, dsn, c) + if err != nil { + return "", err + } + return c.Compare(got) +} + +// tablesQuery lists the tables and views of the current database, and the +// columns of each: the type as the schema declared it, whether that is a +// type the schema created, and the dimensions of a vector, which is all +// the describing function does not say. +const tablesQuery = ` +SELECT s.name, o.name, c.name, t.name, t.is_user_defined, c.vector_dimensions +FROM sys.columns c +JOIN sys.objects o ON o.object_id = c.object_id +JOIN sys.schemas s ON s.schema_id = o.schema_id +JOIN sys.types t ON t.user_type_id = c.user_type_id +WHERE o.type IN ('U', 'V') +ORDER BY s.name, o.name, c.column_id` + +// readCatalog reads the tables the schema created. The server spells each +// column's type by describing a SELECT * from the table, and the catalog +// says which columns that spelling is not the declared type of. +func (a *analyzer) readCatalog(ctx context.Context) error { + a.catalog = map[relation][]column{} + a.userTypes = map[string]bool{} + rows, err := a.conn.QueryContext(ctx, tablesQuery) + if err != nil { + return err + } + type declared struct { + name string + typeName string + userDefined bool + dimensions sql.NullInt64 + } + decls := map[relation][]declared{} + var order []relation + for rows.Next() { + var ( + schema, table, col string + d declared + ) + if err := rows.Scan(&schema, &table, &col, &d.typeName, &d.userDefined, &d.dimensions); err != nil { + rows.Close() + return err + } + d.name = col + rel := relation{strings.ToLower(schema), strings.ToLower(table)} + if _, ok := decls[rel]; !ok { + order = append(order, rel) + } + decls[rel] = append(decls[rel], d) + if d.userDefined { + a.userTypes[strings.ToLower(d.typeName)] = true + } + } + rows.Close() + if err := rows.Err(); err != nil { + return err + } + for _, rel := range order { + described, err := a.describe(ctx, "SELECT * FROM "+quote(rel.schema)+"."+quote(rel.name)) + if err != nil { + return fmt.Errorf("%s.%s: %w", rel.schema, rel.name, err) + } + byName := map[string]declared{} + for _, d := range decls[rel] { + byName[strings.ToLower(d.name)] = d + } + var cols []column + for _, dc := range described { + d, ok := byName[strings.ToLower(dc.name)] + if !ok { + return fmt.Errorf("%s.%s: the server describes a column %q the catalog does not list", rel.schema, rel.name, dc.name) + } + t := dc.typ + switch { + case d.userDefined: + t = &analysis.TypeExpr{Name: strings.ToLower(d.typeName)} + case strings.EqualFold(d.typeName, "json"): + t = &analysis.TypeExpr{Name: "json"} + case strings.EqualFold(d.typeName, "vector") && d.dimensions.Valid: + n := d.dimensions.Int64 + t = &analysis.TypeExpr{Name: "vector", Args: []analysis.TypeArg{{Int: &n}}} + } + cols = append(cols, column{name: strings.ToLower(dc.name), typ: t, nullable: dc.nullable}) + } + a.catalog[rel] = cols + } + return nil +} + +// described is one result column as sys.dm_exec_describe_first_result_set +// reports it. +type described struct { + name string + typ *analysis.TypeExpr + nullable bool + source *columnRef // the table column it is read from, or nil +} + +const describeColumnsQuery = ` +SELECT column_ordinal, name, system_type_name, user_type_name, is_nullable, + source_schema, source_table, source_column, is_computed_column, error_message +FROM sys.dm_exec_describe_first_result_set(@p1, NULL, 1) +WHERE is_hidden = 0 +ORDER BY column_ordinal` + +// describe asks the server what the first result set of a statement +// looks like. A statement that returns no rows describes as no columns; one +// the server cannot compile describes as its error. +func (a *analyzer) describe(ctx context.Context, query string) ([]described, error) { + rows, err := a.conn.QueryContext(ctx, describeColumnsQuery, query) + if err != nil { + return nil, err + } + defer rows.Close() + var out []described + for rows.Next() { + var ( + ordinal int + name, sysType, userType sql.NullString + nullable sql.NullBool + srcSchema, srcTable, srcColumn sql.NullString + computed sql.NullBool + errMsg sql.NullString + ) + if err := rows.Scan(&ordinal, &name, &sysType, &userType, &nullable, &srcSchema, &srcTable, &srcColumn, &computed, &errMsg); err != nil { + return nil, err + } + if errMsg.Valid { + return nil, fmt.Errorf("cannot be described: %s", errMsg.String) + } + d := described{ + name: name.String, + typ: a.typeOf(sysType.String, userType), + nullable: nullable.Bool, + } + // A computed column names the column it is computed from, as the + // one an update through the result set would write; a column is + // read from a table only when it is that column. + if srcTable.Valid && !computed.Bool { + d.source = &columnRef{schema: srcSchema.String, table: srcTable.String, column: srcColumn.String} + } + out = append(out, d) + } + return out, rows.Err() +} + +// typeOf reads a type the server spelled, which is the system type unless +// the server also names a type the schema created, which the dialect +// reports by that name and no argument. +func (a *analyzer) typeOf(systemType string, userType sql.NullString) *analysis.TypeExpr { + if userType.Valid && a.userTypes[strings.ToLower(userType.String)] { + return &analysis.TypeExpr{Name: strings.ToLower(userType.String)} + } + return parseType(systemType, a.canonical) +} + +// parseType reads a type spelled the way a declaration spells it — +// nvarchar(max), decimal(10,2), datetime2(7) — into an expression, named +// the way the dialect names it when the spelling is one of the aliases +// the dialect lists: numeric is decimal, timestamp is rowversion. +func parseType(s string, canonical map[string]string) *analysis.TypeExpr { + s = strings.TrimSpace(strings.ToLower(s)) + name, args := s, "" + if open := strings.IndexByte(s, '('); open >= 0 && strings.HasSuffix(s, ")") { + name, args = strings.TrimSpace(s[:open]), s[open+1:len(s)-1] + } + if c, ok := canonical[name]; ok { + name = c + } + t := &analysis.TypeExpr{Name: name} + if args == "" { + return t + } + for _, arg := range strings.Split(args, ",") { + arg = strings.TrimSpace(arg) + if n, err := strconv.ParseInt(arg, 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } else { + ident := arg + t.Args = append(t.Args, analysis.TypeArg{Ident: &ident}) + } + } + return t +} + +// withNullable copies a type with its nullability set. +func withNullable(t *analysis.TypeExpr, nullable bool) *analysis.TypeExpr { + if t == nil { + return nil + } + out := *t + out.Nullable = nullable + return &out +} + +// lookup finds a column of the case's database in the catalog. +func (a *analyzer) lookup(ref columnRef) (column, bool) { + cols, ok := a.catalog[relation{strings.ToLower(ref.schema), strings.ToLower(ref.table)}] + if !ok { + return column{}, false + } + for _, col := range cols { + if strings.EqualFold(col.name, ref.column) { + return col, true + } + } + return column{}, false +} + +// parameter is what sp_describe_undeclared_parameters says about one +// variable the statement leaves undeclared. +type parameter struct { + systemType string + userType sql.NullString +} + +// undeclaredParameters asks the server what type it would give each +// parameter, keyed by the variable's name without the @. +func (a *analyzer) undeclaredParameters(ctx context.Context, query string) (map[string]parameter, error) { + rows, err := a.conn.QueryContext(ctx, "EXEC sp_describe_undeclared_parameters @p1", query) + if err != nil { + return nil, err + } + defer rows.Close() + cols, err := rows.Columns() + if err != nil { + return nil, err + } + index := map[string]int{} + for i, c := range cols { + index[c] = i + } + params := map[string]parameter{} + for rows.Next() { + vals := make([]any, len(cols)) + ptrs := make([]any, len(cols)) + for i := range vals { + ptrs[i] = &vals[i] + } + if err := rows.Scan(ptrs...); err != nil { + return nil, err + } + str := func(col string) sql.NullString { + i, ok := index[col] + if !ok || vals[i] == nil { + return sql.NullString{} + } + return sql.NullString{String: fmt.Sprint(vals[i]), Valid: true} + } + name := strings.TrimPrefix(str("name").String, "@") + params[name] = parameter{ + systemType: str("suggested_system_type_name").String, + userType: str("suggested_user_type_name"), + } + } + return params, rows.Err() +} + +// analyzeQuery describes one query. +func (a *analyzer) analyzeQuery(ctx context.Context, q endtoend.Query) (analysis.Query, error) { + sql, phs := bind(q.SQL) + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + + described, err := a.describe(ctx, sql) + if err != nil { + return analysis.Query{}, err + } + for _, d := range described { + ac := analysis.Column{Name: strings.ToLower(d.name), Type: withNullable(d.typ, d.nullable)} + if d.source != nil { + if col, ok := a.lookup(*d.source); ok { + ac.Type = withNullable(col.typ, d.nullable) + } + ac.Table = strings.ToLower(d.source.table) + } + aq.Columns = append(aq.Columns, ac) + } + + if len(phs) == 0 { + return aq, nil + } + params, err := a.undeclaredParameters(ctx, sql) + if err != nil { + return analysis.Query{}, err + } + var decl []string + for _, ph := range phs { + for _, v := range ph.Vars { + p, ok := params[v] + if !ok { + return analysis.Query{}, fmt.Errorf("the server did not describe parameter @%s", v) + } + decl = append(decl, "@"+v+" "+p.systemType) + } + } + partners, err := a.partners(ctx, "DECLARE "+strings.Join(decl, ", ")+";\n"+sql) + if err != nil { + return analysis.Query{}, err + } + for _, ph := range phs { + ac := analysis.Column{} + found := false + for _, v := range ph.Vars { + ref, ok := partners[v] + if !ok { + continue + } + col, ok := a.lookup(ref) + if !ok { + continue + } + ac = analysis.Column{Name: col.name, Type: withNullable(col.typ, col.nullable), Table: strings.ToLower(ref.table)} + found = true + break + } + if !found { + p := params[ph.Vars[0]] + ac.Type = a.typeOf(p.systemType, p.userType) + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} diff --git a/internal/goldeneye/mssql/mssql.go b/internal/goldeneye/mssql/mssql.go new file mode 100644 index 0000000000..23c338a986 --- /dev/null +++ b/internal/goldeneye/mssql/mssql.go @@ -0,0 +1,153 @@ +// Package mssql generates the SQL Server dialect seed under +// internal/engine/mssql/dialect from a live server, and verifies the SQL +// Server analyze cases under internal/endtoend/testdata against the same +// server. +// +// SQL Server keeps no catalog of its built-in functions or operators — the +// intrinsic functions such as GETDATE and LEN are not objects — so +// types.jsonl and functions.jsonl are written by hand and are not this +// package's business. What it does describe is its catalog: relations.jsonl +// is every view of the sys and INFORMATION_SCHEMA schemas, with each view's +// columns as the server itself describes a SELECT * from it. +// +// The package also verifies the SQL Server analyze cases under +// internal/endtoend/testdata against the same server: each case's schema +// and fixture are loaded into a database of their own and its queries +// described there, without being run. Result columns come from +// sys.dm_exec_describe_first_result_set, which says what each column is +// called, what type it has, whether it can be NULL and which table column +// it is read from; parameters from sp_describe_undeclared_parameters, which +// says what type the server would give each, and from the estimated +// showplan, which says which column each is compared with or assigned to. +// The answer is printed in the JSON shape sqlc analyze prints and compared +// with the case's committed stdout.json byte for byte. +// +// The server is named by MSSQL_SERVER_URI, in any form the go-mssqldb +// driver accepts, such as +// sqlserver://sa:password@127.0.0.1:1433?encrypt=disable, and has to be +// the major release in Major, since each release adds to the catalog views. +package mssql + +import ( + "context" + "database/sql" + "errors" + "fmt" + "os" + "strconv" + "strings" + + _ "github.com/microsoft/go-mssqldb" + "github.com/microsoft/go-mssqldb/msdsn" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name sqlc knows the dialect by, and the name of the analyze +// case directories under internal/endtoend/testdata. +const Engine = "mssql" + +// Major is the SQL Server major release the dialect is generated from, as +// SERVERPROPERTY('ProductMajorVersion') reports it: 17 is SQL Server 2025. +// Bumping it is a deliberate change: every release adds views and columns +// to the catalog, so regenerate and review the dialect after changing it. +const Major = 17 + +// Locate returns the server to generate from, named by MSSQL_SERVER_URI. +func Locate() (string, error) { + dsn := os.Getenv("MSSQL_SERVER_URI") + if dsn == "" { + return "", errors.New("MSSQL_SERVER_URI is not set") + } + if _, err := msdsn.Parse(dsn); err != nil { + return "", fmt.Errorf("MSSQL_SERVER_URI: %w", err) + } + return dsn, nil +} + +// open connects to the server and holds one session, since a case's +// database is the session's current database and the showplan is a +// session setting. +func open(ctx context.Context, dsn string) (*sql.Conn, error) { + db, err := sql.Open("sqlserver", dsn) + if err != nil { + return nil, err + } + conn, err := db.Conn(ctx) + if err != nil { + db.Close() + return nil, err + } + return conn, nil +} + +// Version reports the release a server is. +func Version(ctx context.Context, dsn string) (string, error) { + conn, err := open(ctx, dsn) + if err != nil { + return "", err + } + defer conn.Close() + var v string + if err := conn.QueryRowContext(ctx, "SELECT @@VERSION").Scan(&v); err != nil { + return "", err + } + // The first line names the product and build; the rest is the copyright + // and the platform. + v, _, _ = strings.Cut(v, "\n") + return strings.TrimSpace(v), nil +} + +// checkVersion refuses a server of another major release than the dialect +// is generated from, whose catalog would differ from the committed one +// without anything being wrong. +func checkVersion(ctx context.Context, conn *sql.Conn) error { + var v string + if err := conn.QueryRowContext(ctx, "SELECT CAST(SERVERPROPERTY('ProductMajorVersion') AS nvarchar(10))").Scan(&v); err != nil { + return err + } + major, err := strconv.Atoi(v) + if err != nil { + return fmt.Errorf("ProductMajorVersion %q: %w", v, err) + } + if major != Major { + return fmt.Errorf("the dialect is generated from SQL Server major release %d, but the server is release %d", Major, major) + } + return nil +} + +// Generate reads the dialect from the server: relations.jsonl, the views of +// sys and INFORMATION_SCHEMA. They are read from a database of their own, +// since the views a query sees are the ones a user database has, and +// master lists internal views of its own that no query can name. +func Generate(ctx context.Context, dsn string) (dialect.Files, error) { + conn, err := open(ctx, dsn) + if err != nil { + return nil, err + } + defer conn.Close() + if err := checkVersion(ctx, conn); err != nil { + return nil, err + } + db := quote("goldeneye_dialect") + for _, stmt := range []string{ + "USE master", + "DROP DATABASE IF EXISTS " + db, + "CREATE DATABASE " + db, + "USE " + db, + } { + if _, err := conn.ExecContext(ctx, stmt); err != nil { + return nil, err + } + } + defer conn.ExecContext(context.WithoutCancel(ctx), "USE master; DROP DATABASE IF EXISTS "+db) + relations, err := readRelations(ctx, conn) + if err != nil { + return nil, err + } + blob, err := dialect.JSONL(relations) + if err != nil { + return nil, err + } + return dialect.Files{dialect.RelationsFile: blob}, nil +} diff --git a/internal/goldeneye/mssql/mssql_test.go b/internal/goldeneye/mssql/mssql_test.go new file mode 100644 index 0000000000..e83b324dfe --- /dev/null +++ b/internal/goldeneye/mssql/mssql_test.go @@ -0,0 +1,66 @@ +package mssql + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// TestDialect verifies the committed SQL Server dialect against what the +// server reports. It skips unless MSSQL_SERVER_URI names a server. +func TestDialect(t *testing.T) { + dsn, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, dsn) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, dsn) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Engine) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} + +// TestAnalyzeCases verifies every SQL Server analyze case under +// internal/endtoend/testdata against what the server reports. It skips +// unless MSSQL_SERVER_URI names a server. +func TestAnalyzeCases(t *testing.T) { + dsn, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Engine) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no mssql analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), dsn, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what SQL Server reports (-committed +mssql):\n%s", c.Output, diff) + } + }) + } +} diff --git a/internal/goldeneye/mssql/plan.go b/internal/goldeneye/mssql/plan.go new file mode 100644 index 0000000000..d11054b29e --- /dev/null +++ b/internal/goldeneye/mssql/plan.go @@ -0,0 +1,243 @@ +package mssql + +import ( + "context" + "encoding/xml" + "fmt" + "strings" +) + +// The estimated showplan is the one thing that says what a parameter is +// compared with or assigned to. It is compiled, not run, with SET +// SHOWPLAN_XML ON, and prints the plan as XML in which every column is a +// ColumnReference naming its schema, table and column, and every variable +// one naming only @variable. A parameter's partner is the column on the +// other side of the Compare it is an operand of, the column an Assign +// sets to it, or the column of a seek whose range expression it is. An +// expression the plan computes once and refers to by name, Expr1002, is +// followed to its DefinedValue. A parameter the query casts, CAST(@p AS +// T), has no partner: the cast says what it is, as it does to sqlc, and +// the plan shows it as a Convert the query asked for rather than one the +// server added. + +// columnRef names a table column the plan refers to. +type columnRef struct { + schema, table, column string +} + +// node is one element of the showplan XML. +type node struct { + XMLName xml.Name + Attrs []xml.Attr `xml:",any,attr"` + Children []node `xml:",any"` +} + +func (n *node) attr(name string) string { + for _, a := range n.Attrs { + if a.Name.Local == name { + return a.Value + } + } + return "" +} + +// unbracket strips the [brackets] the plan quotes names with. +func unbracket(s string) string { + if strings.HasPrefix(s, "[") && strings.HasSuffix(s, "]") { + return strings.ReplaceAll(s[1:len(s)-1], "]]", "]") + } + return s +} + +// plan is a parsed showplan with the expressions it defines by name. +type plan struct { + root node + defined map[string]*node // Expr1002 -> the ScalarOperator defining it +} + +// partners compiles a batch and returns the column each variable is +// compared with or assigned to, keyed by the variable's name without the +// @. A variable with no such column is absent. +func (a *analyzer) partners(ctx context.Context, batch string) (map[string]columnRef, error) { + if _, err := a.conn.ExecContext(ctx, "SET SHOWPLAN_XML ON"); err != nil { + return nil, err + } + defer a.conn.ExecContext(context.WithoutCancel(ctx), "SET SHOWPLAN_XML OFF") + rows, err := a.conn.QueryContext(ctx, batch) + if err != nil { + return nil, fmt.Errorf("showplan: %w", err) + } + defer rows.Close() + var blob string + for rows.Next() { + var s string + if err := rows.Scan(&s); err != nil { + return nil, err + } + blob += s + } + if err := rows.Err(); err != nil { + return nil, err + } + p := &plan{defined: map[string]*node{}} + if err := xml.Unmarshal([]byte(blob), &p.root); err != nil { + return nil, fmt.Errorf("showplan: %w", err) + } + p.collectDefined(&p.root) + partners := map[string]columnRef{} + p.walk(&p.root, partners) + return partners, nil +} + +// collectDefined records every DefinedValue that names an expression. +func (p *plan) collectDefined(n *node) { + if n.XMLName.Local == "DefinedValue" && len(n.Children) >= 2 { + ref := &n.Children[0] + if ref.XMLName.Local == "ColumnReference" && ref.attr("Table") == "" && !strings.HasPrefix(ref.attr("Column"), "@") { + p.defined[ref.attr("Column")] = &n.Children[1] + } + } + for i := range n.Children { + p.collectDefined(&n.Children[i]) + } +} + +// walk finds the partners in a subtree, keeping the first found for each +// variable. +func (p *plan) walk(n *node, partners map[string]columnRef) { + set := func(vars []string, ref columnRef) { + for _, v := range vars { + if _, ok := partners[v]; !ok { + partners[v] = ref + } + } + } + switch n.XMLName.Local { + case "Compare": + var sides []*node + for i := range n.Children { + if n.Children[i].XMLName.Local == "ScalarOperator" { + sides = append(sides, &n.Children[i]) + } + } + if len(sides) == 2 { + for i, side := range sides { + vars := p.variables(side, nil) + if len(vars) == 0 { + continue + } + if cols := p.columns(sides[1-i], nil); len(cols) > 0 { + set(vars, cols[0]) + } + } + } + case "Assign": + var target *columnRef + for i := range n.Children { + c := &n.Children[i] + switch c.XMLName.Local { + case "ColumnReference": + if ref, ok := refOf(c); ok && target == nil { + target = &ref + } + case "ScalarOperator": + if target != nil { + set(p.variables(c, nil), *target) + } + } + } + case "Prefix", "StartRange", "EndRange": + var cols []columnRef + var exprs []*node + for i := range n.Children { + c := &n.Children[i] + switch c.XMLName.Local { + case "RangeColumns": + for j := range c.Children { + if ref, ok := refOf(&c.Children[j]); ok { + cols = append(cols, ref) + } + } + case "RangeExpressions": + for j := range c.Children { + exprs = append(exprs, &c.Children[j]) + } + } + } + for i, e := range exprs { + if i < len(cols) { + set(p.variables(e, nil), cols[i]) + } + } + } + for i := range n.Children { + p.walk(&n.Children[i], partners) + } +} + +// refOf reads a ColumnReference that names a table column. +func refOf(n *node) (columnRef, bool) { + if n.XMLName.Local != "ColumnReference" || n.attr("Table") == "" { + return columnRef{}, false + } + return columnRef{ + schema: unbracket(n.attr("Schema")), + table: unbracket(n.attr("Table")), + column: n.attr("Column"), + }, true +} + +// variables lists the variables a subtree refers to, following named +// expressions and leaving out the ones under a cast the query wrote. +func (p *plan) variables(n *node, seen map[string]bool) []string { + var out []string + if n.XMLName.Local == "Convert" && n.attr("Implicit") == "0" { + return nil + } + if n.XMLName.Local == "ColumnReference" { + col := n.attr("Column") + switch { + case strings.HasPrefix(col, "@"): + return []string{col[1:]} + case n.attr("Table") == "": + if def, ok := p.defined[col]; ok && !seen[col] { + if seen == nil { + seen = map[string]bool{} + } + seen[col] = true + vars := p.variables(def, seen) + delete(seen, col) + return vars + } + } + } + for i := range n.Children { + out = append(out, p.variables(&n.Children[i], seen)...) + } + return out +} + +// columns lists the table columns a subtree refers to, following named +// expressions. +func (p *plan) columns(n *node, seen map[string]bool) []columnRef { + var out []columnRef + if n.XMLName.Local == "ColumnReference" { + if ref, ok := refOf(n); ok { + return []columnRef{ref} + } + col := n.attr("Column") + if def, ok := p.defined[col]; ok && !seen[col] { + if seen == nil { + seen = map[string]bool{} + } + seen[col] = true + cols := p.columns(def, seen) + delete(seen, col) + return cols + } + } + for i := range n.Children { + out = append(out, p.columns(&n.Children[i], seen)...) + } + return out +} diff --git a/internal/goldeneye/mssql/relations.go b/internal/goldeneye/mssql/relations.go new file mode 100644 index 0000000000..1b51c4cf65 --- /dev/null +++ b/internal/goldeneye/mssql/relations.go @@ -0,0 +1,123 @@ +package mssql + +import ( + "context" + "database/sql" + "fmt" + "sort" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// systemSchemas are the schemas whose relations are generated: the catalog +// views, which are what a query of the server's catalog reads. Both hold +// nothing but views, so every relation a dialect seeds from them is one +// the analysis core never hands codegen as a model. +var systemSchemas = []string{ + "sys", + "INFORMATION_SCHEMA", +} + +// viewQuery lists a schema's views. They are sorted in Go, by the bytes +// of their lower-cased names, so that the output does not depend on the +// server's collation. +const viewQuery = ` +SELECT o.name +FROM sys.all_objects o +JOIN sys.schemas s ON s.schema_id = o.schema_id +WHERE o.type = 'V' AND s.name = @p1` + +// describeQuery asks the server to describe a SELECT * from a view: each +// column's name, its type spelled the way a declaration spells it — +// nvarchar(128), decimal(10,2), varbinary(max) — and whether it can be +// NULL. A view the server cannot describe reports an error message on a +// row of its own rather than failing the query. +const describeQuery = ` +SELECT column_ordinal, name, system_type_name, is_nullable, error_message +FROM sys.dm_exec_describe_first_result_set(@p1, NULL, 0) +ORDER BY column_ordinal` + +// readRelations reads the views of the system schemas. Their names are +// written in lower case: SQL Server matches them in any case under its +// default collations, INFORMATION_SCHEMA spells its own in upper case, and +// sqlc's SQL Server parser lowercases every identifier, so lower case is +// how a query reaches them. The type of each column is spelled the way the +// server describes it to a driver, which is the way a declaration spells +// it, numeric and timestamp included, since the seed reads the aliases +// types.jsonl lists. +func readRelations(ctx context.Context, conn *sql.Conn) ([]dialect.Relation, error) { + var relations []dialect.Relation + for _, schema := range systemSchemas { + names, err := views(ctx, conn, schema) + if err != nil { + return nil, fmt.Errorf("%s: %w", schema, err) + } + for _, name := range names { + columns, err := describe(ctx, conn, schema, name) + if err != nil { + return nil, fmt.Errorf("%s.%s: %w", schema, name, err) + } + relations = append(relations, dialect.Relation{ + Schema: strings.ToLower(schema), + Name: strings.ToLower(name), + Kind: "v", + Columns: columns, + }) + } + } + return relations, nil +} + +func views(ctx context.Context, conn *sql.Conn, schema string) ([]string, error) { + rows, err := conn.QueryContext(ctx, viewQuery, schema) + if err != nil { + return nil, err + } + defer rows.Close() + var names []string + for rows.Next() { + var name string + if err := rows.Scan(&name); err != nil { + return nil, err + } + names = append(names, name) + } + sort.Slice(names, func(i, j int) bool { return strings.ToLower(names[i]) < strings.ToLower(names[j]) }) + return names, rows.Err() +} + +func describe(ctx context.Context, conn *sql.Conn, schema, name string) ([]dialect.Column, error) { + rows, err := conn.QueryContext(ctx, describeQuery, "SELECT * FROM "+quote(schema)+"."+quote(name)) + if err != nil { + return nil, err + } + defer rows.Close() + var columns []dialect.Column + for rows.Next() { + var ( + ordinal int + colName sql.NullString + typeName sql.NullString + nullable sql.NullBool + errMsg sql.NullString + ) + if err := rows.Scan(&ordinal, &colName, &typeName, &nullable, &errMsg); err != nil { + return nil, err + } + if errMsg.Valid { + return nil, fmt.Errorf("cannot be described: %s", errMsg.String) + } + columns = append(columns, dialect.Column{ + Name: strings.ToLower(colName.String), + Type: typeName.String, + NotNull: !nullable.Bool, + }) + } + return columns, rows.Err() +} + +// quote brackets an identifier the way T-SQL does. +func quote(name string) string { + return "[" + strings.ReplaceAll(name, "]", "]]") + "]" +} diff --git a/internal/goldeneye/spanner/analyze.go b/internal/goldeneye/spanner/analyze.go new file mode 100644 index 0000000000..813ec3f7ff --- /dev/null +++ b/internal/goldeneye/spanner/analyze.go @@ -0,0 +1,673 @@ +package spanner + +import ( + "context" + "fmt" + "hash/crc32" + "os" + "regexp" + "strconv" + "strings" + + "cloud.google.com/go/spanner/apiv1/spannerpb" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/analysis" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// The analyze cases are checked against a live server, which compiles +// each query in PLAN mode: nothing runs, and the server reports the name +// and type of each result column, the type of each parameter the query +// leaves undeclared, and the query plan. The metadata types a value the +// way the wire does — STRING, ARRAY — without the length a +// declaration gives a STRING(10) or whether the column can be NULL, so a +// result column the plan reads from a table column is described from the +// case's INFORMATION_SCHEMA instead, and a parameter the plan compares +// with or assigns to a table column is described as that column. + +// placeholder is one parameter of a query as sqlc numbers them: each +// @name or sqlc.arg name once, at its first appearance, which is how +// Spanner numbers its named parameters too. +type placeholder struct { + Number int + Name string +} + +var identRe = regexp.MustCompile(`^@([A-Za-z_][A-Za-z0-9_]*)`) + +// bind rewrites the query so that every parameter is a Spanner @name, and +// lists the parameters in sqlc's order. The query's own @name references +// are kept, since that is how sqlc's GoogleSQL queries name their +// parameters; a sqlc.arg becomes one, and each ? in turn becomes one +// named after its position. A @@system_variable is not a parameter. +func bind(query string) (string, []placeholder) { + positional := 0 + sql := endtoend.Rewrite(query, func(name, _ string) string { + if name == "" { + positional++ + name = "p" + strconv.Itoa(positional) + } + return "@" + name + }) + var phs []placeholder + numbers := map[string]int{} + i := 0 + for i < len(sql) { + c := sql[i] + switch { + case c == '\'' || c == '"' || c == '`': + i = skipQuoted(sql, i) + case strings.HasPrefix(sql[i:], "--") || strings.HasPrefix(sql[i:], "#"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + i = len(sql) + } else { + i += end + } + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + i = len(sql) + } else { + i += end + 2 + } + case c == '@' && i+1 < len(sql) && sql[i+1] == '@': + i += 2 + for i < len(sql) && (isWordByte(sql[i])) { + i++ + } + case c == '@' && identRe.MatchString(sql[i:]): + m := identRe.FindStringSubmatch(sql[i:]) + if _, ok := numbers[m[1]]; !ok { + numbers[m[1]] = len(phs) + 1 + phs = append(phs, placeholder{Number: len(phs) + 1, Name: m[1]}) + } + i += len(m[0]) + default: + i++ + } + } + return sql, phs +} + +func isWordByte(c byte) bool { + return c == '_' || c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' +} + +// skipQuoted returns the index just past the quoted token starting at i, +// honouring backslash escapes. +func skipQuoted(s string, i int) int { + q := s[i] + j := i + 1 + for j < len(s) { + switch { + case s[j] == '\\' && j+1 < len(s): + j += 2 + case s[j] == q: + return j + 1 + default: + j++ + } + } + return len(s) +} + +// splitStatements splits a script on the semicolons outside strings and +// comments, which is how a schema's DDL is handed to CREATE DATABASE and a +// fixture's DML to a transaction. +func splitStatements(src string) []string { + var stmts []string + flush := func(s string) { + if s = strings.TrimSpace(s); s != "" { + stmts = append(stmts, s) + } + } + start, i := 0, 0 + for i < len(src) { + c := src[i] + switch { + case c == '\'' || c == '"' || c == '`': + i = skipQuoted(src, i) + case strings.HasPrefix(src[i:], "--") || strings.HasPrefix(src[i:], "#"): + end := strings.IndexByte(src[i:], '\n') + if end < 0 { + i = len(src) + } else { + i += end + } + case strings.HasPrefix(src[i:], "/*"): + end := strings.Index(src[i:], "*/") + if end < 0 { + i = len(src) + } else { + i += end + 2 + } + case c == ';': + flush(src[start:i]) + start = i + 1 + i++ + default: + i++ + } + } + flush(src[start:]) + return stmts +} + +// column is what INFORMATION_SCHEMA says about a column of the case's +// database: its type as the schema declared it, and whether it can be +// NULL. +type column struct { + name string + typ *analysis.TypeExpr + nullable bool +} + +// analyzer holds the session a case is compiled in and the catalog of the +// case's database, keyed by table name in the database's own schema. +type analyzer struct { + s *server + session string + catalog map[string][]column + keys map[string][]string // the primary key columns of each table +} + +var dbNameRe = regexp.MustCompile(`[^a-z0-9_]+`) + +// Analyze creates a database of the case's own from its schema, writes its +// fixture there, compiles its queries and returns what Spanner reports in +// the JSON shape sqlc analyze prints. +func Analyze(ctx context.Context, endpoint string, c endtoend.Case) ([]byte, error) { + s, err := open(ctx, endpoint) + if err != nil { + return nil, err + } + defer s.Close() + + schema, err := os.ReadFile(c.Schema) + if err != nil { + return nil, err + } + var fixture []byte + if c.Fixture != "" { + if fixture, err = os.ReadFile(c.Fixture); err != nil { + return nil, err + } + } + queries, err := c.Queries() + if err != nil { + return nil, err + } + + // A database id is lower-case letters, digits and underscores, at + // most 30 characters: the case's name, cut to fit, and a hash of the + // whole of it, so that two cases with the same head stay apart. + hash := fmt.Sprintf("%08x", crc32.ChecksumIEEE([]byte(c.Name))) + name := "goldeneye_" + dbNameRe.ReplaceAllString(strings.ToLower(c.Name), "_") + if max := 30 - 1 - len(hash); len(name) > max { + name = name[:max] + } + name = strings.TrimRight(name, "_") + "_" + hash + db := Instance + "/databases/" + name + if err := s.dropDatabase(ctx, db); err != nil { + return nil, err + } + if _, err := s.createDatabase(ctx, name, splitStatements(string(schema))); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Schema, err) + } + defer s.dropDatabase(context.WithoutCancel(ctx), db) + session, err := s.session(ctx, db) + if err != nil { + return nil, err + } + if stmts := splitStatements(string(fixture)); len(stmts) > 0 { + if err := s.write(ctx, session, stmts); err != nil { + return nil, fmt.Errorf("loading %s: %w", c.Fixture, err) + } + } + + a := &analyzer{s: s, session: session} + if err := a.readCatalog(ctx); err != nil { + return nil, err + } + out := make([]analysis.Query, 0, len(queries)) + for _, q := range queries { + aq, err := a.analyzeQuery(ctx, q) + if err != nil { + return nil, fmt.Errorf("%s: %w", q.Name, err) + } + out = append(out, aq) + } + return analysis.Encode(out) +} + +// Check compares what Spanner reports for a case with the output the +// case committed, returning a diff when they differ. +func Check(ctx context.Context, endpoint string, c endtoend.Case) (string, error) { + got, err := Analyze(ctx, endpoint, c) + if err != nil { + return "", err + } + return c.Compare(got) +} + +// write runs DML statements in a read-write transaction and commits it. +func (s *server) write(ctx context.Context, session string, stmts []string) error { + tx, err := s.data.BeginTransaction(ctx, &spannerpb.BeginTransactionRequest{ + Session: session, + Options: &spannerpb.TransactionOptions{Mode: &spannerpb.TransactionOptions_ReadWrite_{ReadWrite: &spannerpb.TransactionOptions_ReadWrite{}}}, + }) + if err != nil { + return err + } + req := &spannerpb.ExecuteBatchDmlRequest{ + Session: session, + Transaction: &spannerpb.TransactionSelector{Selector: &spannerpb.TransactionSelector_Id{Id: tx.Id}}, + Seqno: 1, + } + for _, stmt := range stmts { + req.Statements = append(req.Statements, &spannerpb.ExecuteBatchDmlRequest_Statement{Sql: stmt}) + } + resp, err := s.data.ExecuteBatchDml(ctx, req) + if err == nil && resp.Status != nil && resp.Status.Code != 0 { + err = fmt.Errorf("%s", resp.Status.Message) + } + if err != nil { + s.data.Rollback(context.WithoutCancel(ctx), &spannerpb.RollbackRequest{Session: session, TransactionId: tx.Id}) + return err + } + _, err = s.data.Commit(ctx, &spannerpb.CommitRequest{ + Session: session, + Transaction: &spannerpb.CommitRequest_TransactionId{TransactionId: tx.Id}, + }) + return err +} + +const catalogQuery = ` +SELECT TABLE_NAME, COLUMN_NAME, SPANNER_TYPE, IS_NULLABLE +FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_SCHEMA = '' +ORDER BY TABLE_NAME, ORDINAL_POSITION` + +const keysQuery = ` +SELECT TABLE_NAME, COLUMN_NAME +FROM INFORMATION_SCHEMA.INDEX_COLUMNS +WHERE TABLE_SCHEMA = '' AND INDEX_TYPE = 'PRIMARY_KEY' +ORDER BY TABLE_NAME, ORDINAL_POSITION` + +// readCatalog reads the tables the schema created, and their keys. +func (a *analyzer) readCatalog(ctx context.Context) error { + rows, err := a.s.query(ctx, a.session, catalogQuery) + if err != nil { + return err + } + a.catalog = map[string][]column{} + for _, row := range rows { + table := row[0].GetStringValue() + a.catalog[table] = append(a.catalog[table], column{ + name: row[1].GetStringValue(), + typ: parseType(row[2].GetStringValue()), + nullable: row[3].GetStringValue() == "YES", + }) + } + rows, err = a.s.query(ctx, a.session, keysQuery) + if err != nil { + return err + } + a.keys = map[string][]string{} + for _, row := range rows { + table := row[0].GetStringValue() + a.keys[table] = append(a.keys[table], row[1].GetStringValue()) + } + return nil +} + +// tableName returns the catalog's spelling of a table's name, which +// Spanner matches in any case. +func (a *analyzer) tableName(table string) string { + for t := range a.catalog { + if strings.EqualFold(t, table) { + return t + } + } + return table +} + +// lookup finds a column of a table of the case's database. Spanner +// matches table and column names in any case. +func (a *analyzer) lookup(table, name string) (column, bool) { + for t, cols := range a.catalog { + if !strings.EqualFold(t, table) { + continue + } + for _, col := range cols { + if strings.EqualFold(col.name, name) { + return col, true + } + } + } + return column{}, false +} + +// parseType reads a type spelled the way SPANNER_TYPE and a declaration +// spell it — STRING(10), ARRAY, STRUCT — +// into an expression, in lower case, with MAX an identifier. +func parseType(s string) *analysis.TypeExpr { + s = strings.TrimSpace(s) + lower := strings.ToLower(s) + if element, ok := strings.CutPrefix(lower, "array<"); ok && strings.HasSuffix(element, ">") { + return &analysis.TypeExpr{Name: "array", Args: []analysis.TypeArg{{Type: parseType(s[6 : len(s)-1])}}} + } + for _, kind := range []string{"proto", "enum"} { + if message, ok := strings.CutPrefix(lower, kind+"<"); ok && strings.HasSuffix(message, ">") { + m := s[len(kind)+1 : len(s)-1] + return &analysis.TypeExpr{Name: kind, Args: []analysis.TypeArg{{String: &m}}} + } + } + if fields, ok := strings.CutPrefix(lower, "struct<"); ok && strings.HasSuffix(fields, ">") { + t := &analysis.TypeExpr{Name: "struct"} + for _, f := range splitTop(s[7:len(s)-1], ',') { + f = strings.TrimSpace(f) + label, typ := "", f + if i := strings.IndexAny(f, " \t"); i > 0 && !strings.ContainsAny(f[:i], "<(") { + label, typ = f[:i], strings.TrimSpace(f[i+1:]) + } + t.Args = append(t.Args, analysis.TypeArg{Label: label, Type: parseType(typ)}) + } + return t + } + name, args := lower, "" + if open := strings.IndexByte(lower, '('); open >= 0 && strings.HasSuffix(lower, ")") { + name, args = strings.TrimSpace(lower[:open]), lower[open+1:len(lower)-1] + } + t := &analysis.TypeExpr{Name: name} + if args == "" { + return t + } + for _, arg := range strings.Split(args, ",") { + arg = strings.TrimSpace(arg) + if n, err := strconv.ParseInt(arg, 10, 64); err == nil { + t.Args = append(t.Args, analysis.TypeArg{Int: &n}) + } else { + ident := arg + t.Args = append(t.Args, analysis.TypeArg{Ident: &ident}) + } + } + return t +} + +// splitTop splits on a separator outside angle brackets and parentheses. +func splitTop(s string, sep byte) []string { + var out []string + depth, start := 0, 0 + for i := 0; i < len(s); i++ { + switch s[i] { + case '<', '(': + depth++ + case '>', ')': + depth-- + case sep: + if depth == 0 { + out = append(out, s[start:i]) + start = i + 1 + } + } + } + return append(out, s[start:]) +} + +// typeOf reads a type the way the wire spells it, which names the family +// and, for an array or a struct, what it holds, and nothing of a length. +func typeOf(t *spannerpb.Type) *analysis.TypeExpr { + if t == nil { + return nil + } + switch t.Code { + case spannerpb.TypeCode_ARRAY: + return &analysis.TypeExpr{Name: "array", Args: []analysis.TypeArg{{Type: typeOf(t.ArrayElementType)}}} + case spannerpb.TypeCode_STRUCT: + out := &analysis.TypeExpr{Name: "struct"} + if t.StructType != nil { + for _, f := range t.StructType.Fields { + out.Args = append(out.Args, analysis.TypeArg{Label: f.Name, Type: typeOf(f.Type)}) + } + } + return out + case spannerpb.TypeCode_PROTO, spannerpb.TypeCode_ENUM: + // A proto or enum is named by its message, the way a declaration + // spells PROTO. + fqn := t.ProtoTypeFqn + return &analysis.TypeExpr{Name: strings.ToLower(t.Code.String()), Args: []analysis.TypeArg{{String: &fqn}}} + } + return &analysis.TypeExpr{Name: strings.ToLower(t.Code.String())} +} + +// withNullable copies a type with its nullability set. +func withNullable(t *analysis.TypeExpr, nullable bool) *analysis.TypeExpr { + if t == nil { + return nil + } + out := *t + out.Nullable = nullable + return &out +} + +// isDML reports whether a statement writes, and so has to be compiled in a +// read-write transaction, which is begun for it and never committed. The +// statement's first word decides, past any comment it opens with. +func isDML(sql string) bool { + i := 0 + for i < len(sql) { + switch { + case sql[i] == ' ' || sql[i] == '\t' || sql[i] == '\n' || sql[i] == '\r': + i++ + case strings.HasPrefix(sql[i:], "--") || strings.HasPrefix(sql[i:], "#"): + end := strings.IndexByte(sql[i:], '\n') + if end < 0 { + return false + } + i += end + case strings.HasPrefix(sql[i:], "/*"): + end := strings.Index(sql[i:], "*/") + if end < 0 { + return false + } + i += end + 2 + default: + head := strings.ToLower(sql[i:]) + for _, kw := range []string{"insert", "update", "delete"} { + if strings.HasPrefix(head, kw) { + return true + } + } + return false + } + } + return false +} + +// compile compiles a statement in PLAN mode and returns what the server +// reports about it. +func (a *analyzer) compile(ctx context.Context, sql string) (*spannerpb.ResultSet, error) { + req := &spannerpb.ExecuteSqlRequest{ + Session: a.session, + Sql: sql, + QueryMode: spannerpb.ExecuteSqlRequest_PLAN, + } + if isDML(sql) { + req.Transaction = &spannerpb.TransactionSelector{Selector: &spannerpb.TransactionSelector_Begin{ + Begin: &spannerpb.TransactionOptions{Mode: &spannerpb.TransactionOptions_ReadWrite_{ReadWrite: &spannerpb.TransactionOptions_ReadWrite{}}}, + }} + req.Seqno = 1 + } + rs, err := a.s.data.ExecuteSql(ctx, req) + if err != nil { + return nil, err + } + if rs.Metadata != nil && rs.Metadata.Transaction != nil && len(rs.Metadata.Transaction.Id) > 0 { + a.s.data.Rollback(context.WithoutCancel(ctx), &spannerpb.RollbackRequest{Session: a.session, TransactionId: rs.Metadata.Transaction.Id}) + } + return rs, nil +} + +// analyzeQuery compiles one query. +func (a *analyzer) analyzeQuery(ctx context.Context, q endtoend.Query) (analysis.Query, error) { + sql, phs := bind(q.SQL) + aq := analysis.Query{ + Name: q.Name, + Cmd: q.Cmd, + Columns: []analysis.Column{}, + Params: []analysis.Param{}, + } + rs, err := a.compile(ctx, sql) + if err != nil { + return analysis.Query{}, err + } + p := newPlan(rs.Stats.GetQueryPlan()) + partners := p.partners() + describe := func(o origin) (analysis.Column, bool) { + if o.param != "" { + o = partners[o.param] + } + if o.table == "" { + return analysis.Column{}, false + } + col, ok := a.lookup(o.table, o.column) + if !ok { + return analysis.Column{}, false + } + return analysis.Column{Name: col.name, Type: withNullable(col.typ, col.nullable), Table: a.tableName(o.table)}, true + } + + var fields []*spannerpb.StructType_Field + if rs.Metadata != nil && rs.Metadata.RowType != nil { + fields = rs.Metadata.RowType.Fields + } + outputs := p.outputs() + table, operation := p.mutation() + if table != "" { + // A DML plan lists the columns it returns, then the values it + // writes: each of those is a parameter standing for the column + // it is written to. + written := a.written(sql, table, operation) + writes := outputs[min(len(fields), len(outputs)):] + for i, w := range written { + if i >= len(writes) { + break + } + if o := p.resolve(writes[i], map[int32]bool{}); o.param != "" { + if _, ok := partners[o.param]; !ok { + partners[o.param] = origin{table: table, column: w} + } + } + } + outputs = outputs[:min(len(fields), len(outputs))] + } + for i, f := range fields { + ac := analysis.Column{Name: f.Name, Type: typeOf(f.Type)} + var out *spannerpb.PlanNode + if i < len(outputs) { + out = outputs[i] + } + if col, ok := describe(p.resolve(out, map[int32]bool{})); ok { + ac.Type, ac.Table = col.Type, col.Table + } else if table != "" && (out == nil || out.DisplayName != "Function") { + // A THEN RETURN column the plan reads as a constant, such + // as the default a column not inserted takes, is the table's + // column of that name. + if col, ok := a.lookup(table, f.Name); ok { + ac.Type = withNullable(col.typ, col.nullable) + ac.Table = a.tableName(table) + } + } + aq.Columns = append(aq.Columns, ac) + } + + declared := map[string]*spannerpb.Type{} + if rs.Metadata != nil && rs.Metadata.UndeclaredParameters != nil { + for _, f := range rs.Metadata.UndeclaredParameters.Fields { + declared[f.Name] = f.Type + } + } + for _, ph := range phs { + ac, ok := describe(origin{param: ph.Name}) + if !ok { + ac = analysis.Column{Type: typeOf(declared[ph.Name])} + } + aq.Params = append(aq.Params, analysis.Param{Number: ph.Number, Column: ac}) + } + return aq, nil +} + +var ( + insertRe = regexp.MustCompile("(?is)^insert\\s+(?:or\\s+\\w+\\s+)?into\\s+[\\w.`]+\\s*(?:\\(([^)]*)\\))?") + setRe = regexp.MustCompile("(?is)^update\\s+[\\w.`]+(?:\\s+(?:as\\s+)?\\w+)?\\s+set\\s+") +) + +// written lists the columns a DML statement writes, in the order the plan +// lists their values: for an INSERT the columns it inserts, which are the +// statement's column list or every column of the table, and for an +// UPDATE or DELETE the table's key columns, then the columns an UPDATE +// sets. +func (a *analyzer) written(sql, table, operation string) []string { + switch operation { + case "INSERT": + m := insertRe.FindStringSubmatch(sql) + if m == nil { + return nil + } + if strings.TrimSpace(m[1]) == "" { + var cols []string + for _, col := range a.catalog[a.tableName(table)] { + cols = append(cols, col.name) + } + return cols + } + var cols []string + for _, c := range strings.Split(m[1], ",") { + cols = append(cols, strings.Trim(strings.TrimSpace(c), "`")) + } + return cols + case "UPDATE": + cols := append([]string(nil), a.keys[a.tableName(table)]...) + if m := setRe.FindStringIndex(sql); m != nil { + for _, assignment := range setList(sql[m[1]:]) { + target, _, _ := strings.Cut(assignment, "=") + target = strings.TrimSpace(target) + if i := strings.LastIndexByte(target, '.'); i >= 0 { + target = target[i+1:] + } + cols = append(cols, strings.Trim(target, "`")) + } + } + return cols + case "DELETE": + return a.keys[a.tableName(table)] + } + return nil +} + +// setList splits an UPDATE's SET list into its assignments: the text up +// to the WHERE outside strings and parentheses, split on the commas +// outside them. +func setList(s string) []string { + var out []string + depth, start := 0, 0 + for i := 0; i < len(s); i++ { + c := s[i] + switch { + case c == '\'' || c == '"' || c == '`': + i = skipQuoted(s, i) - 1 + case c == '(': + depth++ + case c == ')': + depth-- + case c == ',' && depth == 0: + out = append(out, s[start:i]) + start = i + 1 + case depth == 0 && (i == 0 || !isWordByte(s[i-1])) && len(s)-i >= 5 && strings.EqualFold(s[i:i+5], "where") && (len(s) == i+5 || !isWordByte(s[i+5])): + return append(out, s[start:i]) + } + } + return append(out, s[start:]) +} diff --git a/internal/goldeneye/spanner/plan.go b/internal/goldeneye/spanner/plan.go new file mode 100644 index 0000000000..c0d91d0bc8 --- /dev/null +++ b/internal/goldeneye/spanner/plan.go @@ -0,0 +1,220 @@ +package spanner + +import ( + "regexp" + "strings" + + "cloud.google.com/go/spanner/apiv1/spannerpb" +) + +// The query plan is the one thing that says where a result column comes +// from and what a parameter stands for. It is a list of nodes: relational +// ones, such as a Scan of a table or the Serialize Result that produces the +// rows, and scalar ones, such as a Reference to a column or a variable, a +// Parameter, a Function. A relational node defines variables through its +// child links: a Scan of a table defines one per column it reads, named +// after the column, and any node may define one as another scalar, which +// a Reference names with a $. The children of Serialize Result after the +// relation it serializes are the result columns, in order; a DML plan +// lists its THEN RETURN columns first and the values it writes after +// them: for an INSERT the columns it inserts, in the statement's order, +// and for an UPDATE or DELETE the key columns of the table, then the +// columns an UPDATE sets. A comparison is a Function whose description +// reads ($col = @param). + +// origin is what a scalar of the plan resolves to: a table column, a +// parameter, or nothing. +type origin struct { + table, column string + param string +} + +// plan is a parsed query plan. +type plan struct { + nodes []*spannerpb.PlanNode + // vars maps a variable to the node that defines it and the scalar it + // is defined as. + vars map[string]definition +} + +type definition struct { + owner *spannerpb.PlanNode + child *spannerpb.PlanNode +} + +func newPlan(qp *spannerpb.QueryPlan) *plan { + p := &plan{vars: map[string]definition{}} + if qp == nil { + return p + } + p.nodes = qp.PlanNodes + for _, n := range p.nodes { + for _, l := range n.ChildLinks { + if l.Variable != "" { + p.vars[l.Variable] = definition{owner: n, child: p.node(l.ChildIndex)} + } + } + } + return p +} + +func (p *plan) node(index int32) *spannerpb.PlanNode { + for _, n := range p.nodes { + if n.Index == index { + return n + } + } + return nil +} + +func (p *plan) root() *spannerpb.PlanNode { + return p.node(0) +} + +func meta(n *spannerpb.PlanNode, key string) string { + if n == nil || n.Metadata == nil { + return "" + } + if v, ok := n.Metadata.Fields[key]; ok { + return v.GetStringValue() + } + return "" +} + +func description(n *spannerpb.PlanNode) string { + if n == nil || n.ShortRepresentation == nil { + return "" + } + return n.ShortRepresentation.Description +} + +// serializeResult finds the node that produces the rows, the first +// Serialize Result reached from the root. +func (p *plan) serializeResult() *spannerpb.PlanNode { + var found *spannerpb.PlanNode + seen := map[int32]bool{} + var walk func(n *spannerpb.PlanNode) + walk = func(n *spannerpb.PlanNode) { + if n == nil || found != nil || seen[n.Index] { + return + } + seen[n.Index] = true + if n.DisplayName == "Serialize Result" { + found = n + return + } + for _, l := range n.ChildLinks { + walk(p.node(l.ChildIndex)) + } + } + walk(p.root()) + return found +} + +// outputs lists the scalars Serialize Result produces, in order: every +// child after the relation it serializes. +func (p *plan) outputs() []*spannerpb.PlanNode { + sr := p.serializeResult() + if sr == nil { + return nil + } + var out []*spannerpb.PlanNode + for _, l := range sr.ChildLinks { + if c := p.node(l.ChildIndex); c != nil && c.Kind == spannerpb.PlanNode_SCALAR { + out = append(out, c) + } + } + return out +} + +// mutation names the table a DML plan writes, or "" for a query. +func (p *plan) mutation() (table, operation string) { + for _, n := range p.nodes { + if n.DisplayName == "Apply Mutations" { + return meta(n, "table"), meta(n, "operation_type") + } + } + return "", "" +} + +// resolve follows a scalar to what it stands for. +func (p *plan) resolve(n *spannerpb.PlanNode, seen map[int32]bool) origin { + if n == nil || seen[n.Index] { + return origin{} + } + seen[n.Index] = true + switch n.DisplayName { + case "Parameter": + return origin{param: meta(n, "name")} + case "Reference": + desc := description(n) + if name, ok := strings.CutPrefix(desc, "$"); ok { + return p.resolveVar(name, seen) + } + // A bare name is a column of the scan it is read by, or an input + // of a union, which names it in the link's type. + for _, m := range p.nodes { + for _, l := range m.ChildLinks { + if l.ChildIndex != n.Index { + continue + } + switch { + case m.DisplayName == "Scan" && meta(m, "scan_type") == "TableScan": + return origin{table: meta(m, "scan_target"), column: desc} + case m.DisplayName == "Scan": + // A batch scan reads the batch variable of that name. + target := strings.TrimPrefix(meta(m, "scan_target"), "$") + return p.resolveVar(target+".Batch."+desc, seen) + } + } + } + for _, m := range p.nodes { + if m.DisplayName != "Union Input" { + continue + } + for _, l := range m.ChildLinks { + if l.Type == desc { + return p.resolve(p.node(l.ChildIndex), seen) + } + } + } + } + return origin{} +} + +// resolveVar follows a variable to what it is defined as. +func (p *plan) resolveVar(name string, seen map[int32]bool) origin { + d, ok := p.vars[name] + if !ok { + return origin{} + } + return p.resolve(d.child, seen) +} + +var compareRe = regexp.MustCompile(`^\((.+) (=|!=|<>|<|<=|>|>=) (.+)\)$`) + +// partners finds the table column each parameter is compared with, keyed +// by parameter name: the other operand of a comparison Function the +// parameter is an operand of. The first found wins. +func (p *plan) partners() map[string]origin { + out := map[string]origin{} + for _, n := range p.nodes { + if n.DisplayName != "Function" || len(n.ChildLinks) != 2 || !compareRe.MatchString(description(n)) { + continue + } + sides := []*spannerpb.PlanNode{p.node(n.ChildLinks[0].ChildIndex), p.node(n.ChildLinks[1].ChildIndex)} + for i, side := range sides { + o := p.resolve(side, map[int32]bool{}) + if o.param == "" { + continue + } + other := p.resolve(sides[1-i], map[int32]bool{}) + if other.table != "" { + if _, ok := out[o.param]; !ok { + out[o.param] = other + } + } + } + } + return out +} diff --git a/internal/goldeneye/spanner/relations.go b/internal/goldeneye/spanner/relations.go new file mode 100644 index 0000000000..4899e8ba4f --- /dev/null +++ b/internal/goldeneye/spanner/relations.go @@ -0,0 +1,96 @@ +package spanner + +import ( + "context" + "fmt" + "strings" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// relationQuery lists the relations of every schema but the database's +// own, unnamed one — INFORMATION_SCHEMA and SPANNER_SYS — with their +// columns in declared order, so that the output is stable. A column's +// type is spelled the way SPANNER_TYPE spells a declaration: STRING(MAX), +// ARRAY. +const relationQuery = ` +SELECT t.TABLE_SCHEMA, t.TABLE_NAME, t.TABLE_TYPE, + c.COLUMN_NAME, c.SPANNER_TYPE, c.IS_NULLABLE +FROM INFORMATION_SCHEMA.TABLES AS t +JOIN INFORMATION_SCHEMA.COLUMNS AS c + ON c.TABLE_SCHEMA = t.TABLE_SCHEMA AND c.TABLE_NAME = t.TABLE_NAME +WHERE t.TABLE_SCHEMA != '' +ORDER BY t.TABLE_SCHEMA, t.TABLE_NAME, c.ORDINAL_POSITION` + +// readRelations reads the views of the system schemas. Their names are +// kept as the catalog spells them, in upper case, which is how a query +// names them; a column's type is spelled in lower case, the way the +// dialect's types.jsonl spells its types, with an ARRAY written as T +// with the array flag, since that is how a seed spells an array. +func readRelations(ctx context.Context, s *server, session string) ([]dialect.Relation, error) { + rows, err := s.query(ctx, session, relationQuery) + if err != nil { + return nil, err + } + var relations []dialect.Relation + var cur *dialect.Relation + for _, row := range rows { + if len(row) != 6 { + return nil, fmt.Errorf("expected 6 columns, got %d", len(row)) + } + schema, name, kind := row[0].GetStringValue(), row[1].GetStringValue(), row[2].GetStringValue() + if cur == nil || cur.Schema != schema || cur.Name != name { + rel := dialect.Relation{Schema: schema, Name: name} + if kind == "VIEW" { + rel.Kind = "v" + } + relations = append(relations, rel) + cur = &relations[len(relations)-1] + } + col := dialect.Column{ + Name: row[3].GetStringValue(), + NotNull: row[5].GetStringValue() == "NO", + } + col.Type, col.Array = typeName(row[4].GetStringValue()) + cur.Columns = append(cur.Columns, col) + } + return relations, nil +} + +// typeName spells a SPANNER_TYPE the way a seed spells a column's type: +// in lower case, with an ARRAY as its element and the array flag, a +// STRUCT as struct(a: t, b: u) and a PROTO or ENUM as +// proto('p.M') or enum('p.E'), since a seed spells a type's arguments in +// parentheses. +func typeName(spannerType string) (string, bool) { + t := strings.TrimSpace(spannerType) + if element, ok := strings.CutPrefix(t, "ARRAY<"); ok && strings.HasSuffix(element, ">") { + name, _ := typeName(strings.TrimSuffix(element, ">")) + return name, true + } + if fields, ok := strings.CutPrefix(t, "STRUCT<"); ok && strings.HasSuffix(fields, ">") { + var args []string + for _, f := range splitTop(strings.TrimSuffix(fields, ">"), ',') { + f = strings.TrimSpace(f) + label, typ := "", f + if i := strings.IndexAny(f, " \t"); i > 0 && !strings.ContainsAny(f[:i], "<(") { + label, typ = f[:i], strings.TrimSpace(f[i+1:]) + } + name, array := typeName(typ) + if array { + name += "[]" + } + if label != "" { + name = label + ": " + name + } + args = append(args, name) + } + return "struct(" + strings.Join(args, ", ") + ")", false + } + for _, kind := range []string{"PROTO<", "ENUM<"} { + if message, ok := strings.CutPrefix(t, kind); ok && strings.HasSuffix(message, ">") { + return strings.ToLower(strings.TrimSuffix(kind, "<")) + "('" + strings.TrimSuffix(message, ">") + "')", false + } + } + return strings.ToLower(t), false +} diff --git a/internal/goldeneye/spanner/spanner.go b/internal/goldeneye/spanner/spanner.go new file mode 100644 index 0000000000..90d82a13fe --- /dev/null +++ b/internal/goldeneye/spanner/spanner.go @@ -0,0 +1,224 @@ +// Package spanner generates the GoogleSQL dialect seed under +// internal/engine/googlesql/dialect from a live Spanner server, and +// verifies the GoogleSQL analyze cases under internal/endtoend/testdata +// against the same server. The server is Spanner Omni, the downloadable +// Spanner, run from its container image; the package writes into the +// googlesql directory, since sqlc's engine is named after the language +// Spanner speaks rather than the database. +// +// Spanner keeps no catalog of its types, functions or operators, so +// types.jsonl, functions.jsonl and operators.jsonl are written by hand and +// are not this package's business. What it does describe is its +// information schema: relations.jsonl is every view of INFORMATION_SCHEMA +// and SPANNER_SYS, read from INFORMATION_SCHEMA itself. +// +// The package also verifies the GoogleSQL analyze cases against the same +// server: each case's schema becomes a database of its own, its fixture is +// written there, and each query is compiled in PLAN mode, which runs +// nothing and reports the type of each result column and of each +// parameter the query leaves undeclared, and the query plan, which says +// which table column each result column and parameter stands for. The +// answer is printed in the JSON shape sqlc analyze prints and compared +// with the case's committed stdout.json byte for byte. +// +// The server is named by SPANNER_SERVER_URI, the gRPC endpoint of a +// Spanner Omni server such as localhost:15000, which is reached without +// TLS or credentials, as Omni is. Databases are created in the instance +// Omni's single server provides, projects/default/instances/default. +package spanner + +import ( + "context" + "errors" + "fmt" + "os" + "strings" + + database "cloud.google.com/go/spanner/admin/database/apiv1" + "cloud.google.com/go/spanner/admin/database/apiv1/databasepb" + instance "cloud.google.com/go/spanner/admin/instance/apiv1" + "cloud.google.com/go/spanner/admin/instance/apiv1/instancepb" + spannerapi "cloud.google.com/go/spanner/apiv1" + "cloud.google.com/go/spanner/apiv1/spannerpb" + "google.golang.org/api/option" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/structpb" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" +) + +// Engine is the name goldeneye knows the database by. +const Engine = "spanner" + +// Dir is the name of the engine directory the dialect lives under, and +// Cases the name of the analyze case directories under +// internal/endtoend/testdata: both are named after the language, GoogleSQL, +// which is how sqlc knows the dialect. +const ( + Dir = "googlesql" + Cases = "googlesql" +) + +// Instance is the instance a Spanner Omni single server provides, which +// every database is created in. +const Instance = "projects/default/instances/default" + +// Locate returns the server to generate from, named by SPANNER_SERVER_URI. +func Locate() (string, error) { + endpoint := os.Getenv("SPANNER_SERVER_URI") + if endpoint == "" { + return "", errors.New("SPANNER_SERVER_URI is not set") + } + if strings.Contains(endpoint, "://") { + return "", fmt.Errorf("SPANNER_SERVER_URI: %q should be a host:port, the gRPC endpoint of a Spanner Omni server", endpoint) + } + return endpoint, nil +} + +// server holds the clients a run talks to the server through. +type server struct { + endpoint string + instances *instance.InstanceAdminClient + databases *database.DatabaseAdminClient + data *spannerapi.Client +} + +// open connects to the server. Omni serves plaintext gRPC and asks for no +// credentials. +func open(ctx context.Context, endpoint string) (*server, error) { + opts := []option.ClientOption{ + option.WithEndpoint(endpoint), + option.WithoutAuthentication(), + option.WithGRPCDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())), + } + s := &server{endpoint: endpoint} + var err error + if s.instances, err = instance.NewInstanceAdminClient(ctx, opts...); err != nil { + return nil, err + } + if s.databases, err = database.NewDatabaseAdminClient(ctx, opts...); err != nil { + s.Close() + return nil, err + } + if s.data, err = spannerapi.NewClient(ctx, opts...); err != nil { + s.Close() + return nil, err + } + return s, nil +} + +func (s *server) Close() { + if s.instances != nil { + s.instances.Close() + } + if s.databases != nil { + s.databases.Close() + } + if s.data != nil { + s.data.Close() + } +} + +// Version describes the server: Spanner Omni reports no release of its +// own through the API, so the instance the databases are created in is +// described instead. +func Version(ctx context.Context, endpoint string) (string, error) { + s, err := open(ctx, endpoint) + if err != nil { + return "", err + } + defer s.Close() + inst, err := s.instances.GetInstance(ctx, &instancepb.GetInstanceRequest{Name: Instance}) + if err != nil { + return "", fmt.Errorf("%s: %w", Instance, err) + } + return fmt.Sprintf("Spanner Omni at %s, instance %s (%s)", endpoint, inst.Name, inst.State), nil +} + +// createDatabase creates a database in the instance, running the DDL +// statements in it, and returns its full name. +func (s *server) createDatabase(ctx context.Context, name string, ddl []string) (string, error) { + op, err := s.databases.CreateDatabase(ctx, &databasepb.CreateDatabaseRequest{ + Parent: Instance, + CreateStatement: "CREATE DATABASE `" + name + "`", + ExtraStatements: ddl, + }) + if err != nil { + return "", err + } + db, err := op.Wait(ctx) + if err != nil { + return "", err + } + return db.Name, nil +} + +// dropDatabase drops a database by its full name. A database that does +// not exist is not an error, so that a run can clear the way for itself. +func (s *server) dropDatabase(ctx context.Context, db string) error { + err := s.databases.DropDatabase(ctx, &databasepb.DropDatabaseRequest{Database: db}) + if status.Code(err) == codes.NotFound && strings.Contains(err.Error(), "Database") { + return nil + } + return err +} + +// session opens a session on a database, multiplexed as Omni requires. +func (s *server) session(ctx context.Context, db string) (string, error) { + sess, err := s.data.CreateSession(ctx, &spannerpb.CreateSessionRequest{ + Database: db, + Session: &spannerpb.Session{Multiplexed: true}, + }) + if err != nil { + return "", err + } + return sess.Name, nil +} + +// query runs a statement and returns its rows as lists of values. +func (s *server) query(ctx context.Context, session, sql string) ([][]*structpb.Value, error) { + rs, err := s.data.ExecuteSql(ctx, &spannerpb.ExecuteSqlRequest{Session: session, Sql: sql}) + if err != nil { + return nil, err + } + var rows [][]*structpb.Value + for _, row := range rs.Rows { + rows = append(rows, row.Values) + } + return rows, nil +} + +// Generate reads the dialect from the server: relations.jsonl, the views of +// INFORMATION_SCHEMA and SPANNER_SYS, read from a database of their own, +// since every database has the same ones. +func Generate(ctx context.Context, endpoint string) (dialect.Files, error) { + s, err := open(ctx, endpoint) + if err != nil { + return nil, err + } + defer s.Close() + db := Instance + "/databases/goldeneye_dialect" + if err := s.dropDatabase(ctx, db); err != nil { + return nil, err + } + if _, err := s.createDatabase(ctx, "goldeneye_dialect", nil); err != nil { + return nil, err + } + defer s.dropDatabase(context.WithoutCancel(ctx), db) + session, err := s.session(ctx, db) + if err != nil { + return nil, err + } + relations, err := readRelations(ctx, s, session) + if err != nil { + return nil, err + } + blob, err := dialect.JSONL(relations) + if err != nil { + return nil, err + } + return dialect.Files{dialect.RelationsFile: blob}, nil +} diff --git a/internal/goldeneye/spanner/spanner_test.go b/internal/goldeneye/spanner/spanner_test.go new file mode 100644 index 0000000000..3b5bf48ff6 --- /dev/null +++ b/internal/goldeneye/spanner/spanner_test.go @@ -0,0 +1,66 @@ +package spanner + +import ( + "context" + "testing" + + "github.com/sqlc-dev/sqlc/internal/goldeneye/dialect" + "github.com/sqlc-dev/sqlc/internal/goldeneye/endtoend" +) + +// TestDialect verifies the committed GoogleSQL dialect against what a +// Spanner server reports. It skips unless SPANNER_SERVER_URI names one. +func TestDialect(t *testing.T) { + endpoint, err := Locate() + if err != nil { + t.Skip(err) + } + ctx := context.Background() + version, err := Version(ctx, endpoint) + if err != nil { + t.Fatal(err) + } + files, err := Generate(ctx, endpoint) + if err != nil { + t.Fatal(err) + } + dir, err := dialect.Dir(Dir) + if err != nil { + t.Fatal(err) + } + report, err := dialect.Check(dir, files) + if err != nil { + t.Fatal(err) + } + if report != "" { + t.Errorf("%s does not match what %s reports:\n%s", dir, version, report) + } +} + +// TestAnalyzeCases verifies every GoogleSQL analyze case under +// internal/endtoend/testdata against what a Spanner server reports. It +// skips unless SPANNER_SERVER_URI names one. +func TestAnalyzeCases(t *testing.T) { + endpoint, err := Locate() + if err != nil { + t.Skip(err) + } + cases, err := endtoend.Cases(Cases) + if err != nil { + t.Fatal(err) + } + if len(cases) == 0 { + t.Fatal("no googlesql analyze cases found") + } + for _, c := range cases { + t.Run(c.Name, func(t *testing.T) { + diff, err := Check(context.Background(), endpoint, c) + if err != nil { + t.Fatal(err) + } + if diff != "" { + t.Errorf("%s does not match what Spanner reports (-committed +spanner):\n%s", c.Output, diff) + } + }) + } +}