Conversation
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.
Passing a connection string to
Table.to_sqlcurrently loses inserted rows with SQLAlchemy 2: the function opens a connection, inserts successfully, then closes it without committing. A two-row table written to a file-backed SQLite database is empty when read through a new connection.Manage a transaction only when
to_sqlowns the engine/connection. Successful writes commit; exceptions roll back and release the owned connection and engine. Existing connections retain caller-controlled transactions, including when insertion fails. This preserves csvsql's outer transaction and does not reintroduce unconditional transaction nesting from the changes discussed in #40/#42 and the 0.7.2 changelog.Add seven regression cases for persisted ordinary/chunked writes, failed ordinary/chunked insert cleanup, and caller-owned commit/rollback/error handling. Document the ownership distinction and database-specific DDL limitations.
Validation on Windows / Python 3.12.14:
tests/test_utilities/test_csvsql.py, importing this agatesql source: 23 passed (two existing empty-input dialect-sniff warnings).flake8 agatesql tests,isort agatesql tests --check-only, andgit diff --check: passed.Transaction behavior was exercised using real file-backed SQLite databases and separate connections. No live PostgreSQL/MySQL service or documentation build was tested locally.