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

Remove SQLAlchemy dependency #1252

Merged
merged 4 commits into from
Jun 6, 2024
Merged

Remove SQLAlchemy dependency #1252

merged 4 commits into from
Jun 6, 2024

Conversation

plypaul
Copy link
Contributor

@plypaul plypaul commented Jun 6, 2024

Description

The SQLAlchemy dependency is only needed because we need to parse the URL for the SQL engine configuration. Since it's relatively straightforward to parse, this PR uses built-in urllib to do the parsing and removes the SQLAlchemy dependency.

@cla-bot cla-bot bot added the cla:yes label Jun 6, 2024
@plypaul plypaul added Run Tests With Other SQL Engines Runs the test suite against the SQL engines in our target environment and removed cla:yes labels Jun 6, 2024
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 00:52 — with GitHub Actions Failure
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 00:52 — with GitHub Actions Failure
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 00:52 — with GitHub Actions Failure
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 00:52 — with GitHub Actions Failure
@cla-bot cla-bot bot added the cla:yes label Jun 6, 2024
@plypaul plypaul added Run Tests With Other SQL Engines Runs the test suite against the SQL engines in our target environment and removed Run Tests With Other SQL Engines Runs the test suite against the SQL engines in our target environment labels Jun 6, 2024
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 00:54 — with GitHub Actions Failure
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 00:54 — with GitHub Actions Failure
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 00:54 — with GitHub Actions Failure
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 00:54 — with GitHub Actions Failure
@plypaul plypaul added Run Tests With Other SQL Engines Runs the test suite against the SQL engines in our target environment and removed Run Tests With Other SQL Engines Runs the test suite against the SQL engines in our target environment labels Jun 6, 2024
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 01:29 — with GitHub Actions Failure
@plypaul plypaul temporarily deployed to DW_INTEGRATION_TESTS June 6, 2024 01:29 — with GitHub Actions Inactive
@plypaul plypaul had a problem deploying to DW_INTEGRATION_TESTS June 6, 2024 01:29 — with GitHub Actions Failure
@plypaul plypaul temporarily deployed to DW_INTEGRATION_TESTS June 6, 2024 01:29 — with GitHub Actions Inactive
@plypaul plypaul added Run Tests With Other SQL Engines Runs the test suite against the SQL engines in our target environment and removed Run Tests With Other SQL Engines Runs the test suite against the SQL engines in our target environment labels Jun 6, 2024
@plypaul plypaul temporarily deployed to DW_INTEGRATION_TESTS June 6, 2024 02:00 — with GitHub Actions Inactive
@plypaul plypaul temporarily deployed to DW_INTEGRATION_TESTS June 6, 2024 02:00 — with GitHub Actions Inactive
@plypaul plypaul temporarily deployed to DW_INTEGRATION_TESTS June 6, 2024 02:00 — with GitHub Actions Inactive
@plypaul plypaul temporarily deployed to DW_INTEGRATION_TESTS June 6, 2024 02:00 — with GitHub Actions Inactive
@github-actions github-actions bot removed the Run Tests With Other SQL Engines Runs the test suite against the SQL engines in our target environment label Jun 6, 2024
@plypaul plypaul marked this pull request as ready for review June 6, 2024 02:24
@tlento tlento self-requested a review June 6, 2024 03:32
Copy link
Contributor

@tlento tlento left a comment

Choose a reason for hiding this comment

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

Nice, thank you!

"""Populates default env var mapping from a sqlalchemy URL string.

This is used to configure the test environment from the original MF_SQL_ENGINE_URL environment variable in
a manner compatible with the dbt profile configurations laid out for most supported engines. We return
the parsed URL object so that individual engine configurations can override the environment variables
as needed to match their dbt profile configuration.
"""
parsed_url = sqlalchemy.engine.make_url(url)
# parsed_url = sqlalchemy.engine.make_url(url)
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.


* This implementation is used to avoid having to specify SQLAlchemy as a dependency.
* Databricks has a URL with a semicolon that separates an additional parameter. e.g.
`databricks://host:port/database;http_path=a/b/c`. Need additional context for why this is done.
Copy link
Contributor

Choose a reason for hiding this comment

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

Our original Databricks client was built before they added an officially supported SQLAlchemy client, so we used the JDBC connection URI. https://docs.databricks.com/en/integrations/jdbc/authentication.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in comment.

* Databricks has a URL with a semicolon that separates an additional parameter. e.g.
`databricks://host:port/database;http_path=a/b/c`. Need additional context for why this is done.
"""
url_seperator = ";"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
url_seperator = ";"
url_separator = ";"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@plypaul plypaul enabled auto-merge (squash) June 6, 2024 06:58
@plypaul plypaul merged commit 72aaec0 into main Jun 6, 2024
14 checks passed
@plypaul plypaul deleted the p--py312--15 branch June 6, 2024 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants