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

Add invocation env to user agent string #367

Merged
merged 4 commits into from
Jun 8, 2022
Merged

Conversation

jtcohen6
Copy link
Contributor

@jtcohen6 jtcohen6 commented Jun 3, 2022

Companion PR: databricks/dbt-databricks#106

Description

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-spark next" section.

@cla-bot cla-bot bot added the cla:yes label Jun 3, 2022
f"dbt-labs-dbt-spark/{dbt_spark_version} (Databricks)" # noqa
)
dbt_invocation_env = os.getenv(DBT_INVOCATION_ENV) or "manual"
user_agent_entry = f"dbt-labs-dbt-spark/{dbt_spark_version} (Databricks) ({dbt_invocation_env})" # noqa
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration tests don't like this!

Runtime Error
E                   ('HY000', "[HY000] [unixODBC][Simba][DriverSupport] (2021) Invalid character ')' found in user-agent comment. (2021) (SQLDriverConnect)")

@ueshin Any chance you could advise here? This is an ODBC user agent, maybe the two sets of parens aren't allowed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, seems like they are not allowed for now. I'm not sure it's a bug or expected, though.
How about using a different pattern like f"dbt-labs-dbt-spark/{dbt_spark_version} (Databricks; {dbt_invocation_env})"?

Copy link
Contributor

@dataders dataders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming that I'm understanding the use case for this is primarily for dbt Cloud telemetry, then I approve!

@jtcohen6 jtcohen6 merged commit ca1b5b6 into main Jun 8, 2022
@jtcohen6 jtcohen6 deleted the jerco/user-agent-inv-env branch June 8, 2022 07:33
jtcohen6 added a commit that referenced this pull request Jun 29, 2022
@jtcohen6 jtcohen6 mentioned this pull request Jun 29, 2022
jtcohen6 added a commit that referenced this pull request Jun 29, 2022
jtcohen6 added a commit that referenced this pull request Jun 30, 2022
francescomucio pushed a commit to francescomucio/dbt-spark that referenced this pull request Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants