AWS_timestream module
- class AWS_timestream.timestream(database, table)
Bases:
object
Auto-setup SQL queries and utilize the awswrangler package to submit/query pandas dataframes to AWS Timestream database.
If tables or database do not exist, they will be automatically generated.
- Parameters:
database (str) – Name of timestream database
table (str) – Table in the timestream database.
- Return type:
None.
- delete_database()
Delete the timestream database.
- Return type:
None
- Returns:
DESCRIPTION.
- Return type:
None
- delete_table(table=None)
Delete a table within the timestream database.
- Return type:
None
- Parameters:
table (str, optional) – Name of table to delete. Will use the intial table name during object instantiation, if none provide here. The default is None.
- Return type:
None
- send_data(data, time_col, primary_col, secondary_col=[])
Send data to an AWS Timestream database.
- Return type:
None
- Parameters:
data (pandas.DataFrame) – Data to be inserted into Timestream database
time_col (str) – This data should be interpreted as time. This must be a datetime formated value.
primary_col (list) – These columns will be automatically assumed to be floats or ints in the timestream schema.
secondary_col (list, optional) – These columns will be automatically assumed to be char in the timestream schema. The default is [].
- Return type:
None
- get_data(most_recent=None, limit=None, time_col='time')
Submits an SQL query to Timestream to obtain all data from the database
SELECT * FROM "{database}"."{table}"
- Return type:
DataFrame
- Parameters:
most_recent (string, optional) – Provide an sql understandable time limit such as 15m, 24h, etc. The default is None.
limit (int, optional) – Limit the sql response to N number of entries. The default is None.
- Returns:
query_data – Result of SQL query.
- Return type:
pandas.DataFrame