Fix case-insensitive column name collision in SQLite storage#84
Conversation
Endpoints like /v2/aggs/ticker/AAPL/prev return both T (ticker) and t (timestamp). SQLite CREATE TABLE rejects columns that differ only in case, causing query_data to fail with "duplicate column name: t". Rename colliding columns in Table.from_records() by appending _2 to the later column. Original casing is preserved when there is no collision. Fixes massive-com#83
|
@november-pain thanks for the PR! Overall looks good. I left a few comments and once you address them I can run the tests and merge the PR assuming everything passes. |
Hi, thanks. Pushed the fix. |
|
@november-pain there's just a single linter error that needs to be addressed. After that I'll merge it in. I've got another PR with some startup performance improvements that will go out with this in v0.8.8. |
The lint failure is pre-existing on master — ty doesn't recognize the # type: ignore[list-item] directive in tests/test_functions.py:1042. Not related to this PR. |
Fixes #83
Endpoints like
/v2/aggs/ticker/AAPL/prevreturn bothT(ticker) andt(timestamp). SQLiteCREATE TABLErejects columns that differ only in case, soquery_datafails withduplicate column name: t.This renames colliding columns in
Table.from_records()by appending_2to the later column. Original casing is preserved when there is no collision.Example:
["T", "v", "t"]→["T", "v", "t_2"]Tests added for deduplication, multiple collisions, and a full store + query round-trip.