Skip to main content

Firebird RDBMS bindings for python.

Project description

https://img.shields.io/pypi/v/firebirdsql.png https://img.shields.io/pypi/l/firebirdsql.png

firebirdsql package is a set of Firebird RDBMS (https://firebirdsql.org/) bindings for Python (Written in pure Python : no C compiler needed or fbclient library)

see https://pyfirebirdsql.readthedocs.io/en/latest/

It works on Python 2.7 and 3.8+.

But if you want to use the timezone feature of Firebird 4.0 …

Example

Python Database API Specification v2.0

https://peps.python.org/pep-0249/

import firebirdsql
conn = firebirdsql.connect(
    host='localhost',
    database='/foo/bar.fdb',
    port=3050,
    user='alice',
    password='secret'
)
cur = conn.cursor()
cur.execute("select * from baz")
for c in cur.fetchall():
    print(c)
conn.close()

asyncio

In Python3, you can use asyncio to write the following.

This API is experimental. If there are any mistakes, please correct them in the pull request and send.

Use connect

import asyncio
import firebirdsql

async def conn_example():
    conn = await firebirdsql.aio.connect(
        host='localhost',
        database='/foo/bar.fdb',
        port=3050,
        user='alice',
        password='secret'
    )
    cur = conn.cursor()
    await cur.execute("select * from baz")
    print(await cur.fetchall())
asyncio.run(conn_example())

Use pool

import asyncio
import firebirdsql

async def pool_example(loop):
    pool = await firebirdsql.aio.create_pool(
        host='localhost',
        database='/foo/bar.fdb',
        port=3050,
        user='alice',
        password='secret'
        loop=loop,
    )
    async with pool.acquire() as conn:
        async with conn.cursor() as cur:
            await cur.execute("select * from baz")
            print(await cur.fetchall())
    pool.close()
    await pool.wait_closed()

loop = asyncio.get_event_loop()
loop.run_until_complete(pool_example(loop))
loop.close()

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-1.3.2.tar.gz (80.9 kB view details)

Uploaded Source

File details

Details for the file firebirdsql-1.3.2.tar.gz.

File metadata

  • Download URL: firebirdsql-1.3.2.tar.gz
  • Upload date:
  • Size: 80.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for firebirdsql-1.3.2.tar.gz
Algorithm Hash digest
SHA256 b12dc7b1e0622d313bda764891be79bc9655d5b3a0249ec83ef96de323473799
MD5 19241a3f5f1de4d641abbe192a7d6b93
BLAKE2b-256 18e0076343293e30b960b5f1faf5e1d46de6bebb647600800a5928b6a681d36d

See more details on using hashes here.

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