Skip to main content

Drop-in Qt-based replacement for the sqlite3 module

Project description

PyPI PyPI - Status PyPI - Python Version GitHub License

About SQLite3-Qt

A drop-in module for Python’s sqlite3 built-in module, providing basic functionality via Qt SQL module. The goal is to enable the creation of a SQL backend module which can support both script and UI frontends.

Installation

Install using pip:

pip install sqlite3-qt

Features

  • Supports the basic database operations including binding values. (See below for supported sqlite3 classes and functions.)

  • API to mimic built-in sqlite3 module to enable easy swapping:

    # import sqlite3              # default import
    import sqlite3_qt as sqlite3  # drop-in replacement without any change in the code
    
    ...
  • Underlying Qt Database connection name is auto-generated and transparent

  • Access Qt’s QSqlDatabase name and QSqlQuery objects

    sqlite3_qt.Connection.qt_name # to get the QSqlDatabase name
    sqlite3_qt.Cursor.qt_query # to access the underlying QSqlQuery object
  • Auto-detect PyQt6 / PySide6 / PyQt5 / PySide2 (PySide2 fails the Github CI test)

Compatibility Table

Unfortunately, not all features of Python’s sqlite3 built-in module can be supported by Qt SQL module. The table below summarizes which sqlite3 functions/classes are currently supported.

sqlite3 functions and classes

Supported?

sqlite3.connect(

Partially

  database,

Yes

  timeout,

Yes

  detect_types,

No

  isolation_level,

No

  check_same_thread,

No

  factory,

Yes

  cached_statements,

No

  uri,

Yes

  autocommit)

No

class sqlite3.Connection

Yes

  cursor()

Yes

  blobopen()

No

  commit()

Yes

  rollback()

Yes

  close()

Yes

  execute()

Yes

  executemany()

Yes

  executescript()

Yes

  create_function()

No

  create_aggregate()

No

  create_window_function()

No

  create_collation()

No

  interrupt()

No

  set_authorizer()

No

  set_progress_handler()

No

  set_trace_callback()

No

  enable_load_extension()

No

  load_extension()

No

  iterdump()

No

  backup()

No

  getlimit()

No

  setlimit()

No

  getconfig()

No

  setconfig()

No

  serialize()

No

  deserialize()

No

  autocommit

??

  in_transaction

No

  isolation_level

No

  row_factory

Yes

  text_factory

Yes

  total_changes

No

class sqlite3.Cursor

Yes

  execute()

Yes

  executemany()

Yes

  executescript()

Yes

  fetchone()

Yes

  fetchmany()

Yes

  fetchall()

Yes

  close()

Yes

  setinputsizes()

No

  setoutputsize()

No

  arraysize

Yes

  connection

Yes

  description

Yes

  lastrowid

Yes

  rowcount

Yes

  row_factory

Yes

class sqlite3.Row

Yes

  keys()

Yes

class sqlite3.Blob

No

sqlite3.complete_statement()

No

sqlite3.enable_callback_tracebacks()

No

sqlite3.register_adapter()

No (TODO)

sqlite3.register_converter()

No (TODO)

sqlite3.apilevel

No

sqlite3.paramstyle

No

sqlite3.sqlite_version

Yes

sqlite3.sqlite_version_info

Yes

sqlite3.threadsafety

No

sqlite3.version

Yes

sqlite3.version_info

Yes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlite3-qt-0.1.0.tar.gz (27.3 kB view hashes)

Uploaded Source

Built Distribution

sqlite3_qt-0.1.0-py3-none-any.whl (25.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page