( credentials: dataform.IBigQuery )
| 40 | export type BigQueryClientProvider = (projectId?: string) => BigQuery; |
| 41 | |
| 42 | export function createBigQueryClientProvider( |
| 43 | credentials: dataform.IBigQuery |
| 44 | ): BigQueryClientProvider { |
| 45 | const clients = new Map<string, BigQuery>(); |
| 46 | return (projectId?: string) => { |
| 47 | projectId = projectId || credentials.projectId; |
| 48 | if (!clients.has(projectId)) { |
| 49 | clients.set( |
| 50 | projectId, |
| 51 | new BigQuery({ |
| 52 | projectId, |
| 53 | scopes: EXTRA_GOOGLE_SCOPES, |
| 54 | location: credentials.location, |
| 55 | credentials: credentials.credentials && JSON.parse(credentials.credentials) |
| 56 | }) |
| 57 | ); |
| 58 | } |
| 59 | return clients.get(projectId); |
| 60 | }; |
| 61 | } |
| 62 | |
| 63 | export class BigQueryDbAdapter implements IDbAdapter { |
| 64 | private bigQueryCredentials: dataform.IBigQuery; |
no test coverage detected