@intentius/chant-lexicon-sql 0.124.46 → 0.124.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/change-set.d.ts +1 -1
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +2 -1
- package/dist/clickhouse/apply/statements.d.ts +9 -0
- package/dist/clickhouse/apply/statements.d.ts.map +1 -1
- package/dist/clickhouse/apply/statements.js +24 -0
- package/dist/clickhouse/import/live-export.d.ts +7 -3
- package/dist/clickhouse/import/live-export.d.ts.map +1 -1
- package/dist/clickhouse/import/live-export.js +21 -5
- package/dist/clickhouse/live/named-collections.d.ts +27 -0
- package/dist/clickhouse/live/named-collections.d.ts.map +1 -0
- package/dist/clickhouse/live/named-collections.js +53 -0
- package/dist/clickhouse/live/undeclarable.d.ts +15 -3
- package/dist/clickhouse/live/undeclarable.d.ts.map +1 -1
- package/dist/clickhouse/live/undeclarable.js +18 -4
- package/dist/clickhouse/named-collections.d.ts +83 -0
- package/dist/clickhouse/named-collections.d.ts.map +1 -0
- package/dist/clickhouse/named-collections.js +203 -0
- package/dist/clickhouse/parser.d.ts.map +1 -1
- package/dist/clickhouse/parser.js +1 -1
- package/dist/clickhouse/plan/commands.d.ts +2 -1
- package/dist/clickhouse/plan/commands.d.ts.map +1 -1
- package/dist/clickhouse/plan/commands.js +17 -2
- package/dist/clickhouse/plan/diff.d.ts +15 -0
- package/dist/clickhouse/plan/diff.d.ts.map +1 -1
- package/dist/clickhouse/plan/diff.js +43 -1
- package/dist/clickhouse/plan/disruption.d.ts.map +1 -1
- package/dist/clickhouse/plan/disruption.js +5 -0
- package/dist/clickhouse/plan/rebuild-handoff.d.ts.map +1 -1
- package/dist/clickhouse/plan/rebuild-handoff.js +4 -0
- package/dist/clickhouse/plan/report.d.ts.map +1 -1
- package/dist/clickhouse/plan/report.js +6 -1
- package/dist/clickhouse/plan/rules.d.ts +5 -1
- package/dist/clickhouse/plan/rules.d.ts.map +1 -1
- package/dist/clickhouse/plan/rules.js +7 -3
- package/dist/clickhouse/plan/statements.d.ts +29 -0
- package/dist/clickhouse/plan/statements.d.ts.map +1 -0
- package/dist/clickhouse/plan/statements.js +334 -0
- package/dist/clickhouse/plan/stream.d.ts +40 -0
- package/dist/clickhouse/plan/stream.d.ts.map +1 -0
- package/dist/clickhouse/plan/stream.js +107 -0
- package/dist/clickhouse/rebuild/observe.d.ts +3 -1
- package/dist/clickhouse/rebuild/observe.d.ts.map +1 -1
- package/dist/clickhouse/rebuild/observe.js +14 -1
- package/dist/clickhouse/review-catalog.d.ts +213 -0
- package/dist/clickhouse/review-catalog.d.ts.map +1 -0
- package/dist/clickhouse/review-catalog.js +330 -0
- package/dist/codegen/classifier-page.d.ts.map +1 -1
- package/dist/codegen/classifier-page.js +44 -4
- package/dist/codegen/clickhouse-module.d.ts.map +1 -1
- package/dist/codegen/clickhouse-module.js +3 -0
- package/dist/codegen/coverage-page.d.ts.map +1 -1
- package/dist/codegen/coverage-page.js +5 -3
- package/dist/codegen/docs.js +1 -1
- package/dist/codegen/postgres-classifier-page.js +2 -2
- package/dist/codegen/registry.d.ts.map +1 -1
- package/dist/codegen/registry.js +10 -0
- package/dist/composites/catalog.d.ts.map +1 -1
- package/dist/composites/catalog.js +100 -0
- package/dist/composites/clickhouse.d.ts +2 -0
- package/dist/composites/clickhouse.d.ts.map +1 -1
- package/dist/composites/clickhouse.js +2 -0
- package/dist/composites/otel-tables.d.ts +100 -0
- package/dist/composites/otel-tables.d.ts.map +1 -0
- package/dist/composites/otel-tables.js +282 -0
- package/dist/composites/stream-ingest.d.ts +63 -0
- package/dist/composites/stream-ingest.d.ts.map +1 -0
- package/dist/composites/stream-ingest.js +39 -0
- package/dist/core/statement-class.d.ts +55 -0
- package/dist/core/statement-class.d.ts.map +1 -0
- package/dist/core/statement-class.js +43 -0
- package/dist/coverage/clickhouse.json +1 -1
- package/dist/coverage/postgres.json +12 -12
- package/dist/coverage.d.ts +16 -6
- package/dist/coverage.d.ts.map +1 -1
- package/dist/coverage.js +10 -5
- package/dist/drizzle-command.d.ts +17 -0
- package/dist/drizzle-command.d.ts.map +1 -0
- package/dist/drizzle-command.js +91 -0
- package/dist/drizzle.d.ts +70 -0
- package/dist/drizzle.d.ts.map +1 -0
- package/dist/drizzle.js +689 -0
- package/dist/files/clickhouse.d.ts.map +1 -1
- package/dist/files/clickhouse.js +8 -1
- package/dist/files/common.d.ts +13 -0
- package/dist/files/common.d.ts.map +1 -1
- package/dist/files/common.js +5 -0
- package/dist/files/postgres.d.ts.map +1 -1
- package/dist/files/postgres.js +35 -3
- package/dist/generated/clickhouse.d.ts +2 -0
- package/dist/generated/clickhouse.d.ts.map +1 -1
- package/dist/generated/clickhouse.js +2 -0
- package/dist/import-parser.d.ts +21 -1
- package/dist/import-parser.d.ts.map +1 -1
- package/dist/import-parser.js +79 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/integrity.json +7 -6
- package/dist/lint/post-synth/audit-entries.d.ts.map +1 -1
- package/dist/lint/post-synth/audit-entries.js +1 -0
- package/dist/lint/post-synth/index.d.ts.map +1 -1
- package/dist/lint/post-synth/index.js +2 -0
- package/dist/lint/post-synth/postgres-names.d.ts.map +1 -1
- package/dist/lint/post-synth/postgres-names.js +3 -0
- package/dist/lint/post-synth/sqlch128.d.ts +18 -0
- package/dist/lint/post-synth/sqlch128.d.ts.map +1 -0
- package/dist/lint/post-synth/sqlch128.js +222 -0
- package/dist/lint/rules/postgres-templates.js +2 -2
- package/dist/lsp/postgres-template.d.ts.map +1 -1
- package/dist/lsp/postgres-template.js +21 -0
- package/dist/manifest.json +1 -1
- package/dist/mcp/postgres.js +1 -1
- package/dist/meta.json +50 -0
- package/dist/migrate/from-postgres/detect.d.ts +4 -0
- package/dist/migrate/from-postgres/detect.d.ts.map +1 -0
- package/dist/migrate/from-postgres/detect.js +7 -0
- package/dist/migrate/from-postgres/emit.d.ts +26 -0
- package/dist/migrate/from-postgres/emit.d.ts.map +1 -0
- package/dist/migrate/from-postgres/emit.js +86 -0
- package/dist/migrate/from-postgres/index.d.ts +51 -0
- package/dist/migrate/from-postgres/index.d.ts.map +1 -0
- package/dist/migrate/from-postgres/index.js +115 -0
- package/dist/migrate/from-postgres/translate.d.ts +73 -0
- package/dist/migrate/from-postgres/translate.d.ts.map +1 -0
- package/dist/migrate/from-postgres/translate.js +261 -0
- package/dist/migrate/from-postgres/types.d.ts +51 -0
- package/dist/migrate/from-postgres/types.d.ts.map +1 -0
- package/dist/migrate/from-postgres/types.js +211 -0
- package/dist/migration-classify.d.ts +23 -0
- package/dist/migration-classify.d.ts.map +1 -0
- package/dist/migration-classify.js +44 -0
- package/dist/migration-replay.d.ts +73 -0
- package/dist/migration-replay.d.ts.map +1 -0
- package/dist/migration-replay.js +294 -0
- package/dist/okf/index.md +11 -0
- package/dist/okf/rules/SQLCH128.md +11 -0
- package/dist/okf/types/PostgresForeignDataWrapper.md +9 -0
- package/dist/okf/types/PostgresForeignServer.md +9 -0
- package/dist/okf/types/PostgresForeignTable.md +9 -0
- package/dist/okf/types/PostgresOperator.md +9 -0
- package/dist/okf/types/PostgresOperatorClass.md +9 -0
- package/dist/okf/types/PostgresOperatorFamily.md +9 -0
- package/dist/okf/types/PostgresPublication.md +9 -0
- package/dist/okf/types/PostgresStatistics.md +9 -0
- package/dist/okf/types/PostgresTextSearchConfiguration.md +9 -0
- package/dist/okf/types/PostgresTextSearchDictionary.md +9 -0
- package/dist/op/activities/postgres-migration.d.ts.map +1 -1
- package/dist/op/activities/postgres-migration.js +4 -0
- package/dist/op/activity-contracts.d.ts +20 -0
- package/dist/op/activity-contracts.d.ts.map +1 -1
- package/dist/op/activity-contracts.js +2 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +49 -2
- package/dist/postgres/access/acl.js +1 -1
- package/dist/postgres/access/import.js +1 -1
- package/dist/postgres/apply/apply.js +13 -1
- package/dist/postgres/apply/statements.d.ts.map +1 -1
- package/dist/postgres/apply/statements.js +243 -4
- package/dist/postgres/constraint-names.d.ts +30 -0
- package/dist/postgres/constraint-names.d.ts.map +1 -0
- package/dist/postgres/constraint-names.js +72 -0
- package/dist/postgres/entities.d.ts +229 -2
- package/dist/postgres/entities.d.ts.map +1 -1
- package/dist/postgres/entities.js +326 -5
- package/dist/postgres/entity-types.d.ts +10 -0
- package/dist/postgres/entity-types.d.ts.map +1 -1
- package/dist/postgres/entity-types.js +10 -0
- package/dist/postgres/import/generator.d.ts.map +1 -1
- package/dist/postgres/import/generator.js +65 -2
- package/dist/postgres/import/live-export.d.ts.map +1 -1
- package/dist/postgres/import/live-export.js +2 -0
- package/dist/postgres/live/catalog-kinds.d.ts +20 -0
- package/dist/postgres/live/catalog-kinds.d.ts.map +1 -1
- package/dist/postgres/live/catalog-kinds.js +452 -0
- package/dist/postgres/live/catalog.d.ts +2 -0
- package/dist/postgres/live/catalog.d.ts.map +1 -1
- package/dist/postgres/live/catalog.js +3 -1
- package/dist/postgres/live/describe-resources.d.ts.map +1 -1
- package/dist/postgres/live/describe-resources.js +12 -2
- package/dist/postgres/migrate/backfill.d.ts +2 -0
- package/dist/postgres/migrate/backfill.d.ts.map +1 -1
- package/dist/postgres/migrate/backfill.js +7 -1
- package/dist/postgres/migrate/carry.d.ts +45 -1
- package/dist/postgres/migrate/carry.d.ts.map +1 -1
- package/dist/postgres/migrate/carry.js +72 -8
- package/dist/postgres/migrate/observe.d.ts +28 -4
- package/dist/postgres/migrate/observe.d.ts.map +1 -1
- package/dist/postgres/migrate/observe.js +45 -13
- package/dist/postgres/migrate/op.d.ts +26 -1
- package/dist/postgres/migrate/op.d.ts.map +1 -1
- package/dist/postgres/migrate/op.js +3 -1
- package/dist/postgres/migrate/replication.d.ts +42 -0
- package/dist/postgres/migrate/replication.d.ts.map +1 -1
- package/dist/postgres/migrate/replication.js +53 -0
- package/dist/postgres/migrate/steps.d.ts +35 -2
- package/dist/postgres/migrate/steps.d.ts.map +1 -1
- package/dist/postgres/migrate/steps.js +158 -12
- package/dist/postgres/parser.d.ts +144 -1
- package/dist/postgres/parser.d.ts.map +1 -1
- package/dist/postgres/parser.js +370 -4
- package/dist/postgres/plan/deep.d.ts.map +1 -1
- package/dist/postgres/plan/deep.js +43 -4
- package/dist/postgres/plan/diff.d.ts.map +1 -1
- package/dist/postgres/plan/diff.js +154 -1
- package/dist/postgres/plan/normalize.d.ts +28 -2
- package/dist/postgres/plan/normalize.d.ts.map +1 -1
- package/dist/postgres/plan/normalize.js +260 -1
- package/dist/postgres/plan/rules.d.ts +4 -0
- package/dist/postgres/plan/rules.d.ts.map +1 -1
- package/dist/postgres/plan/rules.js +6 -2
- package/dist/postgres/plan/schema.js +1 -1
- package/dist/postgres/plan/statements.d.ts +26 -0
- package/dist/postgres/plan/statements.d.ts.map +1 -0
- package/dist/postgres/plan/statements.js +364 -0
- package/dist/postgres/secret-options.d.ts +10 -0
- package/dist/postgres/secret-options.d.ts.map +1 -0
- package/dist/postgres/secret-options.js +9 -0
- package/dist/postgres/testing/roundtrip-schema.d.ts +4 -2
- package/dist/postgres/testing/roundtrip-schema.d.ts.map +1 -1
- package/dist/postgres/testing/roundtrip-schema.js +24 -1
- package/dist/postgres.d.ts +1 -1
- package/dist/postgres.d.ts.map +1 -1
- package/dist/postgres.js +1 -1
- package/dist/rules/audit-entries.ts +1 -0
- package/dist/rules/postgres-names.ts +2 -0
- package/dist/rules/postgres-templates.ts +2 -2
- package/dist/rules/sqlch128.ts +230 -0
- package/dist/serializer.d.ts +5 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +13 -2
- package/dist/sql-types-command.d.ts +13 -0
- package/dist/sql-types-command.d.ts.map +1 -1
- package/dist/sql-types-command.js +31 -16
- package/dist/sql-types.d.ts +22 -0
- package/dist/sql-types.d.ts.map +1 -1
- package/dist/sql-types.js +10 -6
- package/dist/sqlserver/lexer.d.ts +37 -0
- package/dist/sqlserver/lexer.d.ts.map +1 -0
- package/dist/sqlserver/lexer.js +254 -0
- package/dist/sqlserver/parse.d.ts +185 -0
- package/dist/sqlserver/parse.d.ts.map +1 -0
- package/dist/sqlserver/parse.js +767 -0
- package/dist/sqlserver/translate.d.ts +34 -0
- package/dist/sqlserver/translate.d.ts.map +1 -0
- package/dist/sqlserver/translate.js +495 -0
- package/dist/sqlserver/types.d.ts +44 -0
- package/dist/sqlserver/types.d.ts.map +1 -0
- package/dist/sqlserver/types.js +133 -0
- package/dist/sqlserver/validate.d.ts +31 -0
- package/dist/sqlserver/validate.d.ts.map +1 -0
- package/dist/sqlserver/validate.js +67 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +10 -0
- package/package.json +2 -2
- package/src/change-set.ts +2 -1
- package/src/clickhouse/apply/statements.ts +25 -0
- package/src/clickhouse/import/live-export.ts +20 -5
- package/src/clickhouse/live/named-collections.e2e.test.ts +88 -0
- package/src/clickhouse/live/named-collections.ts +61 -0
- package/src/clickhouse/live/undeclarable.e2e.test.ts +5 -3
- package/src/clickhouse/live/undeclarable.ts +20 -4
- package/src/clickhouse/named-collections.test.ts +187 -0
- package/src/clickhouse/named-collections.ts +224 -0
- package/src/clickhouse/parser.ts +2 -1
- package/src/clickhouse/plan/commands.ts +17 -2
- package/src/clickhouse/plan/diff.ts +57 -1
- package/src/clickhouse/plan/disruption.ts +5 -0
- package/src/clickhouse/plan/rebuild-handoff.ts +3 -0
- package/src/clickhouse/plan/report.ts +6 -1
- package/src/clickhouse/plan/rules.ts +14 -4
- package/src/clickhouse/plan/statements.test.ts +61 -0
- package/src/clickhouse/plan/statements.ts +306 -0
- package/src/clickhouse/plan/stream-s3queue.e2e.test.ts +148 -0
- package/src/clickhouse/plan/stream.test.ts +237 -0
- package/src/clickhouse/plan/stream.ts +111 -0
- package/src/clickhouse/rebuild/observe.ts +15 -1
- package/src/clickhouse/review-catalog.test.ts +181 -0
- package/src/clickhouse/review-catalog.ts +489 -0
- package/src/codegen/classifier-page.ts +44 -4
- package/src/codegen/clickhouse-module.ts +3 -0
- package/src/codegen/coverage-page.ts +5 -3
- package/src/codegen/docs.ts +1 -1
- package/src/codegen/postgres-classifier-page.ts +2 -2
- package/src/codegen/registry.ts +10 -0
- package/src/composites/catalog.test.ts +6 -1
- package/src/composites/catalog.ts +100 -0
- package/src/composites/clickhouse.ts +2 -0
- package/src/composites/composites.test.ts +1 -1
- package/src/composites/otel-tables.test.ts +118 -0
- package/src/composites/otel-tables.ts +339 -0
- package/src/composites/stream-ingest.test.ts +114 -0
- package/src/composites/stream-ingest.ts +82 -0
- package/src/core/statement-class.ts +88 -0
- package/src/core/undeclarable.test.ts +6 -5
- package/src/coverage/clickhouse.json +1 -1
- package/src/coverage/postgres.json +12 -12
- package/src/coverage.test.ts +27 -2
- package/src/coverage.ts +18 -7
- package/src/drizzle-command.ts +94 -0
- package/src/drizzle-kit.e2e.test.ts +89 -0
- package/src/drizzle-types.e2e.test.ts +67 -0
- package/src/drizzle.test.ts +358 -0
- package/src/drizzle.ts +742 -0
- package/src/files/clickhouse.ts +8 -1
- package/src/files/common.ts +14 -1
- package/src/files/postgres.ts +34 -3
- package/src/generated/clickhouse.ts +3 -0
- package/src/generated/lexicon-sql.json +50 -0
- package/src/import-parser.sqlserver.test.ts +92 -0
- package/src/import-parser.ts +79 -5
- package/src/index.ts +1 -1
- package/src/lint/post-synth/audit-entries.ts +1 -0
- package/src/lint/post-synth/index.ts +2 -0
- package/src/lint/post-synth/postgres-checks.test.ts +8 -1
- package/src/lint/post-synth/postgres-names.ts +2 -0
- package/src/lint/post-synth/sqlch128.test.ts +107 -0
- package/src/lint/post-synth/sqlch128.ts +230 -0
- package/src/lint/rules/postgres-templates.ts +2 -2
- package/src/lsp/postgres-template.ts +20 -0
- package/src/mcp/postgres.ts +1 -1
- package/src/migrate/from-postgres/cli.test.ts +165 -0
- package/src/migrate/from-postgres/detect.ts +7 -0
- package/src/migrate/from-postgres/emit.ts +96 -0
- package/src/migrate/from-postgres/example.test.ts +205 -0
- package/src/migrate/from-postgres/index.ts +122 -0
- package/src/migrate/from-postgres/translate.test.ts +242 -0
- package/src/migrate/from-postgres/translate.ts +359 -0
- package/src/migrate/from-postgres/types.test.ts +116 -0
- package/src/migrate/from-postgres/types.ts +236 -0
- package/src/migrate/from-postgres/validate.e2e.test.ts +44 -0
- package/src/migrate/from-postgres/workspace.e2e.test.ts +114 -0
- package/src/migration-classify.test.ts +150 -0
- package/src/migration-classify.ts +45 -0
- package/src/migration-replay.e2e.test.ts +155 -0
- package/src/migration-replay.test.ts +173 -0
- package/src/migration-replay.ts +289 -0
- package/src/op/__snapshots__/watch-pipeline.test.ts.snap +2 -2
- package/src/op/activities/postgres-migration.ts +4 -0
- package/src/op/activity-contracts.ts +2 -0
- package/src/op/watch-pipeline.test.ts +8 -1
- package/src/plugin.ts +51 -2
- package/src/postgres/access/acl.ts +1 -1
- package/src/postgres/access/import.ts +1 -1
- package/src/postgres/apply/apply.ts +14 -1
- package/src/postgres/apply/statements.ts +225 -4
- package/src/postgres/constraint-names.ts +71 -0
- package/src/postgres/database-kinds.test.ts +865 -0
- package/src/postgres/entities.ts +541 -5
- package/src/postgres/entity-types.ts +10 -0
- package/src/postgres/import/generator.ts +54 -2
- package/src/postgres/import/live-export.ts +1 -0
- package/src/postgres/live/catalog-kinds.ts +494 -0
- package/src/postgres/live/catalog.ts +6 -1
- package/src/postgres/live/database-kinds.e2e.test.ts +164 -0
- package/src/postgres/live/describe-resources.ts +13 -2
- package/src/postgres/live/undeclarable.e2e.test.ts +13 -6
- package/src/postgres/migrate/backfill.ts +13 -1
- package/src/postgres/migrate/carry.ts +103 -8
- package/src/postgres/migrate/followups.e2e.test.ts +218 -0
- package/src/postgres/migrate/followups.test.ts +199 -0
- package/src/postgres/migrate/kinds.e2e.test.ts +5 -5
- package/src/postgres/migrate/observe.ts +56 -15
- package/src/postgres/migrate/op.ts +28 -1
- package/src/postgres/migrate/partition.e2e.test.ts +129 -0
- package/src/postgres/migrate/partition.test.ts +206 -0
- package/src/postgres/migrate/replication.ts +66 -0
- package/src/postgres/migrate/steps.ts +157 -12
- package/src/postgres/migrate/subscriber.e2e.test.ts +141 -0
- package/src/postgres/migrate/subscriber.test.ts +59 -0
- package/src/postgres/parser.ts +455 -4
- package/src/postgres/plan/deep.ts +42 -4
- package/src/postgres/plan/diff.ts +137 -1
- package/src/postgres/plan/normalize.ts +277 -1
- package/src/postgres/plan/rules.ts +32 -4
- package/src/postgres/plan/schema.ts +1 -1
- package/src/postgres/plan/statements.test.ts +78 -0
- package/src/postgres/plan/statements.ts +299 -0
- package/src/postgres/secret-options.ts +10 -0
- package/src/postgres/testing/roundtrip-schema.ts +24 -1
- package/src/postgres.ts +33 -0
- package/src/serializer.ts +13 -2
- package/src/skills/chant-sql-postgres-migration.md +4 -3
- package/src/skills/chant-sql-postgres.md +11 -1
- package/src/skills/chant-sql.md +2 -1
- package/src/sql-files.test.ts +33 -0
- package/src/sql-types-command.ts +38 -16
- package/src/sql-types.ts +11 -6
- package/src/sqlserver/fixture.test.ts +186 -0
- package/src/sqlserver/import-cli.test.ts +61 -0
- package/src/sqlserver/lexer.ts +260 -0
- package/src/sqlserver/parse.ts +865 -0
- package/src/sqlserver/translate.test.ts +396 -0
- package/src/sqlserver/translate.ts +558 -0
- package/src/sqlserver/types.test.ts +102 -0
- package/src/sqlserver/types.ts +154 -0
- package/src/sqlserver/validate.e2e.test.ts +32 -0
- package/src/sqlserver/validate.test.ts +49 -0
- package/src/sqlserver/validate.ts +76 -0
- package/src/validate.ts +10 -0
- package/src/workspace-kinds.test.ts +11 -0
- package/workspace-kinds.json +100 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The T-SQL to ClickHouse type map.
|
|
3
|
+
*
|
|
4
|
+
* Source types and their ranges, precisions and defaults are from Microsoft's
|
|
5
|
+
* data type reference
|
|
6
|
+
* (https://learn.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql)
|
|
7
|
+
* and the page of each type under it: `float(n)` is `real` for n in 1..24 and
|
|
8
|
+
* the 8-byte type for 25..53 with a default of 53; `decimal(p,s)` defaults to
|
|
9
|
+
* (18,0) with p up to 38; `datetime2` and `time` take a scale of 0 to 7 with
|
|
10
|
+
* a default of 7; `money` is a 64-bit integer with four decimals and
|
|
11
|
+
* `smallmoney` a 32-bit one; `rowversion` (`timestamp`) is an 8-byte counter.
|
|
12
|
+
*
|
|
13
|
+
* Target types are ClickHouse types of the pinned server (see
|
|
14
|
+
* `../spec/pin.ts`). `types.test.ts` checks every family this file writes
|
|
15
|
+
* against `TYPE_FAMILIES` in the generated catalog and every precision against
|
|
16
|
+
* the `DateTime64`, `Time64` and `Decimal` ranges, so a pin move that drops a
|
|
17
|
+
* type fails there.
|
|
18
|
+
*
|
|
19
|
+
* A type either maps with no judgment (`note` absent) or carries a `note`
|
|
20
|
+
* naming what the map could not keep. A type this file does not know
|
|
21
|
+
* (`sql_variant`, a user-defined alias type) is refused by name.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export interface MappedType {
|
|
25
|
+
ok: true;
|
|
26
|
+
/** The ClickHouse type, before `Nullable`. */
|
|
27
|
+
type: string;
|
|
28
|
+
/** The declared maximum length of a character or binary type, when it has one. */
|
|
29
|
+
maxLength?: number;
|
|
30
|
+
/** Present when the map is a judgment: what was lost or chosen. */
|
|
31
|
+
note?: { message: string; evidence: string[] };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface RefusedType {
|
|
35
|
+
ok: false;
|
|
36
|
+
reason: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type TypeMapping = MappedType | RefusedType;
|
|
40
|
+
|
|
41
|
+
type Arg = number | "max";
|
|
42
|
+
|
|
43
|
+
const num = (args: readonly Arg[], i: number): number | undefined => (typeof args[i] === "number" ? (args[i] as number) : undefined);
|
|
44
|
+
|
|
45
|
+
/** Map a column type. `name` is lower-case, `args` the parenthesised arguments. */
|
|
46
|
+
export function mapType(name: string, args: readonly Arg[]): TypeMapping {
|
|
47
|
+
switch (name) {
|
|
48
|
+
case "tinyint":
|
|
49
|
+
return { ok: true, type: "UInt8" };
|
|
50
|
+
case "smallint":
|
|
51
|
+
return { ok: true, type: "Int16" };
|
|
52
|
+
case "int":
|
|
53
|
+
case "integer":
|
|
54
|
+
return { ok: true, type: "Int32" };
|
|
55
|
+
case "bigint":
|
|
56
|
+
return { ok: true, type: "Int64" };
|
|
57
|
+
case "bit":
|
|
58
|
+
return { ok: true, type: "Bool" };
|
|
59
|
+
case "decimal":
|
|
60
|
+
case "numeric":
|
|
61
|
+
case "dec": {
|
|
62
|
+
const p = num(args, 0) ?? 18;
|
|
63
|
+
const s = num(args, 1) ?? 0;
|
|
64
|
+
return { ok: true, type: `Decimal(${String(p)}, ${String(s)})` };
|
|
65
|
+
}
|
|
66
|
+
case "money":
|
|
67
|
+
return { ok: true, type: "Decimal(19, 4)" };
|
|
68
|
+
case "smallmoney":
|
|
69
|
+
return { ok: true, type: "Decimal(10, 4)" };
|
|
70
|
+
case "real":
|
|
71
|
+
return { ok: true, type: "Float32" };
|
|
72
|
+
case "float": {
|
|
73
|
+
const n = num(args, 0) ?? 53;
|
|
74
|
+
return { ok: true, type: n <= 24 ? "Float32" : "Float64" };
|
|
75
|
+
}
|
|
76
|
+
case "date":
|
|
77
|
+
return { ok: true, type: "Date32" };
|
|
78
|
+
case "time":
|
|
79
|
+
return { ok: true, type: `Time64(${String(num(args, 0) ?? 7)})` };
|
|
80
|
+
case "datetime2":
|
|
81
|
+
return { ok: true, type: `DateTime64(${String(num(args, 0) ?? 7)})` };
|
|
82
|
+
case "datetime":
|
|
83
|
+
return { ok: true, type: "DateTime64(3)" };
|
|
84
|
+
case "smalldatetime":
|
|
85
|
+
return { ok: true, type: "DateTime64(0)" };
|
|
86
|
+
case "datetimeoffset": {
|
|
87
|
+
const p = num(args, 0) ?? 7;
|
|
88
|
+
return {
|
|
89
|
+
ok: true,
|
|
90
|
+
type: `DateTime64(${String(p)}, 'UTC')`,
|
|
91
|
+
note: {
|
|
92
|
+
message: "datetimeoffset is read as a UTC DateTime64; the stored offset is not kept.",
|
|
93
|
+
evidence: ["datetimeoffset stores a time zone offset (-14:00 to +14:00) with each value; a ClickHouse DateTime64 holds an instant and one column time zone", "values must be converted to UTC when loaded"],
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
case "char":
|
|
98
|
+
case "varchar":
|
|
99
|
+
case "nchar":
|
|
100
|
+
case "nvarchar":
|
|
101
|
+
case "text":
|
|
102
|
+
case "ntext":
|
|
103
|
+
case "sysname": {
|
|
104
|
+
const max = name === "sysname" ? 128 : typeof args[0] === "number" ? args[0] : undefined;
|
|
105
|
+
return { ok: true, type: "String", ...(max !== undefined ? { maxLength: max } : {}) };
|
|
106
|
+
}
|
|
107
|
+
case "binary":
|
|
108
|
+
case "varbinary":
|
|
109
|
+
case "image": {
|
|
110
|
+
const max = typeof args[0] === "number" ? args[0] : undefined;
|
|
111
|
+
return { ok: true, type: "String", ...(max !== undefined ? { maxLength: max } : {}) };
|
|
112
|
+
}
|
|
113
|
+
case "uniqueidentifier":
|
|
114
|
+
return { ok: true, type: "UUID" };
|
|
115
|
+
case "json":
|
|
116
|
+
return { ok: true, type: "JSON" };
|
|
117
|
+
case "xml":
|
|
118
|
+
return {
|
|
119
|
+
ok: true,
|
|
120
|
+
type: "String",
|
|
121
|
+
note: { message: "xml is read as String; ClickHouse has no XML type.", evidence: ["the xml type validates and indexes documents; a String does neither"] },
|
|
122
|
+
};
|
|
123
|
+
case "rowversion":
|
|
124
|
+
case "timestamp":
|
|
125
|
+
return {
|
|
126
|
+
ok: true,
|
|
127
|
+
type: "String",
|
|
128
|
+
note: {
|
|
129
|
+
message: `${name} is read as String; its 8 bytes are an opaque counter.`,
|
|
130
|
+
evidence: ["rowversion is a database-wide counter that SQL Server writes on each row change, not a date or time", "a String keeps the bytes; a UInt64 version column has to be loaded from the source"],
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
case "hierarchyid":
|
|
134
|
+
return { ok: true, type: "String", note: { message: "hierarchyid is read as String; ClickHouse has no hierarchy type.", evidence: ["the binary form is kept as bytes; hierarchy methods (GetAncestor, IsDescendantOf) have no ClickHouse equivalent"] } };
|
|
135
|
+
case "geography":
|
|
136
|
+
case "geometry":
|
|
137
|
+
return { ok: true, type: "String", note: { message: `${name} is read as String; the spatial value is not converted.`, evidence: ["a spatial value needs a conversion (well-known text or binary) at load time", "ClickHouse has Point, Ring and Polygon types, which fit only some shapes"] } };
|
|
138
|
+
case "vector": {
|
|
139
|
+
const dims = num(args, 0);
|
|
140
|
+
return {
|
|
141
|
+
ok: true,
|
|
142
|
+
type: "Array(Float32)",
|
|
143
|
+
note: { message: "vector is read as Array(Float32).", evidence: [dims !== undefined ? `declared with ${String(dims)} dimensions, which an Array does not enforce` : "the dimension count is not enforced by an Array"] },
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
case "sql_variant":
|
|
147
|
+
return { ok: false, reason: "sql_variant holds values of any type, and no single ClickHouse type matches it" };
|
|
148
|
+
case "cursor":
|
|
149
|
+
case "table":
|
|
150
|
+
return { ok: false, reason: `${name} is not a type a stored column can have` };
|
|
151
|
+
default:
|
|
152
|
+
return { ok: false, reason: `the type ${name} is not a system type; user-defined alias types are not read` };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--validate` for a SQL Server import (#4398), against the pinned ClickHouse
|
|
3
|
+
* server: the translated sample schema is created, and a statement the server
|
|
4
|
+
* refuses is reported by name.
|
|
5
|
+
*
|
|
6
|
+
* Needs Docker; skips cleanly without it. One throwaway container, removed
|
|
7
|
+
* afterwards even on failure.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { describe, expect, test } from "vitest";
|
|
13
|
+
import { dockerAvailable } from "../clickhouse/container";
|
|
14
|
+
import { sqlPlugin } from "../plugin";
|
|
15
|
+
import { validateOnEmulator } from "./validate";
|
|
16
|
+
|
|
17
|
+
const enabled = await dockerAvailable();
|
|
18
|
+
const fixture = readFileSync(join(import.meta.dirname, "..", "..", "test-fixtures", "sqlserver", "wwi-excerpt.sql"), "utf8");
|
|
19
|
+
const parse = (text: string) => sqlPlugin.templateParser!({ from: "sqlserver" }).parse(text);
|
|
20
|
+
|
|
21
|
+
describe.skipIf(!enabled)("the emulator accepts the translated sample", () => {
|
|
22
|
+
test("every statement of the WideWorldImporters excerpt is created", async () => {
|
|
23
|
+
const diagnostics = await validateOnEmulator(parse(fixture));
|
|
24
|
+
expect(diagnostics, diagnostics.map((d) => d.message).join("\n")).toEqual([]);
|
|
25
|
+
}, 300_000);
|
|
26
|
+
|
|
27
|
+
test("a view over a column the table does not have is rejected, by name", async () => {
|
|
28
|
+
const diagnostics = await validateOnEmulator(parse("CREATE TABLE t (a int NOT NULL);\nGO\nCREATE VIEW v AS SELECT b FROM t"));
|
|
29
|
+
expect(diagnostics).toHaveLength(1);
|
|
30
|
+
expect(diagnostics[0]).toMatchObject({ ruleId: "SQLRV012", severity: "error", entity: "v" });
|
|
31
|
+
}, 300_000);
|
|
32
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import { ClickHouseQueryError } from "../clickhouse/http";
|
|
3
|
+
import { sqlPlugin } from "../plugin";
|
|
4
|
+
import { statementsOf, validateStatements } from "./validate";
|
|
5
|
+
|
|
6
|
+
const ir = sqlPlugin.templateParser!({ from: "sqlserver" }).parse(`
|
|
7
|
+
CREATE VIEW WebApi.V AS SELECT x FROM Sales.T;
|
|
8
|
+
GO
|
|
9
|
+
CREATE TABLE Sales.T (x int NOT NULL);
|
|
10
|
+
`);
|
|
11
|
+
|
|
12
|
+
describe("validateStatements", () => {
|
|
13
|
+
test("runs databases, then tables, then views, whatever order the file had", () => {
|
|
14
|
+
expect(statementsOf(ir).map((s) => `${s.type.replace("ClickHouse::", "")} ${s.name}`)).toEqual(["Database WebApi", "Database Sales", "Table Sales.T", "View WebApi.V"]);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("a statement the server accepts raises nothing", async () => {
|
|
18
|
+
const seen: string[] = [];
|
|
19
|
+
const out = await validateStatements(statementsOf(ir), async (sql) => void seen.push(sql));
|
|
20
|
+
expect(out).toEqual([]);
|
|
21
|
+
expect(seen).toHaveLength(4);
|
|
22
|
+
expect(seen[2]).toContain("CREATE TABLE Sales.T");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("a refusal is an error diagnostic with the server's first line, and the run goes on", async () => {
|
|
26
|
+
const out = await validateStatements(statementsOf(ir), async (sql) => {
|
|
27
|
+
if (sql.includes("CREATE VIEW")) throw new ClickHouseQueryError(400, "Code: 47. DB::Exception: Unknown identifier x\nstack trace", sql);
|
|
28
|
+
if (sql.includes("CREATE TABLE")) throw new Error("connection reset");
|
|
29
|
+
});
|
|
30
|
+
expect(out).toEqual([
|
|
31
|
+
{ ruleId: "SQLRV012", severity: "error", entity: "Sales.T", message: "Sales.T: the emulator rejected the statement. connection reset" },
|
|
32
|
+
{ ruleId: "SQLRV012", severity: "error", entity: "WebApi.V", message: "WebApi.V: the emulator rejected the statement. Code: 47. DB::Exception: Unknown identifier x" },
|
|
33
|
+
]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("a refusal fails the run even without --strict", async () => {
|
|
37
|
+
const { importExitCode } = await import("@intentius/chant/cli/commands/import-report");
|
|
38
|
+
const out = await validateStatements(statementsOf(ir), async () => {
|
|
39
|
+
throw new Error("no");
|
|
40
|
+
});
|
|
41
|
+
expect(importExitCode(out, false)).toBe(1);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe("validateImport", () => {
|
|
46
|
+
test("is the sql plugin's hook for --validate", () => {
|
|
47
|
+
expect(typeof sqlPlugin.validateImport).toBe("function");
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant import --validate` for a translated schema (#4398): create the
|
|
3
|
+
* emitted DDL on the pinned ClickHouse server, as `chant migrate --validate`
|
|
4
|
+
* runs the emitted YAML through the target's linter.
|
|
5
|
+
*
|
|
6
|
+
* `validateOnEmulator` starts its own throwaway container of the pinned image
|
|
7
|
+
* (`../clickhouse/container.ts`) and removes it afterwards. It never reads
|
|
8
|
+
* `CLICKHOUSE_URL`, so a validation cannot reach a server that holds data.
|
|
9
|
+
* `validateStatements` is the part that needs no Docker: it runs statements
|
|
10
|
+
* through any `run` function, in the order a server needs them (databases,
|
|
11
|
+
* then tables, then views), and turns each refusal into an `error`
|
|
12
|
+
* diagnostic naming the object.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { ImportDiagnostic, TemplateIR } from "@intentius/chant/import/parser";
|
|
16
|
+
import { CLICKHOUSE_ENTITY_TYPES } from "../clickhouse/entities";
|
|
17
|
+
import { ClickHouseQueryError, clickhouseQuery } from "../clickhouse/http";
|
|
18
|
+
import { dockerAvailable, startScratchServer } from "../clickhouse/container";
|
|
19
|
+
import { clickhouseImage } from "../spec/pin";
|
|
20
|
+
|
|
21
|
+
export interface ValidationStatement {
|
|
22
|
+
/** The object, as the diagnostic names it. */
|
|
23
|
+
name: string;
|
|
24
|
+
ddl: string;
|
|
25
|
+
type: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const RANK: Record<string, number> = {
|
|
29
|
+
[CLICKHOUSE_ENTITY_TYPES.database]: 0,
|
|
30
|
+
[CLICKHOUSE_ENTITY_TYPES.table]: 1,
|
|
31
|
+
[CLICKHOUSE_ENTITY_TYPES.view]: 2,
|
|
32
|
+
[CLICKHOUSE_ENTITY_TYPES.materializedView]: 2,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** The IR's ClickHouse objects as statements in creation order. */
|
|
36
|
+
export function statementsOf(ir: TemplateIR): ValidationStatement[] {
|
|
37
|
+
const out = ir.resources.map((r, i) => {
|
|
38
|
+
const p = r.properties as { database?: string; name: string; ddl: string };
|
|
39
|
+
return { name: p.database ? `${p.database}.${p.name}` : p.name, ddl: p.ddl, type: r.type, i };
|
|
40
|
+
});
|
|
41
|
+
return out
|
|
42
|
+
.sort((a, b) => (RANK[a.type] ?? 3) - (RANK[b.type] ?? 3) || a.i - b.i)
|
|
43
|
+
.map(({ name, ddl, type }) => ({ name, ddl, type }));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Run each statement; a refusal is an error diagnostic, and the run goes on to the next. */
|
|
47
|
+
export async function validateStatements(statements: readonly ValidationStatement[], run: (sql: string) => Promise<void>): Promise<ImportDiagnostic[]> {
|
|
48
|
+
const out: ImportDiagnostic[] = [];
|
|
49
|
+
for (const s of statements) {
|
|
50
|
+
try {
|
|
51
|
+
await run(s.ddl);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
const msg = e instanceof ClickHouseQueryError ? e.serverMessage.trim().split("\n")[0]! : e instanceof Error ? e.message : String(e);
|
|
54
|
+
out.push({ ruleId: "SQLRV012", severity: "error", message: `${s.name}: the emulator rejected the statement. ${msg}`, entity: s.name });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create the IR's objects on a throwaway server of the pinned image. Throws,
|
|
62
|
+
* naming the cause, when Docker is not available: the caller reports that the
|
|
63
|
+
* validation did not run, rather than reporting a pass.
|
|
64
|
+
*/
|
|
65
|
+
export async function validateOnEmulator(ir: TemplateIR): Promise<ImportDiagnostic[]> {
|
|
66
|
+
if (ir.resources.some((r) => r.type.startsWith("Postgres::"))) throw new Error("--validate checks ClickHouse DDL; this template holds Postgres objects");
|
|
67
|
+
if (!(await dockerAvailable())) throw new Error("Docker is not available, so the ClickHouse emulator cannot start");
|
|
68
|
+
const server = await startScratchServer(clickhouseImage(), { namePrefix: "chant-sql-import-validate" });
|
|
69
|
+
try {
|
|
70
|
+
return await validateStatements(statementsOf(ir), async (sql) => {
|
|
71
|
+
await clickhouseQuery(server.endpoint, sql);
|
|
72
|
+
});
|
|
73
|
+
} finally {
|
|
74
|
+
await server.stop();
|
|
75
|
+
}
|
|
76
|
+
}
|
package/src/validate.ts
CHANGED
|
@@ -47,6 +47,16 @@ const REQUIRED_ENTITIES = [
|
|
|
47
47
|
"PostgresCollation",
|
|
48
48
|
"PostgresCast",
|
|
49
49
|
"PostgresEventTrigger",
|
|
50
|
+
"PostgresOperator",
|
|
51
|
+
"PostgresOperatorClass",
|
|
52
|
+
"PostgresOperatorFamily",
|
|
53
|
+
"PostgresForeignTable",
|
|
54
|
+
"PostgresTextSearchConfiguration",
|
|
55
|
+
"PostgresTextSearchDictionary",
|
|
56
|
+
"PostgresStatistics",
|
|
57
|
+
"PostgresForeignDataWrapper",
|
|
58
|
+
"PostgresForeignServer",
|
|
59
|
+
"PostgresPublication",
|
|
50
60
|
"PostgresExtension",
|
|
51
61
|
"PostgresFunction",
|
|
52
62
|
"PostgresProcedure",
|
|
@@ -17,5 +17,16 @@ describeWorkspaceKindConformance({
|
|
|
17
17
|
{ name: "a chant project beside a dbt_project.yml", kind: "dbt", files: { "dbt_project.yml": project, "chant.config.ts": "" }, claims: true },
|
|
18
18
|
{ name: "a directory whose dbt project sits one level down", kind: "dbt", files: { "analytics/dbt_project.yml": project }, claims: false },
|
|
19
19
|
{ name: "models without a project file", kind: "dbt", files: { "models/sources.yml": "version: 2\n" }, claims: false },
|
|
20
|
+
// Migration directories (#4400).
|
|
21
|
+
{ name: "a goose directory", kind: "goose", files: { "00001_users.sql": "-- +goose Up\nCREATE TABLE users (id int);\n-- +goose Down\nDROP TABLE users;\n" }, claims: true },
|
|
22
|
+
{ name: "plain SQL files without goose sections", kind: "goose", files: { "00001_users.sql": "CREATE TABLE users (id int);\n" }, claims: false },
|
|
23
|
+
{ name: "a golang-migrate directory", kind: "golang-migrate", files: { "1_users.up.sql": "CREATE TABLE users (id int);\n", "1_users.down.sql": "DROP TABLE users;\n" }, claims: true },
|
|
24
|
+
{ name: "a golang-migrate directory beats clickhouse-migrations on the same file names", kind: "golang-migrate", files: { "1_users.up.sql": "select 1;\n" }, claims: true },
|
|
25
|
+
{ name: "migrations with no up files", kind: "golang-migrate", files: { "1_users.sql": "select 1;\n" }, claims: false },
|
|
26
|
+
{ name: "numbered SQL files", kind: "clickhouse-migrations", files: { "001_init.sql": "CREATE TABLE t (id UInt64) ENGINE = Memory;\n" }, claims: true },
|
|
27
|
+
{ name: "SQL files with no version", kind: "clickhouse-migrations", files: { "init.sql": "select 1;\n" }, claims: false },
|
|
28
|
+
{ name: "a Flyway project with a configuration file", kind: "flyway", files: { "flyway.toml": "[flyway]\n" }, claims: true },
|
|
29
|
+
{ name: "a Flyway directory with only migrations", kind: "flyway", files: { "V1__init.sql": "select 1;\n" }, claims: true },
|
|
30
|
+
{ name: "a directory with no Flyway files", kind: "flyway", files: { "schema.sql": "select 1;\n" }, claims: false },
|
|
20
31
|
],
|
|
21
32
|
});
|
package/workspace-kinds.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$comment": "Member kinds this lexicon supplies to a chant workspace (#3932). chant reads this file as data and never imports the lexicon. A dbt project reads the tables a sql member declares, so its kind ships beside them. Its reader, dbt-project, is chant's own code: it parses dbt_project.yml and the sources YAML under the model paths, never runs dbt, never renders Jinja and never reads profiles.yml, and turns each source table and column into a link to the sql member's <schema>.<table> and <schema>.<table>.<column> outputs (#3931).",
|
|
2
|
+
"$comment": "Member kinds this lexicon supplies to a chant workspace (#3932). chant reads this file as data and never imports the lexicon. A dbt project reads the tables a sql member declares, so its kind ships beside them. Its reader, dbt-project, is chant's own code: it parses dbt_project.yml and the sources YAML under the model paths, never runs dbt, never renders Jinja and never reads profiles.yml, and turns each source table and column into a link to the sql member's <schema>.<table> and <schema>.<table>.<column> outputs (#3931). The same pass exposes each model as an output, <schema>.<model> and <schema>.<model>.<column> where the model's YAML lists columns (#3935); the schema is the modelSchema field, or the custom schema dbt config names when the project's generate_schema_name makes that independent of the target. Four more kinds read existing migration directories (#4400): goose, golang-migrate, clickhouse-migrations and flyway. Each has a probe and a reader (goose-dir, golang-migrate-dir, clickhouse-migrations-dir, flyway-dir) that lists the migrations in the order the tool applies them, with their dialect, and never runs the tool or a server. The reader returns no links and no outputs: the tables and columns a directory produces come from replaying it into a server, not from reading its files.",
|
|
3
3
|
"schema": 1,
|
|
4
4
|
"kinds": [
|
|
5
5
|
{
|
|
6
6
|
"name": "dbt",
|
|
7
|
-
"description": "a dbt project, with a dbt_project.yml in its directory; its sources link to the tables and columns a sql member declares, and dbt is never run",
|
|
7
|
+
"description": "a dbt project, with a dbt_project.yml in its directory; its sources link to the tables and columns a sql member declares, its models are outputs other members link to, and dbt is never run",
|
|
8
8
|
"precedence": 300,
|
|
9
9
|
"probe": {
|
|
10
10
|
"anyFile": [
|
|
@@ -23,6 +23,104 @@
|
|
|
23
23
|
"description": "How source names are cased before they are matched: postgres folds an unquoted name to lowercase and keeps a quoted one as written, the way dbt-postgres quotes a source's schema and identifier unless quoting turns it off; clickhouse keeps every name as written.",
|
|
24
24
|
"default": "postgres",
|
|
25
25
|
"pattern": "^(postgres|clickhouse)$"
|
|
26
|
+
},
|
|
27
|
+
"modelSchema": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "The schema the project's models land in. When set, each model is the output <modelSchema>.<model> and dbt's config is not read for the schema. Unset, chant reads +schema, the model YAML's config and the model's config(schema=...), and a model whose schema depends on the target (dbt's default generate_schema_name joins the target schema to a custom one) is reported as a gap (WSP099) that asks you to set this field.",
|
|
30
|
+
"pattern": "^.+$"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "goose",
|
|
36
|
+
"description": "a goose migrations directory, with .sql files that carry -- +goose Up (and optionally -- +goose Down) sections; the migrations are listed in version order and goose is never run",
|
|
37
|
+
"precedence": 300,
|
|
38
|
+
"probe": {
|
|
39
|
+
"anyLine": {
|
|
40
|
+
"in": [
|
|
41
|
+
"*.sql"
|
|
42
|
+
],
|
|
43
|
+
"starts": [
|
|
44
|
+
"-- +goose up"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"reader": "goose-dir",
|
|
49
|
+
"fields": {
|
|
50
|
+
"dialect": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "The SQL dialect the migrations are written in. The tool takes it from a driver or URL the directory does not hold, so a goose or golang-migrate member names it; unset, postgres.",
|
|
53
|
+
"pattern": "^(postgres|clickhouse)$"
|
|
54
|
+
},
|
|
55
|
+
"migrationsDir": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "The directory under the member's own that holds the migration files. Only the member's own directory is probed, so a member whose files sit in a subdirectory names its kind in its entry.",
|
|
58
|
+
"default": ".",
|
|
59
|
+
"pattern": "^(?!/)(?!(.*/)?\\.\\.(/|$)).+$"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "golang-migrate",
|
|
65
|
+
"description": "a golang-migrate directory, with <version>_<name>.up.sql and .down.sql pairs; the up files are listed in version order and migrate is never run",
|
|
66
|
+
"precedence": 300,
|
|
67
|
+
"probe": {
|
|
68
|
+
"anyFile": [
|
|
69
|
+
"*.up.sql"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"reader": "golang-migrate-dir",
|
|
73
|
+
"fields": {
|
|
74
|
+
"dialect": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "The SQL dialect the migrations are written in. The tool takes it from a driver or URL the directory does not hold, so a goose or golang-migrate member names it; unset, postgres.",
|
|
77
|
+
"pattern": "^(postgres|clickhouse)$"
|
|
78
|
+
},
|
|
79
|
+
"migrationsDir": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"description": "The directory under the member's own that holds the migration files. Only the member's own directory is probed, so a member whose files sit in a subdirectory names its kind in its entry.",
|
|
82
|
+
"default": ".",
|
|
83
|
+
"pattern": "^(?!/)(?!(.*/)?\\.\\.(/|$)).+$"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "clickhouse-migrations",
|
|
89
|
+
"description": "a directory for the Node or Python clickhouse-migrations tool, with <version>_<name>.sql files; they are listed in version order and the tool is never run",
|
|
90
|
+
"precedence": 100,
|
|
91
|
+
"probe": {
|
|
92
|
+
"anyFile": [
|
|
93
|
+
"[0-9]*_*.sql"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"reader": "clickhouse-migrations-dir",
|
|
97
|
+
"fields": {
|
|
98
|
+
"migrationsDir": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"description": "The directory under the member's own that holds the migration files. Only the member's own directory is probed, so a member whose files sit in a subdirectory names its kind in its entry.",
|
|
101
|
+
"default": ".",
|
|
102
|
+
"pattern": "^(?!/)(?!(.*/)?\\.\\.(/|$)).+$"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "flyway",
|
|
108
|
+
"description": "a Flyway project, with a flyway.toml or flyway.conf, or V<version>__<description>.sql files; the migrations of its locations are listed in the order flyway migrate applies them and Flyway is never run",
|
|
109
|
+
"precedence": 300,
|
|
110
|
+
"probe": {
|
|
111
|
+
"anyFile": [
|
|
112
|
+
"flyway.toml",
|
|
113
|
+
"flyway.conf",
|
|
114
|
+
"V*__*.sql",
|
|
115
|
+
"R__*.sql"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"reader": "flyway-dir",
|
|
119
|
+
"fields": {
|
|
120
|
+
"dialect": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "The SQL dialect the migrations are written in. Unset, chant reads it from the JDBC URL in flyway.toml or flyway.conf, and falls back to postgres.",
|
|
123
|
+
"pattern": "^(postgres|clickhouse)$"
|
|
26
124
|
}
|
|
27
125
|
}
|
|
28
126
|
}
|