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: location support when connecting bigquery #10453

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

Fraggle
Copy link
Contributor

@Fraggle Fraggle commented Jan 31, 2025

Description

Add location selection (if needed) when connecting to BigQuery as it's not possible to do join between regions.
Store the location in the credentials to make it easy to retrieve from core.

Tests

Tested locally + added tests and updated tests.

Risk

Low as we are only touching the bigquery part.

Deploy Plan

Deploy connectors, oauth, front

@Fraggle Fraggle requested a review from fontanierh January 31, 2025 18:38
@Fraggle Fraggle force-pushed the sflory-add-region-in-credentials branch from e2e0649 to 5f216ce Compare January 31, 2025 18:41
@@ -68,7 +73,7 @@ export class BigQueryConnectorManager extends BaseConnectorManager<null> {
}): Promise<Result<string, ConnectorManagerError<CreateConnectorErrorCode>>> {
const credentialsRes = await getCredentials({
credentialsId: connectionId,
isTypeGuard: isBigQueryCredentials,
isTypeGuard: isBigQueryWithLocationCredentials,
Copy link
Contributor

Choose a reason for hiding this comment

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

No strong opinion here, but do we really need WithLocation in the name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like to be consistent with the type name (and have 2 types one with location, the other without).

@@ -89,6 +92,14 @@ export const fetchDatasets = async ({
return new Ok(
removeNulls(
datasets.map((dataset) => {
// We want to filter out datasets that are not in the same location as the credentials.
// But, for example, we want to keep dataset in "us-central1" when selected location is "us"
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure of this ? I thought to use a us-central1 dataset, you absolutely needed to run the query on us-central1 ? My understanding was the opposite --
If you're running the query on us-central1 then you get to also use the US multi-regional datasets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the current tables based locations: If i had tables in uscentral-1 in a dataset set in us and the user selected us-central1 it would not show with an exact filter on the dataset location.

I based the location options from the tables locations, maybe it's wrong and we should define the choices on the dataset's locations only.

It's something I wanted to test asap.

@@ -147,6 +158,12 @@ export const fetchTables = async ({
return new Ok(
removeNulls(
tables.map((table) => {
// We want to filter out tables that are not in the same location as the credentials.
// But, for example, we want to keep tables in "us-central1" when selected location is "us"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, I understood the opposite.

@Fraggle Fraggle merged commit e9912b3 into main Feb 3, 2025
5 checks passed
@Fraggle Fraggle deleted the sflory-add-region-in-credentials branch February 3, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants