Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-sqlite-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest]
python-version: ["3.9"]
python-version: ["3.10"]
sqlite-version: [
"3.46",
"3.23.1", # 2018-04-10, before UPSERT
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14-dev", "3.14t-dev"]
numpy: [0, 1]
os: [ubuntu-latest, macos-latest, windows-latest, macos-14]
# Skip 3.9 on macos-14 - it only has 3.10+
exclude:
- python-version: "3.9"
os: macos-14
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -60,4 +56,4 @@ jobs:
run: black . --check
- name: Check if cog needs to be run
run: |
cog --check README.md docs/*.rst
cog --check --diff README.md docs/*.rst
2 changes: 1 addition & 1 deletion docs/cli-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ See :ref:`cli_spatialite`.
paths. To load it from a specific path, use --load-extension.

Options:
-t, --type [POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION|GEOMETRY]
-t, --type [point|linestring|polygon|multipoint|multilinestring|multipolygon|geometrycollection|geometry]
Specify a geometry type for this column.
[default: GEOMETRY]
--srid INTEGER Spatial Reference ID. See
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ def get_long_description():
"Issues": "https://github.com/simonw/sqlite-utils/issues",
"CI": "https://github.com/simonw/sqlite-utils/actions",
},
python_requires=">=3.9",
python_requires=">=3.10",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: End Users/Desktop",
"Topic :: Database",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down
47 changes: 33 additions & 14 deletions sqlite_utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,10 +952,14 @@ def insert_upsert_implementation(
functions=None,
strict=False,
):
convert = _value_or_none(convert)
delimiter = _value_or_none(delimiter)
quotechar = _value_or_none(quotechar)
encoding = _value_or_none(encoding)
bulk_sql = _value_or_none(bulk_sql)
db = sqlite_utils.Database(path)
_load_extensions(db, load_extension)
if functions:
_register_functions(db, functions)
_maybe_register_functions(db, functions)
if (delimiter or quotechar or sniff or no_headers) and not tsv:
csv = True
if (nl + csv + tsv) >= 2:
Expand Down Expand Up @@ -1790,8 +1794,7 @@ def query(
_load_extensions(db, load_extension)
db.register_fts4_bm25()

if functions:
_register_functions(db, functions)
_maybe_register_functions(db, functions)

_execute_query(
db,
Expand Down Expand Up @@ -1917,6 +1920,9 @@ def memory(
\b
sqlite-utils memory animals.csv --schema
"""
sql = _value_or_none(sql)
save = _value_or_none(save)
encoding = _value_or_none(encoding)
db = sqlite_utils.Database(memory=True)

# If --dump or --save or --analyze used but no paths detected, assume SQL query is a path:
Expand Down Expand Up @@ -1990,8 +1996,7 @@ def memory(
_load_extensions(db, load_extension)
db.register_fts4_bm25()

if functions:
_register_functions(db, functions)
_maybe_register_functions(db, functions)

if return_db:
return db
Expand Down Expand Up @@ -3066,14 +3071,14 @@ def wrapped_fn(value):
"geometry_type",
type=click.Choice(
[
"POINT",
"LINESTRING",
"POLYGON",
"MULTIPOINT",
"MULTILINESTRING",
"MULTIPOLYGON",
"GEOMETRYCOLLECTION",
"GEOMETRY",
"point",
"linestring",
"polygon",
"multipoint",
"multilinestring",
"multipolygon",
"geometrycollection",
"geometry",
],
case_sensitive=False,
),
Expand Down Expand Up @@ -3286,3 +3291,17 @@ def _register_functions(db, functions):
for name, value in globals.items():
if callable(value) and not name.startswith("_"):
db.register_function(value, name=name)


def _value_or_none(value):
if getattr(value, "__class__", None).__name__ == "Sentinel":
return None
return value
Comment on lines +3296 to +3299
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex CLI on GPT-5-Codex suggested this as a workaround for:



def _maybe_register_functions(db, functions):
functions = _value_or_none(functions)
if isinstance(functions, (bytes, bytearray)):
functions = functions.decode("utf-8")
if isinstance(functions, str) and functions.strip():
_register_functions(db, functions)
Loading