canary environment: Migrate from dbt to mz-deploy#37123
Conversation
327aa15 to
18d0467
Compare
18d0467 to
25087ce
Compare
|
Appreciate you opening this, going to tackle these next week. Are they blockers to merging? Few comments:
Good call out on detecting TTY. If helpful you can use
This is expected. We also don't support sub sources. It simplifies a lot of things to just assume we are in a post create table world. You can however run
Known, this one is ... hard. Going to think on it.
This is a bug and worked at one point 😓 Will add a regression test. |
|
Not blockers, I just work around them by using testdrive/SQL directly. |
It's actually expected you check types.lock into your repo. Like Cargo.lock. Noticed you have it in your .gitignore. There is also no --no-typecheck flag. Wonder where Claude got confused. |
| # External-dependency column types, regenerated by `mz-deploy apply`/`lock` | ||
| # against the live environment (depends on the upstream RDS/Kafka schemas) | ||
| types.lock |
There was a problem hiding this comment.
This is meant to be check in like Cargo.lock file.
| # External-dependency column types, regenerated by `mz-deploy apply`/`lock` | |
| # against the live environment (depends on the upstream RDS/Kafka schemas) | |
| types.lock |
| by the `create` workflow) and `mz-deploy lock` regenerate it, and it is | ||
| git-ignored for that reason. To compile offline without a connection, run | ||
| `mz-deploy lock` once against the environment (or hand-write a `types.lock`). |
There was a problem hiding this comment.
| by the `create` workflow) and `mz-deploy lock` regenerate it, and it is | |
| git-ignored for that reason. To compile offline without a connection, run | |
| `mz-deploy lock` once against the environment (or hand-write a `types.lock`). | |
| by the `create` workflow) and `mz-deploy lock` regenerate it. |
If we want customers to use it so should we.
Edit: Since I did that with Claude I asked it to summarize the issues we ran into:
Bugs
1.
apply tablesbundles a source-table's companionGRANTinto theCREATE TABLE FROM SOURCEtransaction → fails
CREATE TABLE FROM SOURCEthat has aGRANTcompanion fails withtransactions which modify objects are restricted to just modifying objects(
AdapterError::DDLOnlyTransaction).apply_tables.rssetstransaction_group = Some(source_name)forCreateTableFromSource, so the CREATE + index + GRANT run in oneBEGIN/COMMIT. Materialize won't mix a GRANT with object creation in onetransaction.
apply_sources.rsalready does it right(
transaction_group: None; grants run standalone).basictest only grants on a pre-existing table(the
UpToDatepath runs the grant by itself), so it never exercisescreate+grant in one transaction.
like
apply_sourcesdoes.src/mz-deploy/src/cli/commands/apply_tables.rs(~L95–125).2. Reserved-word object names are unusable end-to-end
table.sqlcontainingCREATE TABLE "table"→ObjectNameMismatch, becausevalidate_identcomparesstmt.ident().object(which re-quotes the keyword →
"table") against the unquoted file stem. The"rename to
table" hint is unsatisfiable (CREATE TABLE tablewon't parse).form
db.schema."table"inproject.toml, butObjectId::from_strsplitsnaively on
.with no unquoting, so the declared-dep form, the typechecklookup (unquoted), and
lock's catalog query (which searches for the literal"table") don't line up. Net: you can't even depend on a reserved-wordobject. We had to leave
public_table.tableentirely in testdrive.validate_ident,ObjectId::from_str, and the dependency extractor.src/mz-deploy/src/project/compiler/object_validation/identifiers.rs(
validate_ident, ~L247);src/mz-deploy/src/project/ir/object_id.rs(
from_str, ~L224).Missing capabilities
3.
CREATE SOURCE ... FROM WEBHOOKisn't acceptedIt parses as
Statement::CreateWebhookSource, which isn't in the acceptedProjectStatementset → "unsupported statement type." Webhook sources are anormal source kind; we had to keep ours in testdrive.
src/mz-deploy/src/project/compiler/object_validation.rs(accepted-statement match, ~L256–297).
4. Secret resolver only resolves a top-level
env_var(...)decode(env_var('X'), 'base64')passes through unresolved, so you can'tbase64-decode an env-provided secret — a problem for a base64-delivered GCP
service-account key (we pre-encoded to bytea-hex in the harness as a
workaround). A
base64_decode(...)provider, or resolving nested providercalls, would fix it.
src/mz-deploy/src/secret_resolver.rs(resolve_expr, ~L121).5. No
${ENV}expansion forproject.tomlprofile variablesOnly the
profiles.tomlpasswordfield expands env vars. Soenvironment-specific connection endpoints (broker, RDS hosts, GCS bucket) can't
come from the environment at deploy time — we rewrite
project.tomlat runtime.src/mz-deploy/src/config.rs(expand_env_vars).Papercuts / UX
6.
wait(and other long-running commands) produce no visible output off a TTYThe live hydration dashboard is buffered; through
docker compose run/ CI yousee nothing until the command exits. It should detect non-TTY and emit periodic
plain-text progress lines.
src/mz-deploy/src/cli/commands/wait.rs.7.
compilealways type-checks, with no--no-typecheckA fresh checkout of a project with
CREATE TABLE FROM SOURCEcan'tcompileoffline without first generating
types.lockagainst a live server (theupstream columns aren't committable for a CDC/Kafka canary) — awkward for CI and
first-time dev.
src/mz-deploy/src/cli/commands/compile.rs.8. No warning that an apply-managed object's index on a swap-participating cluster is dropped at
promoteA
CREATE TABLE FROM SOURCEindex placed on the blue/green compute cluster isdestroyed by the cluster swap at
promote. A compile-time lint would help.Possibly by-design, but undocumented.