Skip to content

CloudSqlDatabaseHook wrong error message on missing host (public IP) #58808

@pierresegonne

Description

@pierresegonne

Apache Airflow version

3.1.3

If "Other Airflow 2/3 version" selected, which one?

No response

What happened?

When instantiating a CloudSqlDatabaseHook here we can see that the public_ip attribute gets populated from the host provided in the connection.

I'm using a Cloud SQL Database connection, originally without a host.

This then leads to here where an error will be raised.

The error message "The location parameter needs to be set in connection" is incorrect and misleading. It should say something related to the public IP / host being missing.

What you think should happen instead?

The error message should say "The host needs to be set in connection" OR "The public IP derived from the host set in connection is missing"

How to reproduce

  1. Create a "Cloud SQL Database" connection in airflow without a host
  2. Use a DAG with a CloudSQLExecuteQueryOperator referencing to that connection with the gcp_cloudsql_conn_id parameter
  3. Voilaa

Operating System

OS X 14.4.1 (23E224)

Versions of Apache Airflow Providers

19.1

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions