Releases: simonw/sqlite-utils
Releases · simonw/sqlite-utils
4.0rc1
- New database migrations system, incorporating functionality that was previously provided by the separate sqlite-migrate plugin. Define migration sets using the new
sqlite_utils.Migrationsclass and apply them using thesqlite-utils migratecommand or the migrations Python API. (#752) - New
db.atomic()context manager providing nested transaction support using SQLite transactions and savepoints. Internal multi-step operations such astable.transform()now use this mechanism to avoid unexpectedly committing an existing transaction. (#755) Databaseobjects can now be used as context managers, automatically closing the connection when thewithblock exits. The CLI also now closes database and file handles more reliably, resolving a number ofResourceWarningwarnings. (#692)- The
sqlite-utils convertcommand can now accept a direct callable reference such asr.parsedateorjson.loads --import jsonas the conversion code, as an alternative to calling it explicitly withr.parsedate(value). (#686) - Fixed a bug where CSV or TSV files with only a header row could crash
sqlite-utils insertandsqlite-utils memorywhen type detection was enabled. Thanks, Rami Abdelrazzaq. (#702, #707) - Fixed a bug where installed plugins could be loaded while running the test suite, despite the test-mode safeguard that disables plugin loading. Thanks, Rami Abdelrazzaq. (#713, #719)
table.detect_fts()now recognizes legacy FTS virtual tables that quote thecontent=table name using square brackets, allowingtable.enable_fts(..., replace=True)to replace them correctly. (#694)- Now depends on Click 8.3.1 or later, removing compatibility workarounds for Click's
Sentineldefault values. (#666) - Improved type annotations throughout the package, with
tynow run in CI. (#697) - Development tooling now uses
uvdependency groups, with separatedevanddocsgroups. (#691) - The test suite now runs against Python 3.15-dev. (#738)
4.0a1
- Breaking change: The
db.table(table_name)method now only works with tables. To access a SQL view usedb.view(view_name)instead. (#657) - The
table.insert_all()andtable.upsert_all()methods can now accept an iterator of lists or tuples as an alternative to dictionaries. The first item should be a list/tuple of column names. See Inserting data from a list or tuple iterator for details. (#672) - Breaking change: The default floating point column type has been changed from
FLOATtoREAL, which is the correct SQLite type for floating point values. This affects auto-detected columns when inserting data. (#645) - Now uses
pyproject.tomlin place ofsetup.pyfor packaging. (#675) - Tables in the Python API now do a much better job of remembering the primary key and other schema details from when they were first created. (#655)
- Breaking change: The
table.convert()andsqlite-utils convertmechanisms no longer skip values that evaluate toFalse. Previously the--skip-falseoption was needed, this has been removed. (#542) - Breaking change: Tables created by this library now wrap table and column names in
"double-quotes"in the schema. Previously they would use[square-braces]. (#677) - The
--functionsCLI argument now accepts a path to a Python file in addition to accepting a string full of Python code. It can also now be specified multiple times. (#659) - Breaking change: Type detection is now the default behavior for the
insertandupsertCLI commands when importing CSV or TSV data. Previously all columns were treated asTEXTunless the--detect-typesflag was passed. Use the new--no-detect-typesflag to restore the old behavior. TheSQLITE_UTILS_DETECT_TYPESenvironment variable has been removed. (#679)
3.39
- Fixed a bug with
sqlite-utils installwhen the tool had been installed usinguv. (#687) - The
--functionsargument now optionally accepts a path to a Python file as an alternative to a string full of code, and can be specified multiple times – see Defining custom SQL functions. (#659) sqlite-utilsnow requires Python 3.10 or higher.
sqlite-utils 4.0a1 is now available as an alpha with some minor breaking changes.
4.0a0
- Upsert operations now use SQLite's
INSERT ... ON CONFLICT SETsyntax on all SQLite versions later than 3.23.1. This is a very slight breaking change for apps that depend on the previousINSERT OR IGNOREfollowed byUPDATEbehavior. (#652) - Python library users can opt-in to the previous implementation by passing
use_old_upsert=Trueto theDatabase()constructor, see Alternative upserts using INSERT OR IGNORE. - Dropped support for Python 3.8, added support for Python 3.13. (#646)
sqlite-utils tuiis now provided by the sqlite-utils-tui plugin. (#648)- Test suite now also runs against SQLite 3.23.1, the last version (from 2018-04-10) before the new
INSERT ... ON CONFLICT SETsyntax was added. (#654)
3.38
- Plugins can now reuse the implementation of the
sqlite-utils memoryCLI command with the newreturn_db=Trueparameter. (#643) table.transform()now recreates indexes after transforming a table. A newsqlite_utils.db.TransformErrorexception is raised if these indexes cannot be recreated due to conflicting changes to the table such as a column rename. Thanks, Mat Miller. (#633)table.search()now accepts ainclude_rank=Trueparameter, causing the resulting rows to have arankcolumn showing the calculated relevance score. Thanks, liunux4odoo. (#628)- Fixed an error that occurred when creating a strict table with at least one floating point column. These
FLOATcolumns are now correctly created asREALas well, but only for strict tables. (#644)
3.38a0
3.37
- The
create-tableandinsert-filescommands all now accept multiple--pkoptions for compound primary keys. (#620) - Now tested against Python 3.13 pre-release. (#619)
- Fixed a crash that can occur in environments with a broken
numpyinstallation, producing amodule 'numpy' has no attribute 'int8'. (#632)
3.36
- Support for creating tables in SQLite STRICT mode. Thanks, Taj Khattra. (#344)
- CLI commands
create-table,insertandupsertall now accept a--strictoption. - Python methods that can create a table -
table.create()andinsert/upsert/insert_all/upsert_allall now accept an optionalstrict=Trueparameter. - The
transformcommand andtable.transform()method preserve strict mode when transforming a table.
- CLI commands
- The
sqlite-utils create-tablecommand now acceptsstr,intandbytesas aliases fortext,integerandblobrespectively. (#606)
3.35.2
- The
--load-extension=spatialiteoption and find_spatialite() utility function now both work correctly onarm64Linux. Thanks, Mike Coats. (#599) - Fix for bug where
sqlite-utils insertcould cause your terminal cursor to disappear. Thanks, Luke Plant. (#433) datetime.timedeltavalues are now stored asTEXTcolumns. Thanks, Harald Nezbeda. (#522)- Test suite is now also run against Python 3.12.