client Package¶
connection Module¶
- class starbase.client.connection.Connection(host='127.0.0.1', port=8000, user='', password='', secure=False, content_type='json', perfect_dict=True)[source]¶
Bases: object
Connection instance.
Parameters: - host (str) – Stargate host.
- port (int) – Stargate port.
- user (str) – Stargate user. Use this if your stargate is protected with HTTP basic auth (to be used in combination with password argument).
- password (str) – Stargate password (see comment to user).
- secure (bool) – If set to True, HTTPS is used; otherwise - HTTP. Default value is False.
- content_type (str) – Content type for data wrapping when communicating with the Stargate. Possible options are: json.
- perfect_dict (bool) – Global setting. If set to True, generally data will be returned as perfect dict.
- cluster_status[source]¶
Storage cluster satus. Returns detailed status on the HBase cluster backing the Stargate instance.
Parameters: fail_silently (bool) – Return dict: Dictionary with information on dead nodes, live nodes, average load, regions, etc.
- cluster_version[source]¶
Storage cluster version. Returns version information regarding the HBase cluster backing the Stargate instance.
Parameters: fail_silently (bool) – Return str: HBase version.
- create_table(name, *columns)[source]¶
Creates the table and returns the instance created. If table already exists, returns None.
Parameters: - name (str) – Table name.
- *columns (list|tuple) –
Return starbase.client.table.Table:
- drop_table(name, fail_silently=True)[source]¶
Drops the table.
Parameters: name (str) – Table name. Return int: Status code.
- table(name)[source]¶
Initializes a table instance to work with.
Parameters: name (str) – Table name. Example value ‘test’. Return stargate.base.Table: This method does not check if table exists. Use the following methods to perform the check:
- starbase.client.Connection.table_exists or
- starbase.client.table.Table.exists.
- table_exists(name, fail_silently=True)[source]¶
Checks if table exists.
Parameters: - name (str) – Table name.
- fail_silently (bool) –
Return bool:
helpers Module¶
- starbase.client.helpers.build_json_data(row, columns, timestamp=None, encode_content=False, with_row_declaration=True)[source]¶
Builds JSON data for read-write purposes. Used in starbase.client.Table._build_table_data.
Parameters: - row (str) –
- columns (dict) –
- timestamp – Not yet used.
- encode_content (bool) –
- with_row_declaration (bool) –
Return dict: