Support for 32/64 bit Python 2.7, 3.6+ on Windows/Linux/Mac.
-
Use
firebird-driverand/orfdb- Python >= 3.8
- SQLAlchemy 1.4 or 2.0
-
Use
fdb- Python == 3.7 and SQLAlchemy 2.0
- Python >= 3.6 and SQLAlchemy 1.4
You may install Python with Chocolatey:
choco install python -yWe strongly recommend Visual Studio Code for development. You may install it with:
choco install vscode -yClone this repository into a local folder on your computer and, from the root folder, run
python -m venv .venv
.venv/Scripts/activate
pip install .[dev]
pip install fdbThis will create a Python virtual environment in .venv subfolder and install all required components.
Open the project folder with VSCode. It should detect the virtual environment automatically and activate it. Please refer to Visual Studio Code documentation on Python for more information.
To activate the virtual environment on a command prompt instance (cmd or powershell) use:
.venv/Scripts/activateClone this repository into a local folder on your computer and, from the root folder, run
python3 -m venv .venv
. .venv/bin/activate
pip install .[dev]
pip install fdbThis will create a Python virtual environment in .venv subfolder and install all required components.
To activate the virtual environment use:
. .venv/bin/activateWith the virtual environment activated, run the following script
rebuild-test-databases
This script will
- Create a
sqlalchemy-firebird-testsin your temp folder containing the binaries for each supported Firebird version; - Create databases for each Firebird version; and
- Add a
[db]section into yoursetup.cfgcontaining one entry for each of the databases created.
You may run this script whenever you need a clean database for your tests. It won't download the files again if they already exist.
Run the following Powershell script
.\run-all-tests.ps1This will start 5 different processes, each one running a different combination of driver/Firebird version supported.
To run only the tests for a specific database, use
.\run-tests.ps1 -Database 'firebird_fb50'SQLAlchemy has a complex test infrastructure which unfortunately is not completely functional from VSCode test runner.
To run a specific test under VSCode debugger this repository already provides a .vscode/launch.json file preconfigured as a sample.
E.g. to run the test test_get_table_names with firebird-driver and Firebird 5.0 you must set pytest arguments as:
"args": ["./test/test_suite.py::NormalizedNameTest::test_get_table_names", "--db", "firebird_fb50"],Now run the code (with F5) and the debugger should work as expected (e.g. set a breakpoint and it should stop).
Sooner or later you probably will need to debug SQLAlchemy code. Fortunately, this is easy as
# [From your 'sqlalchemy-firebird' root folder, inside virtual environment]
pip install -e $path_to_your_sqlalchemy_local_folderThe launch.json file already has the required "justMyCode": false configuration which allows you to step into SQLAlchemy source files during debugging.