I’m trying to run dbt within an Azure serverless function. Currently our organization has a policy to use only Azure functions, without the use of containers.
I’m running into problem getting the repository of the dbt project available to the function without having a container.
Is there a way to do this and run dbt from an Azure function without containers ?
You can now run this script with Azure SQL and dbt-sqlserver since they now support dbt-core >= 1.5
from dbt.cli.main import dbtRunner, dbtRunnerResult
run_list = ["run"]
dbt = dbtRunner()
res: dbtRunnerResult = dbt.invoke(run_list)
# inspect the results
for r in res.result:
print(f"{r.node.name}: {r.status}")
If you package your Azure function carefully and correctly embed your dbt_project.yml, profiles.yml and models/ folders you might be able dbtRunner.
BUT,
There is one major problem that during the process the script writes in the target/ folder, and your are not allowed to write on the filesystem while running an Azure Function.
Maybe on Azure Container Instances it should work.