fal-ai / dbt-fal

do more with dbt. dbt-fal helps you run Python alongside dbt, so you can send Slack alerts, detect anomalies and build machine learning models.
https://fal.ai/dbt-fal
Apache License 2.0
853 stars 72 forks source link

DEBUG level logs shown and can't change log level #904

Closed psimm closed 9 months ago

psimm commented 9 months ago

Describe the bug Please describe the issue.

Your environment

dbt --version

Core:

How to reproduce

Use logging.info() in a Python dbt model

import logging
import pandas as pd

def model(dbt, fal):
    logging.info("Running Python model")

    return pd.DataFrame({
        "id": [1, 2, 3],
        "name": ["foo", "bar", "baz"]
    })

Expected behavior INFO level logs shown

Actual behavior DEBUG level logs shown, making it hard to follow the log. Setting a different log level using logging.basicConfig() doesn't fix it.

psimm commented 9 months ago

I've looked into this again and was able to fix it for me with logging.getLogger("file_log").setLevel(logging.WARNING). It's not a bug in dbt-fal, just my misunderstanding of how logging works.