add LanceModel to docs (#386)

Co-authored-by: Chang She <chang@lancedb.com>
This commit is contained in:
Chang She
2023-07-31 15:12:02 -04:00
committed by GitHub
parent b06e214d29
commit 4b45128bd6
3 changed files with 7 additions and 2 deletions

View File

@@ -275,10 +275,16 @@ class LanceModel(pydantic.BaseModel):
@classmethod
def to_arrow_schema(cls):
"""
Get the Arrow Schema for this model.
"""
return pydantic_to_schema(cls)
@classmethod
def field_names(cls) -> List[str]:
"""
Get the field names of this model.
"""
if PYDANTIC_VERSION.major < 2:
return list(cls.__fields__.keys())
return list(cls.model_fields.keys())