ticketwright 2.0.0__py3-none-any.whl

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.
Files changed (89) hide show
  1. ticketwright/__init__.py +9 -0
  2. ticketwright/_kit/.claude/agents/qc-reviewer.md +50 -0
  3. ticketwright/_kit/.claude/commands/build-context-pack.md +8 -0
  4. ticketwright/_kit/.claude/commands/build-ticket-index.md +8 -0
  5. ticketwright/_kit/.claude/commands/configure-workspace.md +8 -0
  6. ticketwright/_kit/.claude/commands/deliver-ticket.md +8 -0
  7. ticketwright/_kit/.claude/commands/onboard-teammate.md +8 -0
  8. ticketwright/_kit/.claude/commands/prime-domain.md +8 -0
  9. ticketwright/_kit/.claude/commands/prime-ticket.md +8 -0
  10. ticketwright/_kit/.claude/commands/prime-warehouse.md +8 -0
  11. ticketwright/_kit/.claude/commands/productize-workflow.md +8 -0
  12. ticketwright/_kit/.claude/commands/qc-review.md +8 -0
  13. ticketwright/_kit/.claude/commands/recall.md +8 -0
  14. ticketwright/_kit/.claude/commands/start-ticket.md +8 -0
  15. ticketwright/_kit/.claude/config/stack.example.asana-bq.yaml +67 -0
  16. ticketwright/_kit/.claude/config/stack.example.azure.yaml +73 -0
  17. ticketwright/_kit/.claude/config/stack.schema.md +76 -0
  18. ticketwright/_kit/.claude/config/stack.yaml +76 -0
  19. ticketwright/_kit/.claude/hooks/db_write_guard.py +145 -0
  20. ticketwright/_kit/.claude/hooks/regenerate_ticket_index.py +74 -0
  21. ticketwright/_kit/.claude/hooks/session_context.py +78 -0
  22. ticketwright/_kit/.claude/hooks/ticket_index_context.py +99 -0
  23. ticketwright/_kit/.claude/settings.json.tmpl +59 -0
  24. ticketwright/_kit/.claude/skills/productize/SKILL.md +58 -0
  25. ticketwright/_kit/.claude/skills/productize/authoring.md +36 -0
  26. ticketwright/_kit/.claude/skills/refresh/SKILL.md +40 -0
  27. ticketwright/_kit/.claude/skills/refresh/context-pack.md +34 -0
  28. ticketwright/_kit/.claude/skills/refresh/index.md +45 -0
  29. ticketwright/_kit/.claude/skills/review/SKILL.md +76 -0
  30. ticketwright/_kit/.claude/skills/setup/SKILL.md +59 -0
  31. ticketwright/_kit/.claude/skills/setup/adopt.md +43 -0
  32. ticketwright/_kit/.claude/skills/setup/scaffold.md +38 -0
  33. ticketwright/_kit/.claude/skills/setup/teammate.md +33 -0
  34. ticketwright/_kit/.claude/skills/ship/SKILL.md +53 -0
  35. ticketwright/_kit/.claude/skills/spec-and-build/SKILL.md +54 -0
  36. ticketwright/_kit/.claude/skills/ticket/SKILL.md +59 -0
  37. ticketwright/_kit/.claude/skills/ticket/priming.md +47 -0
  38. ticketwright/_kit/.claude/statusline.sh +22 -0
  39. ticketwright/_kit/adapters/README.md +103 -0
  40. ticketwright/_kit/adapters/chat/slack.md +46 -0
  41. ticketwright/_kit/adapters/chat/teams.md +38 -0
  42. ticketwright/_kit/adapters/docstore/gdrive.md +39 -0
  43. ticketwright/_kit/adapters/docstore/sharepoint.md +41 -0
  44. ticketwright/_kit/adapters/tracker/asana.md +55 -0
  45. ticketwright/_kit/adapters/tracker/azure-devops.md +68 -0
  46. ticketwright/_kit/adapters/tracker/github-issues.md +59 -0
  47. ticketwright/_kit/adapters/tracker/jira.md +71 -0
  48. ticketwright/_kit/adapters/tracker/linear.md +56 -0
  49. ticketwright/_kit/adapters/tracker/monday.md +62 -0
  50. ticketwright/_kit/adapters/vcs/azure-repos.md +58 -0
  51. ticketwright/_kit/adapters/vcs/github.md +55 -0
  52. ticketwright/_kit/adapters/vcs/gitlab.md +52 -0
  53. ticketwright/_kit/adapters/warehouse/bigquery.md +44 -0
  54. ticketwright/_kit/adapters/warehouse/databricks.md +58 -0
  55. ticketwright/_kit/adapters/warehouse/postgres.md +44 -0
  56. ticketwright/_kit/adapters/warehouse/redshift.md +49 -0
  57. ticketwright/_kit/adapters/warehouse/snowflake.md +54 -0
  58. ticketwright/_kit/adapters/warehouse/synapse.md +52 -0
  59. ticketwright/_kit/bin/build_ticket_index.py +498 -0
  60. ticketwright/_kit/bin/enrich_ticket.py +138 -0
  61. ticketwright/_kit/bin/ingest_index_records.py +149 -0
  62. ticketwright/_kit/bin/recall.py +268 -0
  63. ticketwright/_kit/bin/render.sh +54 -0
  64. ticketwright/_kit/bin/render_and_validate.sh +139 -0
  65. ticketwright/_kit/bin/selftest.sh +408 -0
  66. ticketwright/_kit/bin/split_and_export.sh +138 -0
  67. ticketwright/_kit/bin/verify_stack.sh +74 -0
  68. ticketwright/_kit/templates/AGENTS.md.tmpl +74 -0
  69. ticketwright/_kit/templates/gitignore.tmpl +35 -0
  70. ticketwright/_kit/templates/plan.md.tmpl +22 -0
  71. ticketwright/_kit/templates/productized-skill/SKILL.md.tmpl +67 -0
  72. ticketwright/_kit/templates/productized-skill/bin/drift_check.sh +30 -0
  73. ticketwright/_kit/templates/productized-skill/golden/example.json +13 -0
  74. ticketwright/_kit/templates/productized-skill/sql/qc.sql.tmpl +21 -0
  75. ticketwright/_kit/templates/productized-skill/sql/step.sql.tmpl +20 -0
  76. ticketwright/_kit/templates/productized-skill/templates/README.md.tmpl +20 -0
  77. ticketwright/_kit/templates/productized-skill/templates/tracker_comment.txt.tmpl +14 -0
  78. ticketwright/_kit/templates/roles/analyst.md +6 -0
  79. ticketwright/_kit/templates/roles/engineer.md +6 -0
  80. ticketwright/_kit/templates/roles/generalist.md +3 -0
  81. ticketwright/_kit/templates/roles/scientist.md +5 -0
  82. ticketwright/_kit/templates/spec.md.tmpl +34 -0
  83. ticketwright/_kit/templates/ticket-README.md.tmpl +29 -0
  84. ticketwright/cli.py +115 -0
  85. ticketwright-2.0.0.dist-info/METADATA +139 -0
  86. ticketwright-2.0.0.dist-info/RECORD +89 -0
  87. ticketwright-2.0.0.dist-info/WHEEL +4 -0
  88. ticketwright-2.0.0.dist-info/entry_points.txt +2 -0
  89. ticketwright-2.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,58 @@
