Inputs¶
Inputs are the sources which Alooma pulls data from. Examples of inputs are webhooks, databases, and cloud applications.
-
Inputs.
__init__
(api, preview_full=True, preview_changes=True, apply_changes=False, pprint_indent=2, pprint_width=250, pprint_depth=5)¶ View, created and edit Alooma inputs. Inputs are the source of data to bring into Alooma. The class is initiated with the following variables:
Parameters: - api – The Alooma API client authentication
- preview_full – Prints the input and changed input if True
- preview_changes – Prints the changes in the input by category if True
- apply_changes – Executes the mapping changes if True
- pprint_indent – The indent value to pprint dictionaries
- pprint_width – The width value to pprint dictionaries
- pprint_depth – The depth value to pprint dictionaries
Print Sorted List¶
-
static
Inputs.
print_sorted_list
(lst)¶ Parameters: lst – list Takes a list and prints a sorted list
Get All Inputs¶
-
Inputs.
get_all_inputs
()¶ Gets the information for all inputs from Alooma
Returns: A list of dictionaries with information for each input
Get Input¶
-
Inputs.
get_input
(input_name)¶ Gets the input information for a specific input
Parameters: input_name – The name of the input to retrieve Returns: A dictionary with the input
View Inputs¶
-
Inputs.
view_inputs
(single_input=None, print_format='table')¶ Prints a data from with the event info
Parameters: - single_input – string The name of a specific input to filter the results
- print_format – string ‘table’ to print event info as tables or ‘json’ to print as dictionaries
Returns: The list of input dictionaries
Delete Input¶
-
Inputs.
delete_input
(input_name)¶ Delete an input. This can not be undone!
Parameters: input_name – The name of the input to delete Returns: None
Pause Input¶
-
Inputs.
pause_input
(input_name)¶ Pause the input from pulling data
Parameters: input_name – The name of the input to pause Returns: None
Resume Input¶
-
Inputs.
resume_input
(input_name)¶ Resume the input so it will pull date
Parameters: input_name – The name of the input to resume pulling data Returns: None
List Inputs¶
-
Inputs.
list_inputs
(add_quotes_commas=False)¶ Prints and/or returns a list of input names
Parameters: - print_lst – boolean True to print the list to the console
- add_quotes_commas – boolean True to print the list to the console with single quotes around strings and commas between each name
Returns: list of the names of inputs
List Tables¶
-
Inputs.
list_tables
(input_name)¶ Prints and/or returns the list of tables in an input
Parameters: single_input – string The input for which to print or return the tables Returns: The list if tables in an input
Create Input Database¶
-
Inputs.
create_input_database
(source_credentials, new_input_name, existing_input, tables_dict=None, auto_map=True, input_default_schema=None, replication_type='incremental_load', batch_size=100000)¶ Create a new input with a database as the source
Parameters: - source_credentials – The database credentials and configuration for the source
- new_input_name – The name of the new input
- existing_input – The name of the existing input from which to copy the configuration
- tables_dict – A dictionary containing the tables to replicate and the update indicator such as {“table_name”: “xmin::text::bigint”}
- auto_map – True if the input should be auto-mapped
- input_default_schema – The default schema for the data in the target database
- replication_type – The type of replication to apply
- batch_size – The number of rows to pull in each batch
Returns: None
Example database source credentials:
{'server': 'server_name', 'schema': 'schema_name', 'port': 'port', 'database': 'database', 'db_type': 'psql', 'user': 'username', 'password': 'password'}
Edit Input Configuration¶
-
Inputs.
edit_input_configuration
(input_name=None, field_to_edit=None, new_field_value=None)¶ Edit a single field in an input configuration at a time
Parameters: - input_name – The name of the input to edit
- field_to_edit – The name of the field to edit
- new_field_value – The new value for the field
Returns: None
Add Table to Input¶
-
Inputs.
add_table_to_input
(input_name, new_table_dict={})¶ Add tables to an existing input
Parameters: - input_name – The name of the input to add tables to
- new_table_dict – A dictionary with the tables to add and their update field such as {“table_name”: “xmin::text::bigint”}
Returns: None
Change Auto Mapping Mode¶
-
Inputs.
change_auto_mapping_mode
(input_name=None, new_mapping_mode=False)¶ Edit a single field in an input configuration at a time
Parameters: - input_name – The name of the input to alter
- new_mapping_mode – The new automapping mapping mode to set of True or False
Returns: None
Add Template to Parameter Configuration¶
-
Inputs.
add_template_to_parameter_configuration
(input_name, add_to_parameter, template)¶ Add a template to single parameter or a list of parameters in an input configuration
Parameters: - input_name – The input to add template to
- add_to_parameter – a single parameter or a list of parameters that you want to add template to
- template – e.g. ‘%Y-%m-%d’
Returns: None
Edit Parameter Configuration¶
-
Inputs.
edit_parameter_configuration
(input_name, parameter_to_edit, value_to_set, new_value)¶ edit API parameter value, e.g. changing days past value from 100 to 10
Parameters: - input_name – The input to make the change for
- parameter_to_edit – a single parameter that you want to edit
- value_to_set – name of the field you want to edit
- new_value – new value you want to set
Returns: None
Preview Input Changes¶
-
Inputs.
preview_input_changes
(input, new_input, show_matching, show_changed, show_removed, show_added)¶ Takes an original mapping and altered mapping and prints various views on the changes
Parameters: - input – A dictionary representing the current state of the mapping
- new_input – An altered dictionary representing the changed state of the mapping
- show_matching – Show the key value pairs that match between the two mappings
- show_changed – Show the key value pairs that have been changed between the two mappings
- show_removed – Show the key value pairs that were removed from the current state of the mapping
- show_added – Show the key value paids that were added to the changed state of the mapping
Returns: None