(target: dataform.ITarget)
| 328 | } |
| 329 | |
| 330 | private async getMetadata(target: dataform.ITarget): Promise<TableMetadata> { |
| 331 | try { |
| 332 | const table = await this.getClient(target.database) |
| 333 | .dataset(target.schema) |
| 334 | .table(target.name) |
| 335 | .getMetadata(); |
| 336 | return table?.[0]; |
| 337 | } catch (e) { |
| 338 | if (e?.errors?.[0]?.reason === "notFound") { |
| 339 | // if the table can't be found, just return null |
| 340 | return null; |
| 341 | } |
| 342 | // otherwise throw the error as normal |
| 343 | throw coerceAsError(e); |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | private getClient(projectId?: string) { |
| 348 | return this.clientProvider(projectId); |
no test coverage detected