Skip to content

Exclude columns also at the SQL Level. Columns hidden in config can't be queried by agent - #1373

Open
ad4mou wants to merge 12 commits into
mainfrom
feat/exclude-columns-from-agent-1015
Open

Exclude columns also at the SQL Level. Columns hidden in config can't be queried by agent#1373
ad4mou wants to merge 12 commits into
mainfrom
feat/exclude-columns-from-agent-1015

Conversation

@ad4mou

@ad4mou ad4mou commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make exclude_columns actually apply when the agent runs SQL, not only when syncing context.
  • Explicit use of an excluded column is blocked with a clear error.
  • SELECT * still runs, but excluded columns are removed first and a yellow warning explains what was stripped.
  • If we can’t safely tell whether a query touches excluded columns, we block it.

Closes #1015

Review in cubic

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

URL https://pr-1373-7db991a.preview.getnao.io
Commit 7db991a

⚠️ No LLM API keys configured - you'll see the API key setup flow when trying to chat.


Preview will be automatically removed when this PR is closed.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/backend/fastapi/main.py Outdated
Comment thread apps/backend/src/components/tool-outputs/execute-sql.tsx Outdated
@ad4mou
ad4mou requested a review from Bl3f August 10, 2026 14:42

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread cli/nao_core/config/databases/exclude_columns_guard.py Outdated
Comment thread cli/nao_core/config/databases/column_access.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread cli/nao_core/config/databases/column_access.py
Comment thread apps/backend/fastapi/main.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/backend/fastapi/main.py Outdated

@Bl3f Bl3f left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need more work I think ; esp. on the column guard, which is not really the best name I'd say.

We should have a parser and from this parser raise usage errors on columns/tables

Comment thread apps/backend/fastapi/main.py Outdated
Comment thread apps/backend/fastapi/test_main.py
Comment thread cli/nao_core/config/databases/exclude_columns_guard.py Outdated
Comment thread cli/nao_core/config/databases/base.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/backend/fastapi/main.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 13 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread cli/nao_core/commands/sync/providers/databases/provider.py Outdated
Comment thread cli/nao_core/config/databases/column_access.py
Comment thread cli/nao_core/config/databases/clickhouse.py Outdated
Comment thread cli/nao_core/commands/sync/providers/databases/provider.py Outdated
Comment thread cli/nao_core/config/databases/column_catalog.py Outdated
Comment thread cli/nao_core/config/databases/column_catalog.py
Comment thread cli/nao_core/config/databases/starrocks.py Outdated
Comment thread cli/nao_core/config/databases/context.py
@ad4mou
ad4mou requested a review from Bl3f August 14, 2026 11:49
@ad4mou

ad4mou commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

I tested extensively with a DuckDB and a BigQuery DB, the feature works great.
Although the agent can kind of go crazy is the choices of columns to exclude are not judicious

@ClaireGz

Copy link
Copy Markdown
Contributor

@ad4mou we will put this under the enterprise license - can you implement the change?

@ad4mou

ad4mou commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Yes absolutely, this is what it looks like for now.
I'll wait until the new settings are merged to add the little Entreprise lock and to add the feature to the list in the new Entreprise page.

CleanShot.2026-08-26.at.11.29.16.mp4

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 15 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/backend/fastapi/main.py
@ad4mou

ad4mou commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] exclude_columns should block the agent from querying those columns in execute_sql

3 participants