Skip to content

useTableDetails

useTableDetails(options): UseTableDetailsReturn

Hook for fetching detailed table information including columns

ParameterType
optionsUseTableDetailsOptions

UseTableDetailsReturn

function TableColumnsList({ schema, table }: { schema: string; table: string }) {
const { data, isLoading, error } = useTableDetails({ schema, table })
if (isLoading) return <div>Loading...</div>
if (error) return <div>Error: {error.message}</div>
return (
<ul>
{data?.columns.map(col => (
<li key={col.name}>
{col.name} ({col.data_type})
{col.is_primary_key && ' 🔑'}
</li>
))}
</ul>
)
}