Skip to content

pixano.app.routers.entities

create_entities(dataset_id, table, entities, settings) async

Add entities in a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
entities list[EntityModel]

Entities to add.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
list[EntityModel]

List of entities added.

Source code in pixano/app/routers/entities.py
@router.post("/{dataset_id}/{table}/", response_model=list[EntityModel])
async def create_entities(
    dataset_id: str,
    table: str,
    entities: list[EntityModel],
    settings: Annotated[Settings, Depends(get_settings)],
) -> list[EntityModel]:
    """Add entities in a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        entities: Entities to add.
        settings: App settings.

    Returns:
        List of entities added.
    """
    return await create_rows_handler(dataset_id, SchemaGroup.ENTITY, table, entities, settings)

create_entity(dataset_id, table, id, entity, settings) async

Add an entity in a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
id str

ID of the entity.

required
entity EntityModel

Entity to add.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
EntityModel

The entity added.

Source code in pixano/app/routers/entities.py
@router.post("/{dataset_id}/{table}/{id}", response_model=EntityModel)
async def create_entity(
    dataset_id: str,
    table: str,
    id: str,
    entity: EntityModel,
    settings: Annotated[Settings, Depends(get_settings)],
) -> EntityModel:
    """Add an entity in a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        id: ID of the entity.
        entity: Entity to add.
        settings: App settings.

    Returns:
        The entity added.
    """
    return await create_row_handler(dataset_id, SchemaGroup.ENTITY, table, id, entity, settings)

delete_entities(dataset_id, table, ids, settings) async

Delete entities from a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
ids Annotated[list[str], Query()]

IDs of the entities to delete.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required
Source code in pixano/app/routers/entities.py
@router.delete("/{dataset_id}/{table}/")
async def delete_entities(
    dataset_id: str,
    table: str,
    ids: Annotated[list[str], Query()],
    settings: Annotated[Settings, Depends(get_settings)],
) -> None:
    """Delete entities from a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        ids: IDs of the entities to delete.
        settings: App settings.
    """
    return await delete_rows_handler(dataset_id, SchemaGroup.ENTITY, table, ids, settings)

delete_entity(dataset_id, table, id, settings) async

Delete an entity from a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
id str

ID of the entity to delete.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required
Source code in pixano/app/routers/entities.py
@router.delete("/{dataset_id}/{table}/{id}")
async def delete_entity(
    dataset_id: str, table: str, id: str, settings: Annotated[Settings, Depends(get_settings)]
) -> None:
    """Delete an entity from a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        id: ID of the entity to delete.
        settings: App settings.
    """
    return await delete_row_handler(dataset_id, SchemaGroup.ENTITY, table, id, settings)

get_entities(dataset_id, table, settings, ids=Query(None), limit=None, skip=0, where=None, item_ids=Query(None)) async

Get entities from a table of a dataset.

They can be filtered by IDs, item IDs, a where clause or paginated.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required
ids list[str] | None

IDs of the views.

Query(None)
limit int | None

Limit number of views.

None
skip int

Skip number of views.

0
where str | None

Where clause.

None
item_ids list[str] | None

Item IDs.

Query(None)

Returns:

Type Description
list[EntityModel]

List of views.

Source code in pixano/app/routers/entities.py
@router.get("/{dataset_id}/{table}/", response_model=list[EntityModel])
async def get_entities(
    dataset_id: str,
    table: str,
    settings: Annotated[Settings, Depends(get_settings)],
    ids: list[str] | None = Query(None),
    limit: int | None = None,
    skip: int = 0,
    where: str | None = None,
    item_ids: list[str] | None = Query(None),
) -> list[EntityModel]:
    """Get entities from a table of a dataset.

    They can be filtered by IDs, item IDs, a where clause or paginated.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        settings: App settings.
        ids: IDs of the views.
        limit: Limit number of views.
        skip: Skip number of views.
        where: Where clause.
        item_ids: Item IDs.

    Returns:
        List of views.
    """
    return await get_rows_handler(
        dataset_id=dataset_id,
        group=SchemaGroup.ENTITY,
        table=table,
        settings=settings,
        where=where,
        ids=ids,
        item_ids=item_ids,
        limit=limit,
        skip=skip,
    )

get_entity(dataset_id, table, id, settings) async

Get an entity from a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
id str

ID of the entity.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
EntityModel

The entity.

Source code in pixano/app/routers/entities.py
@router.get("/{dataset_id}/{table}/{id}", response_model=EntityModel)
async def get_entity(
    dataset_id: str, table: str, id: str, settings: Annotated[Settings, Depends(get_settings)]
) -> EntityModel:
    """Get an entity from a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        id: ID of the entity.
        settings: App settings.

    Returns:
        The entity.
    """
    return await get_row_handler(dataset_id, SchemaGroup.ENTITY, table, id, settings)

update_entities(dataset_id, table, entities, settings) async

Update entities in a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
entities list[EntityModel]

Entities to update.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
list[EntityModel]

List of entities updated.

Source code in pixano/app/routers/entities.py
@router.put("/{dataset_id}/{table}/", response_model=list[EntityModel])
async def update_entities(
    dataset_id: str,
    table: str,
    entities: list[EntityModel],
    settings: Annotated[Settings, Depends(get_settings)],
) -> list[EntityModel]:
    """Update entities in a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        entities: Entities to update.
        settings: App settings.

    Returns:
        List of entities updated.
    """
    return await update_rows_handler(dataset_id, SchemaGroup.ENTITY, table, entities, settings)

update_entity(dataset_id, table, id, entity, settings) async

Update an entity in a table of a dataset.

Parameters:

Name Type Description Default
dataset_id str

Dataset ID containing the table.

required
table str

Table name.

required
id str

ID of the entity.

required
entity EntityModel

Entity to update.

required
settings Annotated[Settings, Depends(get_settings)]

App settings.

required

Returns:

Type Description
EntityModel

The entity updated.

Source code in pixano/app/routers/entities.py
@router.put("/{dataset_id}/{table}/{id}", response_model=EntityModel)
async def update_entity(
    dataset_id: str,
    table: str,
    id: str,
    entity: EntityModel,
    settings: Annotated[Settings, Depends(get_settings)],
) -> EntityModel:
    """Update an entity in a table of a dataset.

    Args:
        dataset_id: Dataset ID containing the table.
        table: Table name.
        id: ID of the entity.
        entity: Entity to update.
        settings: App settings.

    Returns:
        The entity updated.
    """
    return await update_row_handler(dataset_id, SchemaGroup.ENTITY, table, id, entity, settings)