You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add support for postgres schema selection (#475)
* feat: add support for postgres schema selection
Add support for selecting a PostgreSQL schema instead of always using
'public'. The schema is extracted from the connection URL's options
parameter (search_path), following PostgreSQL's native libpq format.
Changes:
- Add _parse_schema_from_url() to extract schema from connection URL
- Thread schema parameter through all extraction methods with 'public' default
- Add pg_namespace JOINs for correct cross-schema disambiguation
- Add schema input field in DatabaseModal (PostgreSQL only)
- Add comprehensive unit tests for URL schema parsing
- Update documentation with custom schema configuration guide
Based on PR #373 by sirudog with the following fixes:
- Fix pg_namespace JOIN order in extract_columns_info to prevent
duplicate rows when same-named tables exist across schemas
- Fix regex to require '=' separator (prevents mis-capture edge cases)
- Improve $user handling to loop through all schemas instead of only
checking first two positions
- Fix pylint line-too-long in test file
Co-authored-by: sirudog <1550561+sirudog@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: make parse_schema_from_url public to fix CI pylint
Rename _parse_schema_from_url to parse_schema_from_url since the
method is already documented for external use and tested directly.
This eliminates W0212 (protected-access) warnings that cause CI
pylint to fail with exit code 4.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address review comments on PR #475
- Add constraint_schema qualifier to key_column_usage JOINs in
extract_columns_info to prevent cross-schema constraint name
collisions
- Sanitize schema input in DatabaseModal to strip non-identifier
characters before building the URL options
- Add edge case tests: empty tokens, blank quoted tokens, repeated
$user entries
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: remove accidentally committed build artifacts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address copilot reviewer comments on PR #475
- Fix regex to capture search_path values with spaces after commas
(e.g. $user, public) by matching up to next -c option or EOL
- Set session search_path explicitly after connecting so sample
queries resolve to the correct schema
- Use versionless PostgreSQL docs link (/docs/current/)
- Clarify case-sensitivity note for schema names in troubleshooting
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: gitignore build artifacts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: replace ReDoS-vulnerable regex in parse_schema_from_url
Replace (.+?)(?=\s+-c|\s*$) with [^\s,]+(?:\s*,\s*[^\s,]+)* to
eliminate polynomial backtracking flagged by CodeQL. The new pattern
uses unambiguous character classes with no overlapping quantifiers.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: validate schema input instead of silent sanitization, fix doc URL encoding
- DatabaseModal: Show validation error for invalid schema characters instead
of silently stripping them. Throw error on submit if invalid chars present.
- docs: URL-encode the example URL to prevent copy/paste connection failures.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: revert doc URL to readable form to fix spellcheck
The URL-encoded form (-csearch_path%3Dmy_schema) inside the Liquid
capture block triggers spellcheck failures ('csearch', 'Dmy'). Reverted
to readable form since Python's urlparse handles both formats fine.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: add missing tech terms to spellcheck wordlist
Add terms from AGENTS.md/CLAUDE.md (added in staging merge) to the
spellcheck wordlist: config, docstring, dotenv, ESLint, HSTS, init,
Middleware, monorepo, PRs, pylint, pytest, Radix, Zod, and error class
names. Also fix DockerHub capitalization.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: ensure DB connection cleanup on error and add cursor type hints
- Wrap psycopg2 connection/cursor in try/finally so they are always
closed, even when extract_tables_info or extract_relationships raises
- Set conn/cursor to None after explicit close to avoid double-close
in the finally block
- Add Any type hints to cursor parameters on extract_tables_info,
extract_columns_info, extract_foreign_keys, extract_relationships,
and _execute_sample_query
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: increase timeout for multi-step E2E chat tests
Mark three tests that perform multiple LLM round-trips with
test.slow() to triple their timeout (60s → 180s), preventing
spurious CI failures when LLM responses are slow:
- multiple sequential queries maintain conversation history
- switching databases clears chat history
- duplicate record shows user-friendly error message
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: sirudog <1550561+sirudog@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,6 +231,7 @@ with requests.post(url, headers=headers, json={"chat": ["Count orders last week"
231
231
continue
232
232
obj = json.loads(part)
233
233
print('STREAM:', obj)
234
+
```
234
235
235
236
Notes & tips
236
237
- Graph IDs are namespaced per-user. When calling the API directly use the plain graph id (the server will namespace by the authenticated user). For uploaded files the `database` field determines the saved graph id.
0 commit comments