feat(driver-sql): honor external.columnMap on federated objects (ADR-0015)#2149
Merged
Conversation
…0015)
When a federated (external) object declares external.columnMap
({ remoteColumn -> localField }), the SQL driver now translates the query
pipeline to the physical remote columns:
- registerExternalObject inverts columnMap to localField -> remoteColumn (+ keeps
the inverse for read remap).
- WHERE (object/array/mongo forms) and ORDER BY resolve the local field to its
remote column via remoteColumn(); value coercion stays keyed by the local field.
- formatOutput renames remote-column keys back to local field names on read
(no-op when no columnMap), so coercion + callers see local names.
- write payloads are key-remapped after formatInput.
Managed objects and external objects without a columnMap are byte-for-byte
unchanged (the resolver falls back to each site's existing behavior). Adds
sql-driver-external-columnmap.test.ts (read/where/orderBy/date-coercion + managed
control). ADR-0015 §18 updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 22, 2026
…le, credentials, visibility, query completeness) (#2162) Consolidates the runtime gaps surfaced while implementing ADR-0015 federation (#2138 read path, #2149 columnMap, #2139 example+verify, #2157 visibility) into a single forward decision: one DatasourceConnectionService that auto-connects declared datasources as queryable engine drivers (no onEnable bridge), backward- compatible opt-in gating (existing managed apps unchanged), credential resolution at connect, native-analytics remote-table awareness, and columnMap/field.columnName reconciliation. Status: Proposed; decisions D1-D8 with a phased rollout. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Follow-up to ADR-0015 federation (#2138/#2139). When a federated (external) object's remote table has column names that differ from the local field names, you express the mapping with
external.columnMap({ remoteColumn → localField }). The spec accepted it, but the SQL driver's query pipeline ignored it — WHERE/ORDER BY/SELECT used the local field names as physical columns, so a columnMap'd object couldn't be queried correctly.What
Scoped, additive, gated on
external.columnMapbeing present — managed objects and external objects without a columnMap are byte-for-byte unchanged.registerExternalObjectinvertscolumnMaptolocalField → remoteColumn(and keeps the inverse for read remap).remoteColumn(object, field, fallback)helper resolves the physical column, falling back to each call-site's existing resolution when there's no columnMap.formatOutputrenames remote-column keys back to local field names on read (no-op without a columnMap), so coercion and callers see local names.formatInput.Tests
sql-driver-external-columnmap.test.ts: reads return local field names from differently-named remote columns; WHERE (object/array/$gte), ORDER BY, and date-coercion all translate through the columnMap; a managed control object is unaffected. Fulldriver-sqlsuite green (189/189);sql-driver.tsreports 0 type errors. ADR-0015 §18 updated.🤖 Generated with Claude Code