Sqlite

A clearskies SQLite cursor configured from environment variables.

  1. Overview
  2. database_environment_key
  3. autocommit_environment_key
  4. connect_timeout_environment_key

Overview

This class provides a SQLite cursor implementation that reads connection parameters from environment variables, making it easy to configure for different environments. It supports all features of the base Sqlite class.

Environment Variable Keys

The following environment variables are used by default (can be overridden):

  • DATABASE_NAME: Path or name of the SQLite database file.
  • DATABASE_AUTOCOMMIT: Autocommit setting (optional).
  • DATABASE_CONNECT_TIMEOUT: Connection timeout (optional).

Example

import clearskies

cursor = clearskies.cursors.from_environment.Sqlite()
cursor.execute("SELECT * FROM users")
results = cursor.fetchall()

database_environment_key

Optional

Environment variable key for the SQLite database file path or name.

autocommit_environment_key

Optional

Environment variable key for the autocommit setting (optional).

connect_timeout_environment_key

Optional

Environment variable key for the connection timeout (optional).