stantic.server#
- class stantic.server.Server(url: str, docker_compose: Optional[Any] = None)[source]#
Bases:
object
Server model of a FROST server instance
- delete(E: Type[Entity], id: Optional[int] = None) None [source]#
Delete all or specified entity from server
- Parameters
E β entity type to delete
id β entity id
- Returns
Nothing
- dump(entity: Optional[Union[Type[Entity], Iterable[Type[Entity]]]] = None) Dict[Type[Entity], List[Entity]] [source]#
Get all instances of requested entity type
- Parameters
entity β entity type or list of entity types
- Returns
Dict with entities
- get(E: Type[Entity], id: Optional[int] = None, search: Optional[str] = None) Optional[Union[Entity, Iterable[Entity]]] [source]#
Get all or specified entity from server
- Parameters
E β entity type to get
id β entity id
search β filter entitites by this search string
- Returns
Entity or list of requested entities
- property is_alive#
Check if the server can be reached
- post(entity: Entity, strict: Optional[bool] = True) Optional[Entity] [source]#
Post an entity to the server
- Parameters
entity β entity instance
strict β donβt allow double entry of entities (determined by name attr)
- Returns
Posted entity including assigned id
- pull_data(datastream: Datastream, *, dt_min: Optional[datetime] = None, dt_max: Optional[datetime] = None, max_requests: Optional[int] = None) DataFrame [source]#
Pull data from datastream
- Parameters
datastream β source datastream
dt_min β start datetime
dt_max β end datetime
max_requests β max request calls allowed (overwrites default of 100)
- Returns
Dataframe with observation values
- push_data(datastream: Datastream, df: DataFrame, batch_mode: Optional[bool] = True) None [source]#
Push data to datastream
- Parameters
datastream β target datastream
df β dataframe with observation values
batch_mode β push data as one array instead of iterative pushes (much more efficient)
- Returns
Nothing
- update(entity: Entity) None [source]#
Update/ patch an entity on the server
- Parameters
entity β the updated entity to be pushed to the server
- Returns
Nothing
- update_field(E: Type[Entity], id: int, payload: Dict[str, Any]) Optional[Iterable[Entity]] [source]#
Update specific fields of an entity on the server
- Parameters
E β entity type to update
id β entity id
payload β entity fields and values to be used in update
- Returns
Entity or list of requested entities