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