Skip to main content

Firebirdsql wrapper inspired by subprocess.run

Project description

firebirdsql-run

Firebirdsql wrapper inspired by subprocess.run

PyPI: Version GitHub: Release Documentation CI: pre-commit CI: Main CI: Coverage

InstallationExamplesEnv Variables

Installation

pip install firebirdsql-run
# or
poetry add firebirdsql-run

Examples

Execute a query with read-only access:

from firebirdsql_run import DBAccess, execute

# Execute a query with read-only access.
result = execute(query="SELECT * FROM table", db="database", access=DBAccess.READ_ONLY)

# Output: List of dictionaries containing the query results.
print(result.data)

Execute a query with parameters and log the result:

# Execute a query with parameters.
result = execute(query="INSERT INTO customers (name, age) VALUES (?, ?)", params=("John", 25))

# Log the result.
if result.returncode != 0:
    logger.error(result)
else:
    logger.info(result)

Execute a query using the existing connection:

# Create a connection object.
conn = connection(db="database", access=DBAccess.READ_ONLY)
# Execute a query using the existing connection.
result = execute(query="SELECT * FROM table", use_conn=conn)
# Close the connection.
conn.close()

# Output: Named tuple representing the completed transaction.
print(result)

An example of a successful transaction:

>>> print(result)
CompletedTransaction(
    host="127.0.0.1",
    db="database",
    user="TWUSER",
    access="READ_ONLY",
    returncode=0,
    exception="",
    query="SELECT * FROM table",
    params=(),
    time=0.001,
    data=[
        {'id': 1, 'name': 'John Doe', 'department': 'Sales'},
        {'id': 2, 'name': 'Jane Smith', 'department': 'Sales'},
    ],
)

An example of a failed transaction:

>>> print(result)
CompletedTransaction(
    host="127.0.0.1",
    db="database",
    user="TWUSER",
    access="READ_ONLY",
    returncode=1,
    exception="Dynamic SQL Error\nSQL error code = -204\nTable unknown\ntable\nAt line 1, column 15\n",
    query="SELECT * FROM table",
    params=(),
    time=0.001,
    data=[],
)

Env Variables

FIREBIRD_KEY=

The FIREBIRD_KEY environment variable can be overridden with the functions argument passwd.

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

firebirdsql_run-1.2.1.tar.gz (80.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

firebirdsql_run-1.2.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file firebirdsql_run-1.2.1.tar.gz.

File metadata

  • Download URL: firebirdsql_run-1.2.1.tar.gz
  • Upload date:
  • Size: 80.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for firebirdsql_run-1.2.1.tar.gz
Algorithm Hash digest
SHA256 93709e47cf8597a91835eec4d394fe73e7173b1596639ab94f5601da7f28b271
MD5 a6e4508877cb568ba315cac3513e1551
BLAKE2b-256 21d0b1732c6cb3998e67c3f9c5ae91aaa062f2e7734e475a16919387aa1b53a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for firebirdsql_run-1.2.1.tar.gz:

Publisher: main.yml on deadnews/firebirdsql-run

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file firebirdsql_run-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for firebirdsql_run-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8444503c514fc288d69e815e134c586830af7de2076ed22da7c14c20328b172
MD5 2bb840286f14118f81e8747c725037ef
BLAKE2b-256 06007e4147a9428c9c9ca99346f1ab14076d8db6a66da4458ca47220359ea5fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for firebirdsql_run-1.2.1-py3-none-any.whl:

Publisher: main.yml on deadnews/firebirdsql-run

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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