Models
The DataScribe API uses Pydantic models to provide type-safe data structures for all API responses. All models include:
- Full type validation: Automatic validation of data types and structure
- IDE support: Auto-completion and type hints in your editor
- Serialization: Easy conversion to JSON, dicts, and DataFrames
- Documentation: Built-in field descriptions and examples
Available Models
Data Table Models
- DataTable: Represents a single data table with metadata
- DataTables: Collection of data tables
- DataTableRows: Collection of rows from a table query
- DataTableColumns: Column definitions for a table
- DataTableMetadata: Complete metadata for a table
- DataTableRowsCount: Row count information
Materials Models
- MaterialSearchResults: Results from a materials search
- MaterialByIdResults: Results from a material ID lookup
Common Methods
All collection models (DataTables, DataTableRows, DataTableColumns, MaterialSearchResults, MaterialByIdResults) support these methods:
to_dataframe()
Convert the model data to a pandas DataFrame
from datascribe_api import DataScribeClient
client = DataScribeClient()
tables = client.get_data_tables_for_user()
# Convert to DataFrame
df = tables.to_dataframe()
print(df.head())
to_list()
Convert the model data to a list of dictionaries
rows = client.get_data_table(tableName="my_table")
# Convert to list
data = rows.to_list()
for row_dict in data:
print(row_dict)
Model Serialization
All models support standard Pydantic serialization: