Skip to content

Commit ff71fbb

Browse files
committed
Remove redundant location parameter from list_datasets and its callers
1 parent eb488fe commit ff71fbb

5 files changed

Lines changed: 8 additions & 17 deletions

File tree

dataproc_jupyter_plugin/controllers/bigquery.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ async def get(self):
5454
try:
5555
page_token = self.get_argument("pageToken")
5656
project_id = self.get_argument("project_id")
57-
location = self.get_argument("location", default="us").lower()
5857
bq_client = await bigquery_client.get_client(self.log)
59-
dataset_list = await bq_client.list_datasets(page_token, project_id, location)
58+
dataset_list = await bq_client.list_datasets(page_token, project_id)
6059
self.finish(json.dumps(dataset_list))
6160
except Exception as e:
6261
self.log.exception("Error fetching datasets")

dataproc_jupyter_plugin/services/bigquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def create_headers(self):
4848
"Authorization": f"Bearer {self._access_token}",
4949
}
5050

51-
async def list_datasets(self, page_token, project_id, location):
51+
async def list_datasets(self, page_token, project_id):
5252
try:
5353
if project_id == BQ_PUBLIC_DATASET_PROJECT_ID:
5454
# Use BigQuery API for public datasets

dataproc_jupyter_plugin/tests/test_bigquery.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ async def test_list_datasets_public_with_page_token(
9090
client = Client(mock_credentials, mock_log, mock_client_session)
9191
result = await client.list_datasets(
9292
page_token="next-page",
93-
project_id=BQ_PUBLIC_DATASET_PROJECT_ID,
94-
location="us"
93+
project_id=BQ_PUBLIC_DATASET_PROJECT_ID
9594
)
9695

9796
expected_url = f"https://bigquery.googleapis.com/bigquery/v2/projects/{BQ_PUBLIC_DATASET_PROJECT_ID}/datasets?maxResults={PAGE_SIZE_LIMIT}&pageToken=next-page"
@@ -115,8 +114,7 @@ async def test_list_datasets_user_specific(
115114
client = Client(mock_credentials, mock_log, mock_client_session)
116115
result = await client.list_datasets(
117116
page_token=None,
118-
project_id="my-project-123",
119-
location="us"
117+
project_id="my-project-123"
120118
)
121119

122120
expected_url = f"https://dataplex.googleapis.com/v1/projects/mock-project-id/locations/global:searchEntries"
@@ -145,8 +143,7 @@ async def test_list_datasets_api_error(
145143
client = Client(mock_credentials, mock_log, mock_client_session)
146144
result = await client.list_datasets(
147145
page_token=None,
148-
project_id="my-project-123",
149-
location="us"
146+
project_id="my-project-123"
150147
)
151148

152149
assert result["error"] == "Error response from Dataplex: Forbidden Permission denied"

dataproc_jupyter_plugin/tests/test_bigquery_edge_cases.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ async def test_list_datasets_null_results(
4747
client = Client(mock_credentials, mock_log, mock_client_session)
4848
result = await client.list_datasets(
4949
page_token=None,
50-
project_id="my-project-123",
51-
location="us"
50+
project_id="my-project-123"
5251
)
5352
assert result == {"entries": [], "nextPageToken": None}
5453

@@ -71,8 +70,7 @@ async def test_list_datasets_filter_missing_dataplex_entry(
7170
client = Client(mock_credentials, mock_log, mock_client_session)
7271
result = await client.list_datasets(
7372
page_token=None,
74-
project_id="my-project-123",
75-
location="us"
73+
project_id="my-project-123"
7674
)
7775
assert result["entries"] == [{"name": "entry1"}]
7876

src/bigQuery/bigQueryService.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,8 @@ export class BigQueryService {
147147
if (notebookValue) {
148148
const pageToken = nextPageToken ?? '';
149149
try {
150-
const settings = await settingRegistry.load(PLUGIN_ID);
151-
const location = settings.get('bqRegion')['composite']
152-
153150
const data: any = await requestAPI(
154-
`bigQueryDataset?project_id=${projectId}&location=${location}&pageToken=${pageToken}`
151+
`bigQueryDataset?project_id=${projectId}&pageToken=${pageToken}`
155152
);
156153
if (!(data.entries || data.datasets)) {
157154
setDataSetResponse([]);

0 commit comments

Comments
 (0)