smp_io module
TIPCommon.smp_io.read_content
TIPCommon.smp_io.read_content(siemplify, file_name, db_key, default_value_to_return=None, identifier=None)
Read the content of a ConnectorStream
object. If the object contains no data
or doesn't exist, return a default value.
Parameters | |
---|---|
siemplify |
obj An instance of the SDK
|
file_name |
str The name of the file to be validated (when the platform uses files). |
db_key |
str The name of the key to be validated (when the platform uses a database). |
default_value_to_return |
dict/list/str The default value set when new file and
key are created. If no value is supplied, an internal default value of
|
identifier |
str The connector's identifier attribute. |
Returns
(dict)
The content inside the DataStream
object. The content passes through
json.loads
before returning.
TIPCommon.smp_io.read_ids
TIPCommon.smp_io.read_ids(siemplify, default_value_to_return=None, identifier=None, ids_file_name='ids.json', db_key='ids')
Read IDs from a ConnectorStream
object. If the object contains no data or
doesn't exist, return a default value.
Parameters | |
---|---|
siemplify |
obj An instance of the SDK
|
ids_file_name |
sttr The filename where IDs should be saved when a
|
db_key |
str The key name where IDs should be saved when a
|
default_value_to_return |
dict/list/str The default value to be set in case when
new file and key are created. If no value is supplied, an internal default
value |
identifier |
str The connector's identifier attribute. |
Returns
(list)
List of IDs inside the DataStream
object. The content passes through
json.loads
before returning.
TIPCommon.smp_io.read_ids_by_timestamp
TIPCommon.smp_io.read_ids_by_timestamp(siemplify, offset_in_hours=72, default_value_to_return=None, convert_to_milliseconds=False, cast_keys_to_integers=False, offset_is_in_days=False, identifier=None, ids_file_name='ids.json', db_key='ids')
Read IDs from a ConnectorStream
object. If the object contains no data or
doesn't exist, return a default value.
Parameters | |
---|---|
siemplify |
obj An instance of the SDK
|
offset_in_hours |
int The time limit (offset value) of the ID in hours. |
convert_to_milliseconds |
bool Transform each ID's timestamp (Unix) from seconds to milliseconds. |
cast_keys_to_integers |
bool Cast the keys to integers. |
offset_is_in_days |
bool If the offset supplied to this method is in days,
set the parameter to |
ids_file_name |
str The filename where IDs should be saved when a
|
db_key |
str The key name where IDs should be saved when a
|
default_value_to_return |
dict/list/str The default value to be set in case when new file and key are created. |
identifier |
str The connector's identifier attribute. |
Returns
(list)
List of IDs inside the DataStream
object. The content passes through
json.loads
before returning.
TIPCommon.smp_io.write_content
TIPCommon.smp_io.write_content(siemplify, content_to_write, file_name, db_key, default_value_to_set=None, identifier=None)
Write content into a ConnectorStream
object.
Parameters | |
---|---|
siemplify |
obj An instance of the SDK
|
content_to_write |
dict/list/str The content to be written to the dedicated data stream. |
file_name |
str The name of the file. |
db_key |
str The name of the key. |
default_value_to_set |
dict/list/str The default value set when new file and key are created. |
identifier |
str The connector's identifier attribute. |
Returns
None
TIPCommon.smp_io.write_ids
TIPCommon.smp_io.write_ids(siemplify, ids, default_value_to_set=None, stored_ids_limit=1000, identifier=None, ids_file_name='ids.json', db_key='ids')
Writes the last 1000 IDs into a ConnectorStream
object.
Parameters | |
---|---|
siemplify |
obj An instance of the SDK
|
ids |
list/str The IDs to be written to the dedicated data stream. |
stored_ids_limit |
int The number of recent IDs from the existing IDs which will be written. |
ids_file_name |
str The filename where IDs should be saved when a
|
db_key |
str The key name where IDs should be saved when a
|
default_value_to_set |
dict/list/str The default value set when new file and key are created. |
identifier |
str The connector's identifier attribute. |
Returns
None
TIPCommon.smp_io.write_ids_with_timestamp
TIPCommon.smp_io.write_ids_with_timestamp(siemplify, ids, default_value_to_set=None, identifier=None, ids_file_name='ids.json', db_key='ids')
Write IDs into a ConnectorStream
object with a timestamp.
Parameters | |
---|---|
siemplify |
obj An instance of the SDK
|
ids |
list/str The IDs to be written to the dedicated data stream. |
ids_file_name |
str The filename where IDs should be saved when a
|
db_key |
str The key name where IDs should be saved when a
|
default_value_to_set |
dict/list/str The default value to be set in case when new file and key are created. |
identifier |
str The connector's identifier attribute. |
Returns
None