{"id":4338,"library":"apswutils","title":"APSW Utilities","description":"apswutils (version 0.1.2) is a Python utility library that forks sqlite-minutils to provide a convenient API for interacting with SQLite databases using the `apsw` driver. It offers simplified methods for database and table creation, data insertion, and querying, essentially acting as a lightweight wrapper over `apsw`. The project is actively maintained with recent updates and emphasizes features like WAL mode by default.","status":"active","version":"0.1.2","language":"python","source_language":"en","source_url":"https://github.com/AnswerDotAI/apswutils","tags":["sqlite","apsw","database","utilities","orm"],"install":[{"cmd":"pip install apswutils","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"apswutils is a wrapper around the apsw SQLite driver; apsw is required for database interaction.","package":"apsw"}],"imports":[{"symbol":"Database","correct":"from apswutils.db import Database"},{"symbol":"Table","correct":"from apswutils.db import Table"},{"symbol":"View","correct":"from apswutils.db import View"},{"symbol":"Queryable","correct":"from apswutils.db import Queryable"},{"note":"The library's README suggests this pattern, stating it only brings in Database, Queryable, Table, View classes without namespace pollution.","symbol":"* (wildcard import)","correct":"from apswutils.db import *"}],"quickstart":{"code":"from apswutils.db import Database, Table\n\ndb = Database(':memory:') # Use ':memory:' for an in-memory database\n\n# Create a table\nusers = Table(db, 'Users')\nusers.create(columns=dict(id=int, name=str, age=int), pk='id')\n\n# Insert data\nusers.insert({'id': 1, 'name': 'Alice', 'age': 30})\nusers.insert_all([\n    {'id': 2, 'name': 'Bob', 'age': 24},\n    {'id': 3, 'name': 'Charlie', 'age': 35}\n])\n\n# Query data\nfor user in users.rows:\n    print(f\"ID: {user['id']}, Name: {user['name']}, Age: {user['age']}\")\n\n# Update table schema (add a column)\nusers.create(columns=dict(id=int, name=str, age=int, email=str), transform=True, pk='id')\nprint(\"\\nUpdated schema:\")\nprint(db.schema)\n\ndb.close()","lang":"python","description":"This quickstart demonstrates how to initialize an in-memory SQLite database, create a table with defined columns and a primary key, insert single and multiple records, and query all rows. It also shows how to modify the table schema by adding a new column."},"warnings":[{"fix":"Replace calls to `fetchone()` with `item()`. Ensure that `item()` is only used when exactly one row and field are expected, or wrap in a try-except block.","message":"In version 0.0.3, the `fetchone` method was renamed to `item`. Additionally, `item` now raises an exception if more than one row or field is present in the result.","severity":"breaking","affected_versions":">=0.0.3"},{"fix":"Review your code for any changes in error handling, particularly around `OperationError`, and test thoroughly when upgrading from versions prior to 0.1.0.","message":"Version 0.1.0 introduced breaking changes, though specific details beyond 'Bump version number due to breaking change' are not explicitly documented in the release notes. Subsequent releases indicate the removal of `OperationError` which might be related.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Be aware of `apsw`'s unique characteristics. If using `multiprocessing`, ensure `apsw` database connections are closed in the parent process before new processes are spawned. Explicitly manage transactions if not relying on `apsw`'s default autocommit behavior for non-transactional statements.","message":"The library is built on `apsw`, which has specific behaviors differing from `sqlite3`. `apswutils` defaults to WAL (Write-Ahead Logging) mode. Additionally, `apsw` connections should not be used across `fork` operations (e.g., in `multiprocessing`) unless explicitly closed in the parent before forking.","severity":"gotcha","affected_versions":"All"},{"fix":"Refer to the `sqlite-utils` documentation for in-depth understanding of many underlying concepts and functionalities.","message":"While `apswutils` provides a simplified API, its comprehensive documentation directs users to the `sqlite-utils` project for full details, as `apswutils` is largely a fork with minor changes.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-22T06:11:22.138Z","next_check":"2026-07-11T00:00:00.000Z","problems":[{"fix":"Install the 'apsw' module using pip: 'pip install apsw'.","cause":"The 'apsw' module is not installed in the Python environment.","error":"ModuleNotFoundError: No module named 'apsw'"},{"fix":"Ensure 'apsw' is installed correctly and rename any local files named 'apsw.py' to avoid conflicts.","cause":"The 'apsw' module is either not installed correctly or the script is shadowing the 'apsw' module by naming a local file 'apsw.py'.","error":"AttributeError: module 'apsw' has no attribute 'Connection'"},{"fix":"Use the 'apsw' module instead, which provides this functionality: 'import apsw; connection = apsw.Connection(\"database.db\"); connection.enable_load_extension(True)'.","cause":"The 'sqlite3' module in Python does not support the 'enable_load_extension' method in some versions.","error":"AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension'"},{"fix":"Run `pip install apswutils` to install the library.","cause":"The 'apswutils' package is not installed in the Python environment, or the environment where it is installed is not the one being used.","error":"ModuleNotFoundError: No module named 'apswutils'"},{"fix":"Import the necessary classes directly from the `apswutils.db` submodule, for example: `from apswutils.db import Database, Table` or `from apswutils.db import *`.","cause":"The core classes like `Database`, `Table`, `Queryable`, and `View` are located within the `apswutils.db` submodule, and are not directly accessible from the top-level `apswutils` package.","error":"AttributeError: module 'apswutils' has no attribute 'Database'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/AnswerDotAI/apswutils","docs":null,"changelog":null,"pypi":"https://pypi.org/project/apswutils/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","serialization"],"base_url":null,"auth_type":null,"install_checks":{"last_tested":"2026-05-22","tag":null,"tag_description":null,"installed_version":"0.1.2","pypi_latest":"0.1.2","is_stale":false,"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.4,"mem_mb":8.7,"disk_size":"28.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.2,"import_time_s":0.29,"mem_mb":8.7,"disk_size":"30M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.69,"mem_mb":9.4,"disk_size":"31.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.2,"import_time_s":0.61,"mem_mb":9.4,"disk_size":"32M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.55,"mem_mb":9.4,"disk_size":"23.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2,"import_time_s":0.58,"mem_mb":9.4,"disk_size":"24M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.56,"mem_mb":9.4,"disk_size":"23.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2,"import_time_s":0.57,"mem_mb":9.4,"disk_size":"24M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.35,"mem_mb":8.5,"disk_size":"36.2M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"apswutils","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.8,"import_time_s":0.28,"mem_mb":8.5,"disk_size":"42M"}]},"_links":{"self":"https://checklist.day/api/registry/apswutils","v1":"https://checklist.day/v1/registry/apswutils","v1_install":"https://checklist.day/v1/registry/apswutils/install","v1_imports":"https://checklist.day/v1/registry/apswutils/imports","v1_compatibility":"https://checklist.day/v1/registry/apswutils/compatibility","v1_quickstart":"https://checklist.day/v1/registry/apswutils/quickstart","docs":"https://checklist.day/docs"}}