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.
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.
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)[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: |
| |
Note
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)[source]
Checks if table exists.
Parameters: | name (str) – Table name. |
Return bool: | |
-
tables(raw=False)[source]
Table list. Retrieves the list of available tables.
Parameters: | raw (bool) – If set to True raw result (JSON) is returned. |
Return list: | Just a list of plain strings of table names, no Table instances. |
-
version[source]
Software version. Returns the software version.
Return dict: | Dictionary with info on software versions (OS, Server, JVM, etc). |
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: | |