Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CT-2693] [Feature] Allow debug logs for dbt-databricks #7859

Closed
3 tasks done
susodapop opened this issue Jun 13, 2023 · 5 comments · Fixed by #8643
Closed
3 tasks done

[CT-2693] [Feature] Allow debug logs for dbt-databricks #7859

susodapop opened this issue Jun 13, 2023 · 5 comments · Fixed by #8643
Labels
enhancement New feature or request

Comments

@susodapop
Copy link

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

Add a mapping to enable DEBUG logs for log events from databricks-sql-connector similar to how snowflake.connector is handled today. This will assist in debuggin dbt-databricks issues.

Describe alternatives you've considered

This must be set at the dbt-core level.

Who will this benefit?

Anyone doing technical debugging of performance and behaviour of dbt-databricks.

Are you interested in contributing this feature?

Yes. PR incoming.

Anything else?

No response

@susodapop susodapop added enhancement New feature or request triage labels Jun 13, 2023
@github-actions github-actions bot changed the title [Feature] Allow debug logs for dbt-databricks [CT-2693] [Feature] Allow debug logs for dbt-databricks Jun 13, 2023
@dbeatty10
Copy link
Contributor

Sounds good @susodapop If you share a branch or open a PR with your proposed changes, then we can give it a look.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Jun 13, 2023

The fact that this needs to be set within dbt-core doesn't feel right! Is there any way to put this logic inside the dbt-databricks adapter instead? All we need to do is call logging.getLogger(...).setLevel() — but I understand that this needs to happen at initialization, perhaps before the adapter has been registered/loaded:

dbt-core/core/dbt/logger.py

Lines 500 to 510 in b947b2b

LOG_LEVEL_GOOGLE = _env_log_level("DBT_GOOGLE_DEBUG_LOGGING")
LOG_LEVEL_SNOWFLAKE = _env_log_level("DBT_SNOWFLAKE_CONNECTOR_DEBUG_LOGGING")
LOG_LEVEL_BOTOCORE = _env_log_level("DBT_BOTOCORE_DEBUG_LOGGING")
LOG_LEVEL_HTTP = _env_log_level("DBT_HTTP_DEBUG_LOGGING")
LOG_LEVEL_WERKZEUG = _env_log_level("DBT_WERKZEUG_DEBUG_LOGGING")
logging.getLogger("botocore").setLevel(LOG_LEVEL_BOTOCORE)
logging.getLogger("requests").setLevel(LOG_LEVEL_HTTP)
logging.getLogger("urllib3").setLevel(LOG_LEVEL_HTTP)
logging.getLogger("google").setLevel(LOG_LEVEL_GOOGLE)
logging.getLogger("snowflake.connector").setLevel(LOG_LEVEL_SNOWFLAKE)

@susodapop
Copy link
Author

I agree with your reasoning @jtcohen6. The reason to change it in dbt-core was primarily expediency, since this is where the log level is set for all the other connectors. I'm happy to move this into dbt-databricks assuming it will work that way.

@jtcohen6
Copy link
Contributor

assuming it will work that way

I don't know for sure. If you're able to give it a quick spin and try it out, I'd definitely prefer moving this platform-specific logic into the relevant adapter plugins. If it's too tricky to get working, we already have this (legacy) code in place; I won't stand in the way of adding a teensy bit more for expediency.

@colin-rogers-dbt
Copy link
Contributor

Ran into this same problem for dbt-snowflake so figured we could use a more general solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants