Repository navigation
Feature/db conn passing - #18
Open
Petroncini wants to merge 9 commits into
Open
Petroncini wants to merge 9 commits into
Petroncini wants to merge 9 commits into
Conversation
InsightEngine now accepts an optional db_engine: a SQLAlchemy Engine built and disposed by the caller. It is injected into the schema, code-agent and sandbox nodes via functools.partial (same pattern already used for llm), so it never enters the LangGraph state and is never checkpointed. This keeps credentials out of the MemorySaver snapshot and hands connection lifecycle/pooling to the caller instead of the library. - code_sql: extract executar_sql_via_engine (never creates/disposes the engine); executar_sql_via_url now delegates to it - schema/sandbox/code_agent: use the injected engine first, reading the dialect from engine.dialect.name; legacy db_path/db_config/db_url path is unchanged when no engine is given - graph: only bind engine= when one is provided, so existing mocks keep working - cli: --db-url now builds and disposes its own Engine and passes it in - tests: cover schema, execution and dialect resolution via engine
Review follow-ups for the caller-owned engine: - executar_sql_via_engine no longer leaves session state on the caller's pooled connections: the SQLite timeout progress handler is cleared after the query (it was aborting the caller's later queries with "interrupted"), and MySQL connections are invalidated since SET SESSION is not transactional. Postgres SET runs inside the auto-begun transaction and is rolled back on close. - data exploration now uses the injected engine instead of opening db_path (which could be a different database); it is SQLite-only, so it is skipped for other dialects. - enrich no longer writes the db_path-keyed schema cache when the schema came from an engine or db_url, which overwrote the local SQLite cache with another database's schema. - replace a test that could not fail with regression tests for the above.
execução de dialetos por drivers diretos (PostgreSQL e MySQL
O script agora cria uma Engine SQLAlchemy read-only por banco, passa via db_engine para a InsightEngine e a descarta ao final.
Mesmo padrão do script do Spider 2: uma Engine SQLAlchemy read-only por banco, passada via db_engine e descartada ao final.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.