Platform-specific dependencies
The dependencies of Ahjo have been split into common dependencies and platform-specific dependencies. Command `pip install ahjo` will install only the common dependencies. In order to use Ahjo with the database engine of your choice, install platform-specific dependencies using available tags. For example, if you use Ahjo with Microsoft SQL Server, use tag `mssql` to install required dependencies.
Common dependencies
- alembic
- commentjson
- pyparsing
- sqlalchemy
Platform-specific dependencies (and available platform tags)
- mssql
- pyodbc
this command installs Ahjo and common dependencies
pip install ahjo
this command installs Ahjo, common dependencies and mssql depenendecies (pyodbc)
pip install ahjo[mssql]
Support for three different Azure AD authentication methods
Added new (optional) variable `azure_authentication` to config.
Possible values:
- "ActiveDirectoryPassword" (Username and password)
- "ActiveDirectoryInteractive" (MFA - username given to Ahjo, password and single sign-on code are given interactively to driver)
- "ActiveDirectoryIntegrated" (Similar to windows authentication/trusted connection)
Notice, that Azure AD authentication is fully supported only by the latest ODBC Driver for SQL Server (ODBC Driver 17 for SQL Server).
Partially replace SQLCMD
To fully enable support for Azure AD authentication in Ahjo, SQLCMD had to be at least partially replaced. The problems with SQLCMD included:
- Every single time SQLCMD was called, a new connection and authentication to database was made
- When in use, MFA had to be executed for every single deployed object
- If you mistyped your password, deploy would spam your credentials to database n*n times, where n is the amount of deployed objects
- This sometimes resulted to user to be locked from database
- SQLCMD is a Microsoft SQL Server specific tool
In this version, SQLCMD has been partially replaced with a solution (`ahjo.database_utilities.sqla_utilities.execute_from_file`) that splits SQL stored in file into batches and executes the batches with SQL Alchemy. This solution solves the problems listed above.
- In `deploy_sqlfiles`, the loop logic is the same, but SQLCMD execution (`ahjo.database_utilities.sqlcmd.invoke_sqlcmd`) is replaced with `ahjo.database_utilities.sqla_utilities.execute_from_file`
- `sqlfiles.py`moved from `operations/tsql` to `operations/general`
- No significant effect to end-user, since all operations can be imported from `ahjo.operations`
Type hints
Added type hints to all modules.