Skip to content

Uploading data with objects

To upload tables containing complex objects to the data catalog, use:

[Copy Code](javascript:void(0)) Python
from random import randbytes from pymatgen.core import Lattice, Structure from research_sdk import Dataframe, DataStorageInterface, DataStorageType, RawObject, TableColumn from research_sdk.structures.object.pymatgen import PyMatGenObject

Declaring table schema

Table schema is the list of TableColumn. Every TableColumn defines a column name and column type. The type is set as the python type for POD values and wrappers for objects, because if there are no wrappers, it's impossible to detect a proper type to store objects.

To declare a table schema, use:

[Copy Code](javascript:void(0)) Python
table_schema = [ TableColumn(name="Index", type=int), TableColumn(name="Structure", type=PyMatGenObject), TableColumn(name="Raw experiment data", type=RawObject), ]
InformationSometimes the schema may be read from the data through the Dataframe.create_schema_from_data() static method, but it is not recommended because the detection of non-POD types does not work and may fail to read wide objects like RawObject.