(tableId: string)
| 387 | }; |
| 388 | |
| 389 | const toggleTable = async (tableId: string) => { |
| 390 | // If it's a MotherDuck table and we're expanding it, fetch columns |
| 391 | if (!expandedTables.has(tableId) && tableId.includes('.')) { |
| 392 | const [database, ...tableNameParts] = tableId.split('.'); |
| 393 | const tableName = tableNameParts.join('.'); // Handle table names with dots |
| 394 | if (database !== 'local') { |
| 395 | await fetchMotherDuckTableColumns(database, tableName); |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | setExpandedTables(prev => { |
| 400 | const next = new Set(prev); |
| 401 | if (next.has(tableId)) { |
| 402 | next.delete(tableId); |
| 403 | } else { |
| 404 | next.add(tableId); |
| 405 | } |
| 406 | return next; |
| 407 | }); |
| 408 | }; |
| 409 | |
| 410 | const generateSelectQuery = (schema: TableSchema) => { |
| 411 | let query: string; |
no test coverage detected