Module datapane.client.api.teams

Datapane Teams API

Datapane Teams includes features to automate your Python workflows and easily build and share data-driven apps and results with your teams.

Generally objects are created on the server via the static methods (rather than the constructor), and the instance methods and fields are used to access values (e.g. .name) and behaviour (e.g. delete()) on already existing object. Objects can be looked up by name using .get() and by id using .by_id().

Note: The objects in this module are available on the Teams Plan

Classes

class Blob (dto: Union[str, int, float, bool, NoneType, Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]] = None)

Blobs are files that can be uploaded and downloaded for use in your scripts, for instance trained models, datasets, and (pickled) Python objects. They are generally large, but can be any size.

Attributes

content_type
the blob content-type
size_bytes
the blob size
num_rows
number of rows in the file (if a dataframe)
num_colums
number of colums in the file (if a dataframe)
cells
number of cells in the file (if a dataframe)

Tip: Use the static methods to create Blobs rather than the constructor

Ancestors

Static methods

def upload_df(df: pandas.core.frame.DataFrame, **kwargs) ‑> Blob

Create a blob containing the dataframe provided

Args

df
The pandas dataframe to upload as a Blob

Returns

An instance of the created Blob object

def upload_file(fn: Union[pathlib.Path, os.PathLike, str], **kwargs) ‑> Blob

Create a blob containing the contents of the file provided

Args

fn
Path to the file to upload as a Blob

Returns

An instance of the created Blob object

def upload_obj(data: Any, as_json: bool = False, **kwargs: Union[str, int, float, bool, NoneType, Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]]) ‑> Blob

Create a blob containing the contents of the Python object provided, the object may be pickled or converted to JSON before storing.

Args

data
Python object to upload as a Blob
as_json
Convert the data to JSON rather than pickling (optional)

Returns

An instance of the created Blob object

def get(name: str, owner: Union[str, NoneType] = None) ‑> ~U

Inherited from: DPObjectRef.get

Lookup and retrieve an object from the Datapane Server by its name …

def by_id(id_or_url: str) ‑> ~U

Inherited from: DPObjectRef.by_id

Lookup and retrieve an object from the Datapane Server by its id …

def list() ‑> Iterable[Dict[str, Any]]

Inherited from: DPObjectRef.list

Returns: A list of the Datapane objects of this type that are owned by the user

Methods

def download_df(self) ‑> pandas.core.frame.DataFrame

Download the blob and return it as a Dataframe

Returns

A pandas dataframe generated from the blob

def download_file(self, fn: Union[pathlib.Path, os.PathLike, str]) ‑> NoneType

Download the blob to the file provided

Args

fn
Path representing the location to save the file
def download_obj(self) ‑> Any

Download the blob and return it as a Python object

Returns

The object created by deserialising the Blob (either via Pickle or JSON decoding)

def refresh(self)

Inherited from: DPObjectRef.refresh

Refresh the object with the latest data from the Datapane Server

def delete(self)

Inherited from: DPObjectRef.delete

Delete the object on the server

class Variable (dto: Union[str, int, float, bool, NoneType, Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]] = None)

User Variables represent secure pieces of data, such as tokens, database connection strings, etc. that are needed inside your scripts

Tip: Use the static methods to create Variables rather than the constructor

Attributes

name
Name of the variable
value
Value of the variable

Ancestors

Class variables

var list_fields : List[str]

Static methods

def create(name: str, value: str, group: Union[str, NoneType] = None, visibility: Union[str, NoneType] = 'PRIVATE') ‑> Variable

Create a shareable Datapane User Variable with provided name and value

Args

name
Name of the variable
value
Value of the variable
group
Group name (optional and only applicable for organisations)
visibility
one of "PUBLIC", or "PRIVATE" (optional)

Returns

An instance of the created Variable object

def get(name: str, owner: Union[str, NoneType] = None) ‑> ~U

Inherited from: DPObjectRef.get

Lookup and retrieve an object from the Datapane Server by its name …

def by_id(id_or_url: str) ‑> ~U

Inherited from: DPObjectRef.by_id

Lookup and retrieve an object from the Datapane Server by its id …

def list() ‑> Iterable[Dict[str, Any]]

Inherited from: DPObjectRef.list

Returns: A list of the Datapane objects of this type that are owned by the user

Methods

def refresh(self)

Inherited from: DPObjectRef.refresh

Refresh the object with the latest data from the Datapane Server

def delete(self)

Inherited from: DPObjectRef.delete

Delete the object on the server

class Script (dto: Union[str, int, float, bool, NoneType, Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]] = None)

Scripts allow users to build, deploy, and automate data-driven Python workflows and apps to their cloud that can be customised and run by other users.

Tip: We recommend using either the Web UI or CLI, e.g. datapane script deploy / run / ... to work with scripts rather than using the low-level API

Ancestors

Static methods

def get(name: str, owner: Union[str, NoneType] = None) ‑> ~U

Inherited from: DPObjectRef.get

Lookup and retrieve an object from the Datapane Server by its name …

def by_id(id_or_url: str) ‑> ~U

Inherited from: DPObjectRef.by_id

Lookup and retrieve an object from the Datapane Server by its id …

def list() ‑> Iterable[Dict[str, Any]]

Inherited from: DPObjectRef.list

Returns: A list of the Datapane objects of this type that are owned by the user

Methods

def refresh(self)

Inherited from: DPObjectRef.refresh

Refresh the object with the latest data from the Datapane Server

def delete(self)

Inherited from: DPObjectRef.delete

Delete the object on the server

class Schedule (dto: Union[str, int, float, bool, NoneType, Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]] = None)

Runs represent the running of a script, indicating their status, output, errors, etc.

Tip: We recommend using the CLI, e.g. datapane schedule create / ... to work with schedules rather than the low-level API

Ancestors

Class variables

var list_fields : List[str]

Static methods

def create(script: Script, cron: str, parameters: Dict[str, Any]) ‑> Schedule
def get(name: str, owner: Union[str, NoneType] = None) ‑> ~U

Inherited from: DPObjectRef.get

Lookup and retrieve an object from the Datapane Server by its name …

def by_id(id_or_url: str) ‑> ~U

Inherited from: DPObjectRef.by_id

Lookup and retrieve an object from the Datapane Server by its id …

def list() ‑> Iterable[Dict[str, Any]]

Inherited from: DPObjectRef.list

Returns: A list of the Datapane objects of this type that are owned by the user

Methods

def update(self, cron: str = None, parameters: Dict[str, Any] = None) ‑> NoneType
def refresh(self)

Inherited from: DPObjectRef.refresh

Refresh the object with the latest data from the Datapane Server

def delete(self)

Inherited from: DPObjectRef.delete

Delete the object on the server