Releases: simonw/sqlite-utils
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.
3.35.1
3.35
Adding foreign keys to a table no longer uses PRAGMA writable_schema = 1 to directly manipulate the sqlite_master table. This was resulting in errors in some Python installations where the SQLite library was compiled in a way that prevented this from working, in particular on macOS. Foreign keys are now added using the table transformation mechanism instead. (#577)
This new mechanism creates a full copy of the table, so it is likely to be significantly slower for large tables, but will no longer trigger table sqlite_master may not be modified errors on platforms that do not support PRAGMA writable_schema = 1.
A new plugin, sqlite-utils-fast-fks, is now available for developers who still want to use that faster but riskier implementation.
Other changes:
- The table.transform() method has two new parameters:
foreign_keys=allows you to replace the foreign key constraints defined on a table, andadd_foreign_keys=lets you specify new foreign keys to add. These complement the existingdrop_foreign_keys=parameter. (#577) - The sqlite-utils transform command has a new
--add-foreign-keyoption which can be called multiple times to add foreign keys to a table that is being transformed. (#585) - sqlite-utils convert now has a
--pdboption for opening a debugger on the first encountered error in your conversion script. (#581) - Fixed a bug where
sqlite-utils install -e '.[test]'option did not work correctly.