================
PyfirebirdSQL
================
.. image:: https://img.shields.io/pypi/v/firebirdsql.png
:target: https://pypi.python.org/pypi/firebirdsql
.. image:: 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 ...
- Not supported by python2.7
- Python 3.8 requires backports.zoneinfo https://pypi.org/project/backports.zoneinfo/ install
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()
Raw data
{
"_id": null,
"home_page": "http://github.com/nakagami/pyfirebirdsql/",
"name": "firebirdsql",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Firebird",
"author": "Hajime Nakagami",
"author_email": "nakagami@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/18/e0/076343293e30b960b5f1faf5e1d46de6bebb647600800a5928b6a681d36d/firebirdsql-1.3.2.tar.gz",
"platform": null,
"description": "================\nPyfirebirdSQL\n================\n\n.. image:: https://img.shields.io/pypi/v/firebirdsql.png\n :target: https://pypi.python.org/pypi/firebirdsql\n\n.. image:: https://img.shields.io/pypi/l/firebirdsql.png\n\nfirebirdsql package is a set of Firebird RDBMS (https://firebirdsql.org/) bindings for Python (Written in pure Python : no C compiler needed or fbclient library)\n\n\nsee https://pyfirebirdsql.readthedocs.io/en/latest/\n\nIt works on Python 2.7 and 3.8+.\n\nBut if you want to use the timezone feature of Firebird 4.0 ...\n\n- Not supported by python2.7\n- Python 3.8 requires backports.zoneinfo https://pypi.org/project/backports.zoneinfo/ install\n\nExample\n-----------\n\nPython Database API Specification v2.0\n+++++++++++++++++++++++++++++++++++++++++\n\nhttps://peps.python.org/pep-0249/\n::\n\n import firebirdsql\n conn = firebirdsql.connect(\n host='localhost',\n database='/foo/bar.fdb',\n port=3050,\n user='alice',\n password='secret'\n )\n cur = conn.cursor()\n cur.execute(\"select * from baz\")\n for c in cur.fetchall():\n print(c)\n conn.close()\n\n\nasyncio\n++++++++++++++++++++++++++++++++++++++\n\nIn Python3, you can use asyncio to write the following.\n\nThis API is experimental.\nIf there are any mistakes, please correct them in the pull request and send.\n\nUse connect\n::\n\n import asyncio\n import firebirdsql\n\n async def conn_example():\n conn = await firebirdsql.aio.connect(\n host='localhost',\n database='/foo/bar.fdb',\n port=3050,\n user='alice',\n password='secret'\n )\n cur = conn.cursor()\n await cur.execute(\"select * from baz\")\n print(await cur.fetchall())\n asyncio.run(conn_example())\n\nUse pool\n::\n\n import asyncio\n import firebirdsql\n\n async def pool_example(loop):\n pool = await firebirdsql.aio.create_pool(\n host='localhost',\n database='/foo/bar.fdb',\n port=3050,\n user='alice',\n password='secret'\n loop=loop,\n )\n async with pool.acquire() as conn:\n async with conn.cursor() as cur:\n await cur.execute(\"select * from baz\")\n print(await cur.fetchall())\n pool.close()\n await pool.wait_closed()\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(pool_example(loop))\n loop.close()",
"bugtrack_url": null,
"license": "BSD",
"summary": "Firebird RDBMS bindings for python.",
"version": "1.3.2",
"project_urls": {
"Homepage": "http://github.com/nakagami/pyfirebirdsql/"
},
"split_keywords": [
"firebird"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "18e0076343293e30b960b5f1faf5e1d46de6bebb647600800a5928b6a681d36d",
"md5": "19241a3f5f1de4d641abbe192a7d6b93",
"sha256": "b12dc7b1e0622d313bda764891be79bc9655d5b3a0249ec83ef96de323473799"
},
"downloads": -1,
"filename": "firebirdsql-1.3.2.tar.gz",
"has_sig": false,
"md5_digest": "19241a3f5f1de4d641abbe192a7d6b93",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 80925,
"upload_time": "2024-10-11T03:09:46",
"upload_time_iso_8601": "2024-10-11T03:09:46.536600Z",
"url": "https://files.pythonhosted.org/packages/18/e0/076343293e30b960b5f1faf5e1d46de6bebb647600800a5928b6a681d36d/firebirdsql-1.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-11 03:09:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nakagami",
"github_project": "pyfirebirdsql",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "firebirdsql"
}