cfahlgren1's picture
cfahlgren1 HF staff
add duplicate checker
e6091f8
metadata
id: duckdb-table-info
title: Table Info
slug: duckdb-table-info-query
description: Get detailed information about a table's structure
code: |
  with nested as 
  (
  select unnest(reasoning_chains) as reasoning_chains
  from train limit 100
  )

  select reasoning_chains.* from nested;

DuckDB Table Info Query

This snippet demonstrates how to use the PRAGMA table_info function in DuckDB to get detailedinformation about a specific table's structure.

Try out this query here

-- Returns detailed information about a table's structure
-- Use this to get the column names, types, and other details
PRAGMA table_info('table_name');

Example Output

cid name type notnull dflt_value pk
0 id VARCHAR false null false
1 conversations STRUCT("from" VARCHAR, "value" VARCHAR)[] false null false
2 category VARCHAR false null false
3 subcategory VARCHAR false null false
4 task VARCHAR false null false

You can read more about this here.

Example Usage