| 69 | } |
| 70 | |
| 71 | async schema(signal?: AbortSignal): Promise<Schema> { |
| 72 | if (!this.source) throw new Error('No data loaded. Please call source() first.'); |
| 73 | |
| 74 | const tables = z.array(tableSchema).parse(await this.metadata(SCHEMA_CODE, signal)); |
| 75 | if (new Set(tables.map((table) => table.name)).size !== tables.length) { |
| 76 | throw new Error('Python source returned duplicate table names'); |
| 77 | } |
| 78 | return { models: tables } as Schema; |
| 79 | } |
| 80 | |
| 81 | async getDSL(query: string, dataModel: DataModel, signal?: AbortSignal): Promise<TranslationResult> { |
| 82 | if (!this.source) throw new Error('No data loaded. Please call source() first.'); |