Skip to content

feat(sqlserver): Part 7 — adapter_impl.rs match arms - #17

Merged
axellpadilla merged 1 commit into
sqlserver-v2-portfrom
part-7-sqlserver-adapter-impl
Aug 3, 2026
Merged

feat(sqlserver): Part 7 — adapter_impl.rs match arms#17
axellpadilla merged 1 commit into
sqlserver-v2-portfrom
part-7-sqlserver-adapter-impl

Conversation

@axellpadilla

Copy link
Copy Markdown
Collaborator

Stacked on #16 (Part 6).

Resolves all 33 E0004 non-exhaustive-match errors in adapter_impl.rs — the last remaining compile-error backlog blocking a full dbt-adapter crate build for SQL Server. Each site got a SqlServer arm or was folded into an existing group, verified against v1 dbt-sqlserver and the shared macro packages rather than assumed identical to Fabric.

Where it matches Fabric exactly

  • valid_incremental_strategies: same four strategies — v1's SQLServerAdapter.valid_incremental_strategies() returns the identical list.
  • list_schemas_inner's "schema" column name: confirmed via v1's sqlserver__list_schemas, which selects name as [schema].
  • Every purely BigQuery- or Databricks-specific method (partition config, dataset location, table options, DBR capabilities, Iceberg helpers, describe_dynamic_table, etc.): SqlServer joins the existing "unimplemented" bucket alongside Fabric and the other non-BigQuery/non-Databricks adapters.

Where it diverges

  • get_constraint_support: v1's SQLServerAdapter.CONSTRAINT_SUPPORT overrides all five constraint types to Enforced — including Check, unlike Fabric which marks Check NotSupported. Given its own block rather than folded into Fabric's.
  • standardize_grants_dict: joins the Postgres/Bigquery/DuckDB/Alt group (grantee/privilege_type columns), not the "grants not implemented" bucket. v1's sqlserver__get_show_grant_sql selects exactly those two column names, and SQLServerAdapter doesn't override standardize_grants_dict, so it falls through to the same base implementation those adapters use.
  • truncate_relation and get_columns_in_relation's macro-dispatch group: v1 has sqlserver__truncate_relation and sqlserver__get_columns_in_relation macros, so SqlServer joins the macro-based groups rather than any unimplemented bucket.
  • verify_database: joins the "unimplemented" bucket (Fabric/Snowflake/Databricks/Salesforce) rather than the Postgres/DuckDB/Alt/ClickHouse single-database-check group, despite SQL Server otherwise supporting cross-database three-part names. This method is only invoked from the dbt-postgres and dbt-redshift macro packages — grepping the loader's macro assets turns up no other caller — and SQL Server's own macro package never dispatches into either.

Left alone

  • adapter_specific_behavior_flags: returns vec![] for SqlServer. v1 registers 5 behavior flags, but 4 (dbt_sqlserver_use_default_schema_concat, dbt_sqlserver_use_native_string_types, dbt_sqlserver_enable_safe_type_expansion, dbt_sqlserver_use_dbt_transactions) stay on their v1 default with no alternate code path in the Rust adapter yet (e.g. Part 6 hardcoded the native-string-type mapping unconditionally, with no legacy branch reading the flag), and the 5th (dbt_sqlserver_disable_empty_relation_aliases) is out of scope here. None are registered rather than declaring toggles the adapter doesn't yet honor — worth a follow-up once/if those code paths land.

Verification

  • cargo check -p dbt-adapter --tests: clean, 0 errors.
  • cargo build -p dbt-adapter: clean.
  • cargo test -p dbt-adapter --lib: 891 passed, 0 failed.
  • cargo fmt: applied.

This closes out the full compile-error backlog for the dbt-adapter crate — Parts 4/5/6/7 combined leave it building clean end to end.

Closes #7

Resolves all 33 E0004 non-exhaustive-match errors in adapter_impl.rs
that blocked a full dbt-adapter crate build, by adding a SqlServer arm
(or joining an existing group) at every site the compiler flagged.

Grouping decisions, verified against v1 dbt-sqlserver and the shared
macro packages rather than assumed identical to Fabric:

- valid_incremental_strategies: matches Fabric's set exactly — v1's
  SQLServerAdapter.valid_incremental_strategies() returns the same
  four strategies.
- list_schemas_inner's schema column name ("schema"): confirmed via
  v1's sqlserver__list_schemas, which selects `name as [schema]`.
- standardize_grants_dict: joins the Postgres/Bigquery/DuckDB/Alt
  group (grantee/privilege_type columns), not the "grants not
  implemented" bucket — v1's sqlserver__get_show_grant_sql selects
  exactly those two column names, and SQLServerAdapter doesn't
  override standardize_grants_dict, so it falls through to that same
  base implementation.
- truncate_relation and get_columns_in_relation's macro-dispatch
  group: v1 has sqlserver__truncate_relation and
  sqlserver__get_columns_in_relation macros, so SqlServer joins the
  macro-based groups rather than any unimplemented bucket.
- get_constraint_support: v1's SQLServerAdapter.CONSTRAINT_SUPPORT
  overrides all five constraint types to Enforced (including Check,
  unlike Fabric which marks Check NotSupported) — ported as its own
  block rather than folded into Fabric's.
- verify_database: this method is only invoked from the dbt-postgres
  and dbt-redshift macro packages (grep confirms no other package
  calls adapter.verify_database), which SQL Server's macro package
  never dispatches into, so SqlServer joins the "unimplemented"
  bucket alongside Fabric/Snowflake/Databricks rather than the
  Postgres/DuckDB/Alt/ClickHouse single-database-check group — despite
  SQL Server otherwise supporting cross-database three-part names.
- Every purely BigQuery- or Databricks-specific method (partition
  config, dataset location, table options, DBR capabilities, Iceberg
  helpers, etc.) gets SqlServer added to the existing "unimplemented"
  bucket alongside every other non-BigQuery/non-Databricks adapter.
- adapter_specific_behavior_flags: returns vec![] for SqlServer. v1
  registers 5 behavior flags, but 4 (default_schema_concat,
  native_string_types, safe_type_expansion, use_dbt_transactions) are
  staying on their v1 default with no alternate code path in the Rust
  adapter yet, and the 5th (disable_empty_relation_aliases) is out of
  scope here — so none are registered rather than declaring toggles
  the adapter doesn't yet honor. Follow-up if/when those paths land.

Closes #7
@axellpadilla
axellpadilla changed the base branch from part-6-sqlserver-types to sqlserver-v2-port August 3, 2026 01:18
@axellpadilla
axellpadilla merged commit ba867ca into sqlserver-v2-port Aug 3, 2026
@axellpadilla axellpadilla linked an issue Aug 3, 2026 that may be closed by this pull request
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(sqlserver): Part 7 — adapter_impl.rs match arms

1 participant