Utility for TimescaleDB
Project description
Enable Timescale Extension in Postgres
enable_timescale()
Returns True if enabled. Else Returns Error
Check Timescale Extension Enabled in Postgres
check_timescale()
Returns True if Enabled else False
Creating Table
create_table(tablename,table_data)
| Parameter | Type | Description |
|---|---|---|
tablename |
string |
Required. Table Name |
table_data |
list |
Required. Column Name and Datatypes |
table_data = [['id', 'bigint', 0], ["names", "varchar", 200], ['t_modified', 'timestamp', 0]]
Datatypes
{
"bigint": "BIGINT",
"boolean": "BOOLEAN",
"character": "CHAR",
"varchar": "VARCHAR",
"date": "DATE",
"float": "FLOAT",
"int": "INTEGER",
"interval": "Interval",
"json": "JSON",
"numeric": "NUMERIC",
"smallint": "SMALLINT",
"text": "TEXT",
"time": "TIME",
"timestamp": "TIMESTAMP"
}
Creating Index :
create_index(table_name,columns)
| Parameter | Type | Description |
|---|---|---|
table_name |
string |
Required. Table Name |
columns |
list |
Required. Column Name where you want to index |
columns = ["c3","date_time"]
Creating Hypertable :
create_hypertable(table_name,column_name)
| Parameter | Type | Description |
|---|---|---|
table_name |
string |
Required. Table Name |
column_name |
string |
Required. On which Column you want to Create Hypertable. Should be TIMESTAMP column only |
Select Data :
selectgroupdata(select_type,group_by, start, end, where, orcondition, order_by,column_name,limit)
| Parameter | Type | Description |
|---|---|---|
select_type |
string |
Required. Which type need to be selected. Sum / Average /Cols/All |
start |
string/datetime |
Required. Start Time |
end |
string/datetime |
Required. End Time |
where |
dictionary |
Required. Add single or multiple conditions based on column and values |
orcondition |
dictionary |
Required. Adding OR conditions based on column and values |
order_by |
list |
Required. Order By Column Name ASC/DESC |
group_by |
string |
Required. Group By Column Name |
column_name |
list |
Required. Add extra Column Name |
limit |
list |
Required. For adding Limit. [limit,offset] |
where = {"column_1":"value","column_2":"value2"}
orcondition = {"column_1":"value","column_2":"value2"}
order_by = ["column_name","desc"]
column_name = ["column_1","column_2","column_3"]
limit = ["limit","offset"]
Insert Data :
insert(dataset)
| Parameter | Type | Description |
|---|---|---|
dataset |
dictionary |
Required. Set of Data to be inserted. Format is given below |
dataset = [
{
"c3": "site_100$line_4888$equipment_6888$tag_60888",
"c1": "site_123",
"c5": "tag_11111",
"l1": "site_888",
"l2": "line_4888",
"l3": "equipment_6888",
"value": "260",
"time_stamp": "1669022699000",
"date_time": "2022-11-21 14:54:57"
},
{
"c3": "site_400$line_4444$equipment_6444$tag_60444",
"c1": "site_456",
"c5": "tag_22222",
"l1": "site_444",
"l2": "line_4444",
"l3": "equipment_6888",
"value": "260",
"time_stamp": "1669022699000",
"date_time": "2022-11-21 14:54:57"
}]
Delete Data :
delete(where)
| Parameter | Type | Description |
|---|---|---|
where |
dictionary |
Required. Add single or multiple conditions based on column and values. Format given below |
where = {
"column_1": "value_1",
"column_2": "value_2"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timescaleutils-0.2.1.tar.gz.
File metadata
- Download URL: timescaleutils-0.2.1.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
223d7fda1195718df645ed5a706922229ab7054ec76520df0eaf736b89795c51
|
|
| MD5 |
c00319b298375f208835951124bba3ae
|
|
| BLAKE2b-256 |
37714ff482ef46c98ca712dcd4779fad483d3b2b8649a8e6b4fb61f2e029ca2e
|
File details
Details for the file timescaleutils-0.2.1-py3-none-any.whl.
File metadata
- Download URL: timescaleutils-0.2.1-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a28edd4442c38b76674f8eedb0e4805a599898b789f11b803666add69a5e0094
|
|
| MD5 |
df1737a37a11b2d1463d3db5be08e0a6
|
|
| BLAKE2b-256 |
a7391cc91cfb9843437b9137a45e1f52e35fb309af4c83ecaa12258c4dfadfe2
|