starbase.client package

Submodules

starbase.client.connection module

class starbase.client.connection.Connection(host='127.0.0.1', port=8000, user='', password='', secure=False, content_type='json', perfect_dict=True, retries=0, retry_delay=2)[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.
  • retries (int) – Number of times to retry a failed request.
  • retry_delay (int) – Delay between retrying a failed request.
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:
tables(raw=False, fail_silently=True)[source]

Table list. Retrieves the list of available tables.

Parameters:
  • raw (bool) – If set to True raw result (JSON) is returned.
  • fail_silently (bool) –
Return list:

Just a list of plain strings of table names, no Table instances.

version[source]

Software version. Returns the software version.

Parameters:fail_silently (bool) –
Return dict:Dictionary with info on software versions (OS, Server, JVM, etc).

starbase.client.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:

starbase.client.scanner_test module

starbase.client.speed_test module

starbase.client.tests module

starbase.client.tests.PROJECT_DIR(base)
class starbase.client.tests.Registry[source]

Bases: object

class starbase.client.tests.StarbaseClient01ConnectionTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Starbase Connection tests.

setUp()[source]
test_01_version(*args, **kwargs)[source]
test_02_cluster_version(*args, **kwargs)[source]
test_03_cluster_status(*args, **kwargs)[source]
test_04_drop_table_schema(*args, **kwargs)[source]
test_05_create_table_schema(*args, **kwargs)[source]
test_06_get_table_schema(*args, **kwargs)[source]
test_07_table_list(*args, **kwargs)[source]
class starbase.client.tests.StarbaseClient02TableTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Starbase Table tests.

setUp()[source]
test_01_columns_list(*args, **kwargs)[source]
test_02_table_put_multiple_column_data(*args, **kwargs)[source]
test_03_table_put_multiple_column_data_normal_dict(process_number=0)[source]

Insert multiple-colums into a single row of HBase using Stagate REST API using perfect dict as input.

test_04_table_batch_put_multiple_column_data(*args, **kwargs)[source]
test_05_table_batch_put_multiple_column_data_perfect_dict(process_number=0)[source]

Insert multiple-colums in batch into a HBase using Stagate REST API using perfect dict as input.

test_06_table_batch_post_multiple_column_data(*args, **kwargs)[source]
test_07_table_batch_post_multiple_column_data_perfect_dict(process_number=0)[source]

Update multiple-colums in batch into a HBase using Stagate REST API using perfect dict as input.

test_08_table_put_column_data(*args, **kwargs)[source]
test_09_table_put_column_data(*args, **kwargs)[source]
test_10_table_put_column_data(*args, **kwargs)[source]
test_11_get_single_row_with_all_columns(*args, **kwargs)[source]
test_13_table_post_column_data(*args, **kwargs)[source]
test_14_get_single_row_with_all_columns(*args, **kwargs)[source]
test_15_table_delete_rows_one_by_one(*args, **kwargs)[source]
test_16_get_single_row_with_all_columns(*args, **kwargs)[source]
test_16_get_single_row_with_all_columns_as_perfect_dict(*args, **kwargs)[source]
test_17_get_single_row_with_selective_columns(*args, **kwargs)[source]
test_18_get_single_row_with_selective_columns(*args, **kwargs)[source]
test_19_table_get_all_rows(*args, **kwargs)[source]
test_19b_table_get_all_rows_with_filter(*args, **kwargs)[source]
test_19c_table_get_all_rows_with_scanner_config(*args, **kwargs)[source]
test_20_table_put_multiple_column_data_in_multithreading(number_of_threads=8)[source]

Speed test.

test_21_table_delete_row(*args, **kwargs)[source]
test_22_alter_table(*args, **kwargs)[source]
test_23_test_extract_usable_data_as_perfect_dict(*args, **kwargs)[source]
test_24_test_extract_usable_data(*args, **kwargs)[source]
test_25_insert_binary_file(*args, **kwargs)[source]
test_26_insert_row_into_non_existing_table_fail_silently(*args, **kwargs)[source]
test_27_insert_row_into_non_existing_table_raise_exception(*args, **kwargs)[source]
test_28_update_row_of_non_existing_table_fail_silently(*args, **kwargs)[source]
test_29_update_row_of_non_existing_table_raise_exception(*args, **kwargs)[source]
test_30_drop_non_existing_table_fail_silently(*args, **kwargs)[source]
test_31_drop_non_existing_table_raise_exception(*args, **kwargs)[source]
test_32_fetch_row_of_non_existing_table_fail_silently(*args, **kwargs)[source]
test_33_fetch_row_of_non_existing_table_raise_exception(*args, **kwargs)[source]
test_34_remove_row_of_non_existing_table_fail_silently(*args, **kwargs)[source]
test_35_remove_row_of_non_existing_table_raise_exception(*args, **kwargs)[source]
class starbase.client.tests.StarbaseClient03TableTestDisabledIfExists(methodName='runTest')[source]

Bases: unittest.case.TestCase

Starbase table tests with disabled if exists checks.

setUp()[source]
test_01_fetch_row(*args, **kwargs)[source]
test_02_insert_row(*args, **kwargs)[source]
test_03_update_row(*args, **kwargs)[source]
test_04_remove_row(*args, **kwargs)[source]
test_05_scanner_operations(*args, **kwargs)[source]
test_06_batch_operations(*args, **kwargs)[source]
starbase.client.tests.print_info(func)[source]

Prints some useful info.

Module contents