Repository navigation
Description
Description
Python SDK Stage.load_files() cannot load a valid stage file whose suffix is not one of its hard-coded recognized extensions. Its generic fallback invokes LoadDataManager.from_stage, a method that does not exist. The method returns an error string for that file and leaves its destination empty. The same stage file is readable through the supported load_data.from_file() API.
Environment
- Official main:
c6683bd2f531dcaa80e153c0924dac619c49dc9d, built from the same source; runtimegit_version() = c6683bd2f5. - Isolated local 1 LOG / 1 TN / 2 CN; Python SDK from the same commit.
- Three fresh databases; synchronous client on CN1 and asynchronous client on CN2.
Steps to reproduce
Create a local stage s containing two identical comma-separated text files, data.csv and data.txt:
1,alpha
2,beta
Create separate csv_t, txt_t, and control_t tables with id INT PRIMARY KEY, v VARCHAR(20). With a connected SDK client:
stage = client.stage.get('s')
results = stage.load_files({'data.csv': 'csv_t', 'data.txt': 'txt_t'})
print(results['data.txt'])
# Error: 'LoadDataManager' object has no attribute 'from_stage'
client.load_data.from_file('stage://s/data.txt', 'control_t')For the asynchronous client, await the returned awaitables from supported file entries before inspecting their tables. The .txt fallback itself returns the same error string immediately.
Actual behavior
results['data.txt'] is the captured AttributeError above; txt_t is empty. No server LOAD for that mapping is sent. The .csv mapping in the same batch loads both expected rows. Direct from_file with the same stage:// URL loads both rows into control_t.
Expected behavior
The documented generic fallback should route the stage path to an existing generic LOAD API, or clearly reject an unsupported format before trying an unavailable method. A valid text file that the generic API can load must not fail due to a nonexistent SDK method.
Stability and controls
- 3 fresh databases × sync/async = 6/6 identical
.txtfallback errors. - Same-file direct-stage-URL control and recognized
.csvbatch entry yield exact(1,'alpha'), (2,'beta'), 6/6 each. - A nonexistent
.csvalso yields an error and an empty destination; the failed.txttarget stays empty and the client remains usable after the batch. Stage objects are dropped by the fixture. - The asynchronous return-of-awaitables behavior was observed but its separate API contract is not asserted here.
Evidence
Reproducible isolated probe and complete results: qsdkaudit4_stage.py, qsdkaudit4_stage.json, qsdkaudit4_stage.log. Each run checks complete destination rows rather than only the return value.
Code analysis
Stage.load_files recognizes four extension groups, then calls LoadDataManager(self._client).from_stage(...) for all remaining filenames. LoadDataManager has no from_stage; from_file explicitly supports stage:// paths. The broad except converts the AttributeError into a per-file error string.
Regression coverage
Test recognized and unrecognized suffixes with an identical valid CSV file, missing file, mixed mappings, synchronous and asynchronous execution; verify complete rows and each per-file result. Confirm failure does not alter the corresponding target.
Related
Open and closed issue/PR searches for load_files and from_stage, and the compatibility-contract LOAD section, found no matching SDK fallback defect. The known LOAD-001 duplicate-key limitation is independent: the reproduction uses unique input keys and fails before a LOAD statement is sent.
Activity
fix(python): preserve query context and close SDK boundary gaps
fix(python): unify SDK query and analytics lifecycle contracts (#31774)
XuPeng-SH commentedon Oct 30, 2026
QA handoff for merged #31774 (main
bbfe55669a1440424914d45a283a1d0e36f722fa): please verify the reported public SDK contract and its failure/recovery controls for Python SDK Stage.load_files fallback calls nonexistent from_stage for valid text files. This isolated QA run inspected the issue and merged PR but did not run tests or a live MatrixOne service at this SHA because the existing resource guard left insufficient headroom. The PR's author-reported validation is separate evidence, not a result of this QA run.slyunnn commentedon Oct 30, 2026
Regression and extended verification for #31741 (2026-10-30)
Verification Environment
f6feb84343e4cb949b8ee8063853f86ac99801c6,refactor(sql): consolidate UPDATE target ownership (#31798), is unbuildable due to #31812. The requester approved earlier main43c6d84741d60838c28d2b93ab8ad4b6f922a678,fix(python): enforce CSV export format and preserve user account metadata (#31802), which contains the fix.1.27.1service build; binary module identity and livegit_version()confirm43c6d84741. Same-commit Python SDK, Python3.14, SQLAlchemy1.4.54,2.0.55,2.1.6.2 CN / 1 TN / 1 Log service / Proxy. Proxylocalhost:6001, CN1localhost:16001, CN2localhost:16002all reachable and all executed actual file loads. Sync SDK/SQLAlchemy/PyMySQL and async SDK/SQLAlchemy/aiomysql over MySQL text protocol; Stage files are available to the owned local services.What Was Covered
Stage.load_filesmappings containing.csv,.txt,.dat, a filename without extension and a missing.txt. All72valid-file loads across versions, sync/async and endpoints restore the exact expected2rows per target.load_data.from_file('stage://.../data.txt', ...)controls restore identical rows. Empty mappings return an empty result mapping.18combinations: sync returns the per-file error string; async returns an awaitable which raises the actual loading error when awaited. Failed targets stay empty, remaining files load, and no nonexistentfrom_stagecall occurs.0checked-out connections, Stage removal and database removal verified; final catalog checks find no owned residue.c6683bd2f531dcaa80e153c0924dac619c49dc9dreproducesLoadDataManager has no attribute 'from_stage'on the same server.Findings
PR #31774, merge
bbfe55669a1440424914d45a283a1d0e36f722fa,fix(python): unify SDK query and analytics lifecycle contracts, routes generic suffixes through the existingfrom_fileloader. Valid fallback loads work and genuine file errors remain observable per the existing sync/async contract. The missing-file error is expected (20301), not a regression.MOTR / BVT Coverage
Reused
clients/python/tests/offline/test_stage.py, with real SDK/server/file integration above. The shared three-file SDK contract selection passed171tests on each SQLAlchemy version; these are not all Stage-specific tests. No duplicate SQL-only MOTR coverage, source change, commit or PR was required. Runs were serial across issues and fixture/version resets to isolate Stage/catalog state.Final Conclusion
Fixed on verified main/SDK
43c6d84741; no passing-runtime claim for unbuildablef6feb84343. Large-data regression is not needed: extension dispatch and per-file error propagation are independent of file size;2rows suffice to detect omission and incorrect routing. The issue remains open for maintainer acceptance.