1
+ ---
2
+ seam: warehouse
3
+ tool: databricks
4
+ transport: both # `dbsqlcli` / Statement Execution API for SQL; a Databricks SQL MCP for interactive
5
+ requires: [warehouse_id, catalog, schema] # stack.yaml seams.warehouse.{warehouse_id, catalog, schema, dev_catalog, profile}
6
+ auth: |
7
+ A Databricks SQL warehouse + a token. Either: `dbsqlcli` (pip install databricks-sql-cli) configured
8
+ via `~/.dbsqlclirc` or env (`DBSQLCLI_HOST_NAME`, `DBSQLCLI_HTTP_PATH`, `DBSQLCLI_ACCESS_TOKEN`); or
9
+ the `databricks` CLI profile (~/.databrickscfg) for the Statement Execution API; or a SQL MCP.
10
+ Verify: `databricks --profile {profile} current-user me` (read-only).
11
+ note: |
12
+ The `databricks` CLI has NO ad-hoc "run this SQL" command (`databricks sql` is API CRUD, not a query
13
+ runner). Execute SQL via `dbsqlcli`, the Statement Execution API, or the SQL MCP — all below.
14
+ ---
15
+
16
+ # Databricks adapter
17
+
18
+ Maps the `warehouse` verb contract to Databricks (Unity Catalog, Spark SQL). Same verbs as Snowflake;
19
+ only commands + `dialect_notes` differ, so `review` / `spec-and-build` / `refresh context` run
20
+ unchanged.
21
+
22
+ ## verb: query
23
+ ```bash
24
+ # Preferred: databricks-sql-cli (returns rows; --csv-friendly via -e + redirection)
25
+ dbsqlcli -e "<SQL>" # ad-hoc
26
+ dbsqlcli -e "$(cat path/to/file.sql)" # bundled
27
+ # Or the Statement Execution API (no extra tool; good for CI):
28
+ databricks --profile {profile} api post /api/2.0/sql/statements \
29
+ --json '{"warehouse_id":"{warehouse_id}","statement":"<SQL>","wait_timeout":"30s"}'
30
+ # Or route through the Databricks SQL MCP for interactive exploration.
31
+ ```
32
+ - Deterministic exports: explicit `ORDER BY` (Spark result order is not guaranteed).
33
+ - Reference objects three-part: `{catalog}.{schema}.<object>`.
34
+ - The Statement API is async beyond `wait_timeout`: poll `GET /api/2.0/sql/statements/<id>` until
35
+ `status.state=SUCCEEDED`, then read `result`.
36
+
37
+ ## verb: describe
38
+ ```bash
39
+ dbsqlcli -e "DESCRIBE TABLE EXTENDED {catalog}.{schema}.<obj>"
40
+ dbsqlcli -e "SHOW CREATE TABLE {catalog}.{schema}.<obj>" # DDL
41
+ ```
42
+ Inventory: `SHOW TABLES IN {catalog}.{schema}`. Lineage: Unity Catalog `system.access.table_lineage`
43
+ / `information_schema` (not a naive `SHOW TABLES`, which misses views' upstreams).
44
+
45
+ ## verb: dialect_notes (read by the review skill)
46
+ - **Functions:** `coalesce`/`nvl`, `try_divide(a,b)` (div-by-zero → NULL), `try_cast`, `collect_list`
47
+ / `array_agg` (vs LISTAGG), `date_trunc`. `= NULL` never matches — use `IS NULL`.
48
+ - **Sizing:** SQL warehouse / cluster size + **partitioning / Z-ORDER / liquid clustering**; pruning
49
+ the partition (or clustered) column is the main scan lever. `SELECT *` on wide Delta tables is the
50
+ costly anti-pattern — list columns.
51
+ - **Joins:** type-match keys with `cast`/`try_cast`; mind `STRING` vs `BIGINT`. Broadcast small dims.
52
+ - **Dev/deploy:** dev objects in `{dev_catalog}`; promote with scripted `CREATE OR REPLACE`.
53
+
54
+ ## gotchas
55
+ - Non-SELECT / DDL ⇒ policy `db_write_requires_approval` (show SQL, explain, wait).
56
+ - **Pause before any prod job deploy** — stop for human confirmation before writing prod job
57
+ definitions or PR-ing to a jobs repo.
58
+ - The `databricks` CLI is for workspace/API management; SQL runs through `dbsqlcli` / the SQL API / MCP.
@@ -0,0 +1,44 @@
1
+ ---
2
+ seam: warehouse
3
+ tool: postgres
4
+ transport: cli # `psql`
5
+ requires: [conn] # stack.yaml seams.warehouse.{conn, dev_schema} (conn = libpq URL or service name)
6
+ auth: |
7
+ libpq env (`PGHOST`/`PGUSER`/`PGPASSWORD`/`PGDATABASE`) or a connection URL in `{conn}`; `~/.pgpass`
8
+ for non-interactive. Verify: `psql "{conn}" -c "SELECT 1"` (read-only).
9
+ ---
10
+
11
+ # PostgreSQL adapter
12
+
13
+ Maps the `warehouse` verb contract to PostgreSQL via `psql`. Same three verbs as every warehouse —
14
+ only commands + `dialect_notes` differ, so the data skills run unchanged.
15
+
16
+ ## verb: query
17
+ ```bash
18
+ psql "{conn}" --csv -c "<SQL>" # ad-hoc, CSV (header row 1)
19
+ psql "{conn}" --csv -f <file.sql> # bundled multi-statement
20
+ ```
21
+ - `--csv` emits clean CSV (no `psql` table borders). Add `-t` to drop the header if needed.
22
+ - Deterministic exports: explicit `ORDER BY` (row order is otherwise unspecified).
23
+
24
+ ## verb: describe
25
+ ```bash
26
+ psql "{conn}" -c "\d+ <schema.table>" # columns, types, indexes
27
+ psql "{conn}" -c "SELECT pg_get_viewdef('<schema.view>', true)" # view DDL
28
+ ```
29
+ Inventory: `\dt <schema>.*`; lineage via `information_schema` / `pg_depend`.
30
+
31
+ ## verb: dialect_notes (read by the review skill)
32
+ - **Functions:** `COALESCE`, `NULLIF(a,0)` (div-by-zero guard), `string_agg(x, ',')` (vs LISTAGG),
33
+ `array_agg`, `date_trunc`. `= NULL` never matches — use `IS NULL`. Cast with `::type` or `CAST()`.
34
+ - **Sizing:** no "warehouse size" — performance is **indexes** + query plans. Use `EXPLAIN (ANALYZE,
35
+ BUFFERS)`; ensure join/filter columns are indexed; beware sequential scans on big tables.
36
+ - **Joins:** type-match keys (`int` vs `text` won't use an index); `CAST` explicitly.
37
+ - **Anti-patterns:** `SELECT *` in shipped queries; functions on indexed columns in `WHERE` (kills
38
+ index use); missing `ORDER BY` on exports.
39
+ - **Dev/deploy:** build dev objects in `{dev_schema}` (or set `search_path`); promote with scripted
40
+ `CREATE OR REPLACE` / migrations.
41
+
42
+ ## gotchas
43
+ - Non-SELECT (UPDATE/INSERT/DELETE/DDL) ⇒ policy `db_write_requires_approval`.
44
+ - Wrap multi-statement deploys in a transaction (`BEGIN; … COMMIT;`) so a failure rolls back.
@@ -0,0 +1,49 @@
1
+ ---
2
+ seam: warehouse
3
+ tool: redshift
4
+ transport: cli # `aws redshift-data` (Data API) or `psql` (Redshift speaks the pg wire protocol)
5
+ requires: [database] # stack.yaml seams.warehouse.{database, workgroup_name | cluster_identifier, dev_schema}
6
+ auth: |
7
+ Data API: AWS creds (`aws sts get-caller-identity`) + Secrets Manager/IAM for the DB. **Serverless**
8
+ passes `--workgroup-name {workgroup_name}`; **provisioned** passes `--cluster-identifier
9
+ {cluster_identifier}` (+ `--db-user`). Or `psql` with the endpoint creds. Verify (serverless):
10
+ `aws redshift-data list-databases --database {database} --workgroup-name {workgroup_name}` — or `psql … -c "SELECT 1"`.
11
+ ---
12
+
13
+ # Amazon Redshift adapter
14
+
15
+ Maps the `warehouse` verb contract to Redshift. Two transports: the **Data API** (no driver, good for
16
+ CI/Serverless) and **`psql`** (Redshift is Postgres-wire-compatible). Pick one per `{conn}`.
17
+
18
+ ## verb: query
19
+ ```bash
20
+ # Data API (async: execute → wait → fetch). Serverless:
21
+ id=$(aws redshift-data execute-statement --database {database} \
22
+ --workgroup-name {workgroup_name} --sql "<SQL>" --query Id --output text)
23
+ # Provisioned cluster instead: --cluster-identifier {cluster_identifier} --db-user <user>
24
+ aws redshift-data describe-statement --id "$id" --query Status # poll until FINISHED
25
+ aws redshift-data get-statement-result --id "$id" # JSON rows
26
+ # or direct: psql "host=<endpoint> dbname={database} ..." --csv -c "<SQL>"
27
+ ```
28
+ - Deterministic exports: explicit `ORDER BY`.
29
+
30
+ ## verb: describe
31
+ ```bash
32
+ # columns: SELECT * FROM svv_columns WHERE table_name='<t>' AND table_schema='<s>';
33
+ # DDL: SELECT pg_get_viewdef('<schema.view>', true); -- or pg_table_def for tables
34
+ ```
35
+ Inventory via `svv_tables` / `svv_columns`.
36
+
37
+ ## verb: dialect_notes (read by the review skill)
38
+ - **Functions:** `NVL`/`COALESCE`, `NULLIF`, `LISTAGG(x, ',') WITHIN GROUP (ORDER BY …)`,
39
+ `DATE_TRUNC`. Postgres-derived SQL, but a reduced function set vs Postgres.
40
+ - **Sizing/perf:** the real levers are **DISTKEY** (join co-location) and **SORTKEY** (range-scan
41
+ pruning) + column compression (ENCODE). Columnar store ⇒ `SELECT *` scans every column — list them.
42
+ Run `VACUUM`/`ANALYZE` after big loads; check `EXPLAIN`.
43
+ - **Joins:** matching DISTKEY avoids data redistribution (the main cost); type-match keys.
44
+ - **Dev/deploy:** dev objects in `{dev_schema}`; promote with scripted `CREATE TABLE AS` / `CREATE OR
45
+ REPLACE VIEW`.
46
+
47
+ ## gotchas
48
+ - Data API is **async** — always poll `describe-statement` to `FINISHED` before `get-statement-result`.
49
+ - Non-SELECT/DDL ⇒ policy `db_write_requires_approval`.
@@ -0,0 +1,54 @@
1
+ ---
2
+ seam: warehouse
3
+ tool: snowflake
4
+ transport: both # `snow` CLI for scripts/exports; Snowflake MCP for interactive/semantic
5
+ requires: [cli] # stack.yaml seams.warehouse.{cli, default_warehouse, pii_role, dev_db}
6
+ auth: |
7
+ CLI: ~/.snowflake/config.toml connection (USERNAME_PASSWORD_MFA for CLI/MCP).
8
+ Verify: `snow connection test` (read-only).
9
+ Duo lockout signature: instant 250001/370001 = locked (wait 15 min); hang = push pending.
10
+ ---
11
+
12
+ # Snowflake adapter
13
+
14
+ Maps the `warehouse` verb contract to Snowflake via the `snow` CLI (preferred for repeatable scripts
15
+ and CSV export) and the Snowflake MCP (preferred for interactive exploration + the semantic layer).
16
+
17
+ ## verb: query
18
+ ```bash
19
+ snow sql -q "<SQL>" --format csv # ad-hoc
20
+ snow sql -f <path/to/file.sql> # bundled multi-statement (minimizes MFA prompts)
21
+ ```
22
+ - **Bundle** multi-step work into one `.sql` run via `-f` (one MFA prompt, not many).
23
+ - CSV: always `--format csv`; **strip** the `status` / `Statement executed successfully.` preamble
24
+ the multi-statement `-f` run prints ahead of the result. Robust, documented norm:
25
+ `bin/split_and_export.sh --strip-only <csv>` (drops through the *last* "Statement executed
26
+ successfully." then leading blanks) — and its split mode turns one multi-`SELECT` file into N CSVs.
27
+ - Set warehouse/role inside the SQL: `USE WAREHOUSE {default_warehouse}; USE ROLE {pii_role};`.
28
+ - **Deterministic exports:** always end exports with explicit `ORDER BY` (Snowflake doesn't preserve
29
+ insertion order on `SELECT *`) — required for byte-identical golden replays.
30
+
31
+ ## verb: describe
32
+ ```bash
33
+ snow sql -q "DESCRIBE TABLE <schema.object>" --format csv
34
+ snow sql -q "SELECT GET_DDL('VIEW','<schema.object>')" --format csv
35
+ # semantic view: snow sql -q "DESCRIBE SEMANTIC VIEW <name>"
36
+ ```
37
+ Discover objects via `INFORMATION_SCHEMA.TABLES` + `ACCOUNT_USAGE.OBJECT_DEPENDENCIES` (NOT
38
+ `SHOW VIEWS` — it misses dynamic tables / base tables).
39
+
40
+ ## verb: dialect_notes (read by the review skill's anti-pattern sweep)
41
+ - **Functions:** `IFF`, `NVL/COALESCE`, `NULLIF` (div-by-zero guard), `LISTAGG` (many-to-many),
42
+ `DATE_TRUNC`. `=NULL` never matches — use `IS NULL`.
43
+ - **Sizing:** use a named virtual warehouse for heavy QC (e.g. `{default_warehouse}`), not slots.
44
+ - **Joins:** `CAST()` keys when joining across sources (NUMBER vs VARCHAR mismatches); apply any
45
+ required tenant/schema filter your shared views expect; where a view unions migrated + native
46
+ data, filter to the rows you actually want (e.g. a `IS_MIGRATED` / source flag).
47
+ - **Layering:** prefer your curated layers (e.g. `RAW → STAGING → ANALYTICS → REPORTING`); avoid
48
+ legacy/raw schemas and point-in-time snapshot tables unless the work is compliance/historical.
49
+ - **Dynamic-table chains:** never interpose a regular view between dynamic tables (`target_lag='DOWNSTREAM'`).
50
+ - **Dev/deploy:** build dev objects in `{dev_db}`; promote with your multi-env deploy template (COPY GRANTS).
51
+
52
+ ## gotchas
53
+ - Non-SELECT (UPDATE/CREATE/DELETE/DDL) ⇒ policy `db_write_requires_approval`: show the SQL, explain,
54
+ wait for explicit `yes` before running.
@@ -0,0 +1,52 @@
1
+ ---
2
+ seam: warehouse
3
+ tool: synapse
4
+ transport: cli # `sqlcmd` (go-sqlcmd) — also covers Azure SQL / SQL Server / Fabric Warehouse
5
+ requires: [server, database] # stack.yaml seams.warehouse.{server, database, dev_schema}
6
+ auth: |
7
+ `sqlcmd` (go-sqlcmd) with Azure AD: `-G --authentication-method ActiveDirectoryDefault` after
8
+ `az login` (or a service principal / `ActiveDirectoryInteractive`). Verify:
9
+ `sqlcmd -S {server} -d {database} -G --authentication-method ActiveDirectoryDefault -Q "SELECT 1"`.
10
+ ---
11
+
12
+ # Azure Synapse / Azure SQL adapter (T-SQL)
13
+
14
+ Maps the `warehouse` verb contract to T-SQL backends — Synapse (dedicated SQL pool / serverless),
15
+ Azure SQL Database, SQL Server, or Fabric Warehouse — via `sqlcmd`. Only commands + `dialect_notes`
16
+ differ from the other warehouses, so the data skills run unchanged.
17
+
18
+ ## verb: query
19
+ ```bash
20
+ sqlcmd -S {server} -d {database} -G --authentication-method ActiveDirectoryDefault \
21
+ -s"," -W -Q "<T-SQL>" # comma-separated + trimmed; add `-h -1` to drop the header row
22
+ sqlcmd -S {server} -d {database} -G --authentication-method ActiveDirectoryDefault \
23
+ -s"," -W -i <file.sql>
24
+ ```
25
+ - CSV via `-s"," -W` (column separator + trim trailing spaces); `-h -1` suppresses the header.
26
+ go-sqlcmd's `--format` only supports `horizontal`/`vertical`/`json` — there is **no** `csv` value
27
+ (pipe `--format json` through a JSON→CSV step if you prefer). Deterministic exports: explicit
28
+ `ORDER BY` (T-SQL only guarantees order with an outer `ORDER BY`).
29
+
30
+ ## verb: describe
31
+ ```bash
32
+ # columns: sqlcmd ... -Q "SELECT column_name, data_type FROM information_schema.columns WHERE table_name='<t>'"
33
+ # view DDL: sqlcmd ... -Q "SELECT definition FROM sys.sql_modules WHERE object_id=OBJECT_ID('<schema.view>')" -- portable; sp_helptext is SQL-Server/Azure-SQL only (not Synapse pools)
34
+ ```
35
+ Inventory via `information_schema.tables` / `sys.objects`.
36
+
37
+ ## verb: dialect_notes (read by the review skill)
38
+ - **Functions:** `ISNULL`/`COALESCE`, `NULLIF`, `TRY_CAST`/`TRY_CONVERT`, `STRING_AGG(x, ',')`
39
+ (2017+/Synapse), `TOP n` (not `LIMIT`), `GETDATE()`/`SYSDATETIME()`. `[bracketed]` identifiers.
40
+ - **Sizing/perf (Synapse dedicated):** table **distribution** (`HASH` on the join key / `ROUND_ROBIN`
41
+ / `REPLICATE` for small dims) is the main lever; avoid data movement by aligning distributions.
42
+ Resource classes govern memory. Serverless: cost = bytes scanned (partition/prune).
43
+ - **Joins:** type-match keys (`TRY_CAST`); matching HASH distribution avoids shuffles.
44
+ - **Anti-patterns:** `SELECT *` (columnstore scans all columns); row-by-row cursors; missing `ORDER BY`.
45
+ - **Dev/deploy:** dev objects in `{dev_schema}`; promote views with `CREATE OR ALTER VIEW`. For
46
+ tables: `CTAS` (`CREATE TABLE … AS SELECT`) on Synapse dedicated / Fabric; on Azure SQL DB /
47
+ SQL Server use `SELECT … INTO` instead (they don't support CTAS).
48
+
49
+ ## gotchas
50
+ - Non-SELECT/DDL ⇒ policy `db_write_requires_approval`.
51
+ - Synapse dedicated pools don't support every T-SQL construct (e.g. some `MERGE`/constraint features)
52
+ — check the pool type before assuming.