fix(driver-sql,objectql): honor external.remoteName/remoteSchema in the federation read path (ADR-0015)#2138
Merged
Conversation
…he federation read path (ADR-0015) The query path ignored an external object's remoteName/remoteSchema and resolved the physical table from the object name, so a federated object bound to a differently-named remote table failed with "no such table". ADR-0015's own canonical example (wh_order -> mart.fact_orders) was therefore broken. - SqlDriver.registerExternalObject(): DDL-free metadata for external objects (physical remote table + read-coercion maps) — the read-path counterpart to initObjects(), which is DDL-gated off for external schemaMode. - getBuilder() resolves the physical remote table (+ .withSchema for pg/mysql; sqlite no-op). Coercion re-keyed via coercionKey() so date/datetime filters still resolve after the table switch. Managed path byte-for-byte unchanged. - engine/plugin route objects with external!=null to registerExternalObject in both boot schema-sync and the on-demand syncObjectSchema path. - IDataDriver.registerExternalObject?() declared optional (non-SQL drivers skip). - Tests: sql-driver-external-remote-name.test.ts + a ddl-gate case. ADR-0015 §18 addendum. Scope: remoteName (all dialects) + remoteSchema (pg/mysql). columnMap, native-analytics SQL over external objects, and auto-connecting declared datasources are tracked follow-ups (ADR-0015 §18). 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 3 package(s): 96 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 21, 2026
Merged
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
ADR-0015 external datasource federation declares that an object's
external.remoteName/external.remoteSchemaspecify the remote table it binds to (remoteName defaults toobject.name). The spec, introspection, boot validation, and the write-gate all honored this — but the query-execution path ignored it, resolving the physical table from the object name. So a federated object bound to a differently-named remote table failed withno such table, and ADR-0015's own canonical example (wh_order→mart.fact_orders) was broken.Verified with the real engine + a real better-sqlite3 driver: object
ext_customerwithexternal.remoteName='remote_customers'→no such table: ext_customer; only naming the objectremote_customersreturned rows.What
SqlDriver.registerExternalObject()— a DDL-free counterpart toinitObjects()(which is gated off forschemaMode !== 'managed'). Records the physical remote table (physicalTableByObject/physicalSchemaByObject) and populates the read-coercion maps, keyed by object name, with no DDL.getBuilder()resolves the physical remote table (+.withSchema()for pg/mysql; SQLite no-op). Coercion re-keyed viacoercionKey()so date/datetime filters still resolve after the table switch. Managed path unchanged (oneundefinedlookup).external != nulltoregisterExternalObjectin both the boot schema-sync and the on-demandsyncObjectSchemapath (so a late-registered external driver can be made queryable).IDataDriver.registerExternalObject?()declared optional (non-SQL drivers skip).Scope
remoteName(all dialects) +remoteSchema(pg/mysql).external.columnMap, native-analytics SQL over external objects, and auto-connecting declared datasources are tracked follow-ups (ADR-0015 §18).Tests
sql-driver-external-remote-name.test.ts: remoteName remap read/find/count/filter, boolean/json/date+datetime coercion without DDL, no table-creation leakage.registerExternalObject-is-DDL-free case tosql-driver-ddl-gate.test.ts.tscat baseline (0 new errors).🤖 Generated with Claude Code