Metadata-Version: 2.4
Name: sqlalchemy-firebird
Version: 2.2.0
Summary: Firebird for SQLAlchemy
Author-email: "F.D.Castel" <fdcastel@gmail.com>
Maintainer-email: "F.D.Castel" <fdcastel@gmail.com>
License: Copyright 2005-2023 SQLAlchemy authors and contributors <see AUTHORS file>.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the "Software"), to deal in
        the Software without restriction, including without limitation the rights to
        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
        of the Software, and to permit persons to whom the Software is furnished to do
        so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Documentation, https://github.com/fdcastel/sqlalchemy-firebird/wiki
Project-URL: Source, https://github.com/fdcastel/sqlalchemy-firebird
Project-URL: Tracker, https://github.com/fdcastel/sqlalchemy-firebird/issues
Keywords: SQLAlchemy,Firebird,firebird-driver
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Database :: Front-Ends
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS
Requires-Dist: SQLAlchemy>=2.0
Requires-Dist: firebird-driver
Requires-Dist: packaging
Dynamic: license-file

# sqlalchemy-firebird

An external [SQLAlchemy](https://www.sqlalchemy.org) dialect for the [Firebird](https://firebirdsql.org/en/start/) database server.

This package targets **SQLAlchemy 2.0+** and **Firebird 3.0+**, using the modern [`firebird-driver`](https://pypi.org/project/firebird-driver/) Python DB-API 2.0 driver.

## Installation

```
pip install sqlalchemy-firebird
```

This installs SQLAlchemy 2.0+ and `firebird-driver` automatically. Python 3.9 or newer is required.

## Connection strings

A SQLAlchemy URL has the shape `dialect+driver://username:password@host:port/database`. For Firebird:

```
firebird+firebird://<username>:<password>@<host>:<port>/<database_path>[?charset=UTF8&key=value&...]
```

Useful query parameters:

- `charset` — character set used by the database file (Firebird default is `UTF8`).
- `fb_client_library` — full path to the Firebird client library (`libfbclient.so` on Linux, `fbclient.dll` on Windows). Only needed when using an embedded server or a non-default client install.

### Examples

Local server, default port:

```
[Linux]
firebird+firebird://sysdba:masterkey@localhost///home/me/databases/my_project.fdb

[Windows]
firebird+firebird://sysdba:masterkey@localhost/c:/databases/my_project.fdb
```

Remote server on port 3040 with explicit charset and client library:

```
[Linux]
firebird+firebird://sysdba:masterkey@example.com:3040///srv/databases/my_project.fdb?charset=UTF8&fb_client_library=/opt/firebird/lib/libfbclient.so

[Windows]
firebird+firebird://sysdba:masterkey@example.com:3040/c:/databases/my_project.fdb?charset=UTF8&fb_client_library=c:/firebird/fbclient.dll
```

Embedded server:

```
[Linux]
firebird+firebird://sysdba@///home/me/databases/my_project.fdb?charset=UTF8&fb_client_library=/opt/firebird/lib/libfbclient.so

[Windows]
firebird+firebird://sysdba@/c:/databases/my_project.fdb?charset=UTF8&fb_client_library=c:/firebird/fbclient.dll
```

## Usage

```python
from sqlalchemy import create_engine

db_uri = "firebird+firebird://sysdba@/c:/databases/my_project.fdb?charset=UTF8&fb_client_library=c:/firebird/fbclient.dll"
engine = create_engine(db_uri, echo=True)

# Force the engine to connect, surfacing any URL or driver issues immediately.
with engine.begin():
    pass
```

## Code of Conduct

This project follows the SQLAlchemy [Code of Conduct](http://www.sqlalchemy.org/codeofconduct.html).

## License

Distributed under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
