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

unit test error: jsonschema.exceptions.ValidationError: 'database' is a required property #469

Closed
dataders opened this issue Oct 2, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@dataders
Copy link
Contributor

dataders commented Oct 2, 2023

Background

somehow, dbt-labs/dbt-core#8437 has caused a dbt-databricks unit test to fail with the below strange message. Here's a gist of the failure message I saw locally (TODO add link to GHA tox log)

jsonschema.exceptions.ValidationError: 'database' is a required property

I’m confused bc, AFAICT, database is defined as optional within the DatabricksCredentials dataclass.

class DatabricksCredentials(Credentials):
database: Optional[str] # type: ignore[assignment]

It seems as if I was able to fix this by adding "database": os.getenv("DBT_DATABRICKS_DB_NAME"), to the profile dict definition

"host": os.getenv("DBT_DATABRICKS_HOST_NAME"),
"http_path": http_path,
"token": os.getenv("DBT_DATABRICKS_TOKEN"),
"client_id": os.getenv("DBT_DATABRICKS_CLIENT_ID"),

Adding to my confusion is that the failing unit test, TestDatabricksAdapter.test_databricks_sql_connector_connection, looks to based upon dbt-spark’s TestSparkAdapter.test_http_connection() unit test. Both tests are of a format unfamiliar to me and structured differently than dbt-snowflake's TestSnowflakeAdapter, for example.

Questions

  1. where in the unit test is profile validation happening?
  2. why did this not happen before?
  3. are the unit tests of dbt-databricks (therefore dbt-spark) out-of-date, or not best practice?
@dataders dataders added the bug Something isn't working label Oct 2, 2023
@dataders
Copy link
Contributor Author

dataders commented Oct 2, 2023

nevermind!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant