mirror of https://github.com/buster-so/buster.git
bigquery fixes 👍🏼
This commit is contained in:
parent
85a8c96056
commit
e9f2ca5bd6
|
@ -51,6 +51,7 @@ describe('BigQueryAdapter', () => {
|
|||
private_key: 'test-key',
|
||||
client_email: 'test@test.iam.gserviceaccount.com',
|
||||
},
|
||||
location: 'US',
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -67,6 +68,7 @@ describe('BigQueryAdapter', () => {
|
|||
expect(BigQuery).toHaveBeenCalledWith({
|
||||
projectId: 'test-project',
|
||||
keyFilename: '/path/to/key.json',
|
||||
location: 'US',
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -103,6 +105,7 @@ describe('BigQueryAdapter', () => {
|
|||
expect.objectContaining({
|
||||
projectId: 'test-project',
|
||||
credentials: serviceAccountObject,
|
||||
location: 'US',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -131,6 +134,7 @@ describe('BigQueryAdapter', () => {
|
|||
expect(BigQuery).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
projectId: 'test-project',
|
||||
location: 'US',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
@ -149,6 +153,7 @@ describe('BigQueryAdapter', () => {
|
|||
expect(BigQuery).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
projectId: 'test-project',
|
||||
location: 'us-central1',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
|
|
@ -49,9 +49,8 @@ export class BigQueryAdapter extends BaseAdapter {
|
|||
options.keyFilename = bigqueryCredentials.key_file_path;
|
||||
}
|
||||
|
||||
if (bigqueryCredentials.location) {
|
||||
options.location = bigqueryCredentials.location;
|
||||
}
|
||||
// Set location - default to US if not specified
|
||||
options.location = bigqueryCredentials.location || 'US';
|
||||
|
||||
this.client = new BigQuery(options);
|
||||
this.credentials = credentials;
|
||||
|
@ -79,6 +78,13 @@ export class BigQueryAdapter extends BaseAdapter {
|
|||
// Fix SQL to ensure proper escaping of identifiers with special characters
|
||||
const fixedSql = fixBigQueryTableReferences(sql);
|
||||
|
||||
// Debug logging to verify the fix is applied
|
||||
if (sql !== fixedSql) {
|
||||
console.log('[BigQuery] SQL fixed for special characters:');
|
||||
console.log(' Original:', sql);
|
||||
console.log(' Fixed: ', fixedSql);
|
||||
}
|
||||
|
||||
const options: Query = {
|
||||
query: fixedSql,
|
||||
useLegacySql: false,
|
||||
|
|
Loading…
Reference in New Issue