Commit 708c7eb
committed
fix: add system view fallback chain for Redshift schema discovery (#37)
On some Redshift clusters (data sharing, Lake Formation, Serverless),
svv_tables returns empty results. Add auto-detection at init time with
fallback chain: svv_tables -> svv_all_tables -> information_schema.
- Probe each source with COUNT query, pick first with rows > 0
- Handle column name differences (table_schema vs schema_name)
- Filter svv_all_tables by current_database() to avoid cross-DB noise
- Add db_filter to _get_table_columns for cross-DB isolation
- Extract _process_bulk_rows and _get_tables_bulk_information_schema
to avoid state mutation in fallback (concurrency safe)
- Skip caching empty results to prevent 24h dead cache
- Normalize schema name to lowercase
- Add 8 unit tests for detection chain and row processing
Closes #37
Bump version to 0.2.0rc11.1 parent 695a629 commit 708c7eb
5 files changed
Lines changed: 343 additions & 123 deletions
File tree
- src/nlp2sql
- adapters
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
0 commit comments