SDTcloud (1.1.74)
Installation
pip install --index-url SDTcloud
About this package
SDT cloud API Package
SDTcloud
SDTcloud is a package provided by SDT Co., Ltd.
It is a Python Library that provides that allows users to access desired resources and search data.
Installation
The only prerequisite for installing SDTcloud is Python itself. If you don't have Python. Go to https://www.python.org/ and Please Install Python.
SDTcloud can be installed with pip
with a package manager on macOS and Linux.
SDTcloud is not on the pypi official page, but can be installed through gitea link on gitea. If you want to install it, you can install it using the command below.
PIP
pip install --index-url http://43.200.53.170:32421/api/packages/1693984231778.jaehyunlee/pypi/simple/ SDTcloud
Dependencies Pakage
requests
json
pandas
IPython
datetime
cassandra-driver
psycopg2-binary
sqlalchemy
typing
Methods
- Common
- TimeStreamDB
- PostgresqlDB
- InfluxDB
- TimeScaleDB
- S3
- MinIO
- Git(Gitea)
Common
Function Name | Description |
---|---|
get_projects() | Get Projects List of User Organization in SDTcloud |
set_project() | Get Connection Information from Project use ProjectCode in SDTcloud |
TimeStreamDB
Function Name | Description |
---|---|
init_timestreamdb() | TimeStreamDB Client Init |
get_timestreamdb_table_info() | Get Tables Information of TimeStream Resource In SDT-Cloud |
get_timestreamdb_column_info(database_name, table_name) | Get Column Information from TimeStream Table |
get_timestreamdb_data(database_name, table_name, query_condition) | Get Data from TimeStream Table |
PostgresqlDB
Function Name | Description |
---|---|
init_postgresqldb() | PostgresqlDB Client Init |
get_postgresdb_table_info() | Get Tables Information of PostgreSQL Resource In SDT-Cloud |
get_postgresdb_column_info(table_name) | Get Column Information from PostgreSQL Table |
get_postgresdb_data(table_name, query_condition) | Get Data from PostgreSQL Table |
InfluxDB
Function Name | Description |
---|---|
init_influxdb() | InfluxDB Client Init |
get_measurements_from_influx_bucket() | Get Bucket Information of InfluxDB Resource In SDT-Cloud |
show_fields_from_measurement(bucket, measurement) | Get Fields Information from Influx Table |
get_data_from_measurement(bucket, measurement, query_condition) | Get Data from Influx Table |
TimeScaleDB
Function Name | Description |
---|---|
init_timescaledb() | TimescaleDB Client Init |
get_tables_from_timescaledb() | Get Tables Information of TimescaleDB Resource In SDT-Cloud |
show_columns_from_timescaledb(database, table) | Get columns Information from TimescaleDB Table |
get_data_from_timescaledb(database, table, query_condition) | Get Data from TimescaleDB Table |
MongoDB
Function Name | Description |
---|---|
init_mongodb() | MongoDB Client Init |
get_collections_from_mongodb() | Get Collections Information of MongoDB Resource In SDT-Cloud |
show_columns_from_mongodb_collection(database, collection) | Get columns Information from MongoDB Collection |
get_data_from_mongodb_client(database, collection, query_condition) | Get Data from MongoDB Collection |
CassandraDB
Function Name | Description |
---|---|
init_cassandradb(url, port, user, password) | CassandraDB Cluster Init |
get_tables_from_cassandra_cluster() | Get Tables Information of CassandraDB Resource In SDT-Cloud |
show_columns_from_cassandra_cluster(keyspace, table) | Get columns Information from CassandraDB table of keyspace |
get_data_from_cassandra_cluster(keyspace, table, query_condition) | Get Data from CassandraDB table |
AWS Keyspace
S3
Function Name | Description |
---|---|
s3_init() | S3 Client Init |
s3_file_upload(local_path, bucket_name) | File Upload to S3 bucket |
s3_file_download(bucket_name, object_key, local_path) | File Download from S3 bucket |
s3_list_objet(bucket_name) | Get objects list from S3 bucket |
s3_delete_object(bucket_name, file_name) | Delete file from S3 Bucket |
s3_create_bucket(bucket_name) | Create bucket from S3 |
s3_delete_bucket(bucket_name) | Delete bucket from S3 |
s3_bucket_list() | Get Buckets list from S3 |
MinIO
Function Name | Description |
---|---|
minio_init() | MinIO Client Init |
minio_file_upload(local_path, bucket_name) | File Upload to MinIO bucket |
minio_file_download(bucket_name, object_key, local_path) | File Download from MinIO bucket |
minio_list_object(bucket_name) | Get objects list from MinIO bucket |
minio_delete_object(bucket_name, file_name) | Delete file from MinIO Bucket |
minio_create_bucket(bucket_name) | Create bucket from MinIO |
minio_delete_bucket(bucket_name) | Delete bucket from MinIO |
minio_bucket_list() | Get Buckets list from MinIO |
Git(Gitea)
Function Name | Description |
---|---|
get_user_repository() | Get user owned repository list from Gitea |
get_public_repository() | Get public repository list from Gitea |
git_repo_init_folder(path='.') | Repository init local folder path |
git_repo_add_remote_url(remote_url, path='.') | Add remote url in local path |
clone_user_repository(clone_url) | Clone Gitea repository |
add_stage_file(file_path_for_add_stages='.') | Add stage file |
restore_staged_file(file_path_for_restore_stages) | Restore staged file |
commit_repository(commit_message) | Commit repository |
push_repository(push_file_path='.') | Push repository |
pull_repository(repository_url) | Pull Gitea repository |
create_repository(repo_name, private_flag=True) | Create Gitea Repository |
get_projects
SDTcloud.get_projects() [SOURCE CODE]
Get projects list in SDT-Cloud generated projects.
Examples
>>> import SDTcloud
>>> sdt_client = SDTcloud.SDTcloud()
>>> sdt_client.get_projects()
>>> code name tag owner description createdAt
0 07c8b452-4945-4b0f-99e0-3c9198de0b73 project1 demo {'id': '7ca0ced9-95b1-4830-9bba-ffe505efc832',... 1702014205963
1 ddbab848-6faf-4c3d-b9e4-d86fa9637706 project2 test {'id': '7ca0ced9-95b1-4830-9bba-ffe505efc832',... 1702011213200
set_project
SDTcloud.set_project() [SOURCE CODE]
Select the project the user wants and check the project’s connection information use index number.
Examples
>>> import SDTcloud
>>> sdt_client = SDTcloud.SDTcloud()
>>> sdt_client.get_projects()
>>> code name tag owner description createdAt
0 07c8b452-4945-4b0f-99e0-3c9198de0b73 project1 demo {'id': '7ca0ced9-95b1-4830-9bba-ffe505efc832',... 1702014205963
1 ddbab848-6faf-4c3d-b9e4-d86fa9637706 project2 test {'id': '7ca0ced9-95b1-4830-9bba-ffe505efc832',... 1702011213200
>>> sdt_client.set_project(0)
>>> S3 Bucket Preview
0
id 194374df-b635-47f9-aa4a-7d27d5725f85
projectCode 07c8b452-4945-4b0f-99e0-3c9198de0b73
name 07c8b452-4945-4b0f-99e0-3c9198de0b73
location http://07c8b452-4945-4b0f-99e0-3c9198de0b73.s3...
Database Preview
storageCode projectCode databaseName createdAt createdBy username password region url dbType accessKey secretAccessKey
0 5ea0ffce-bc7f-4543-b4f1-26e4646d26e5 07c8b452-4945-4b0f-99e0-3c9198de0b73 dl_07c8b452_4945_4b0f_99e0_3c9198de0b73 1702014207893 7ca0ced9-95b1-4830-9bba-ffe505efc832 dl_07c8b452_4945_4b0f_99e0_3c9198de0b73 07c8b452-4945-4b0f-99e0-3c9198de0b73 ap-northeast-2 sdtcl0ud-p0st9res-cluster.cluster-ccqdhccwc6wa... RDS_POSTGRES NaN NaN
1 302111ae-e70c-4093-b0c7-29d82f652471 07c8b452-4945-4b0f-99e0-3c9198de0b73 07c8b452_4945_4b0f_99e0_3c9198de0b73 1702014208961 7ca0ced9-95b1-4830-9bba-ffe505efc832 NaN NaN ap-northeast-1 NaN TIMESTREAM AKIAQB3AM4WPXQB7G3MH wi1eXIuwdM3TyEQuWBP6aUzL++AqqkPorwiFXw+4
init_timestreamdb
SDTcloud.init_timestreamdb() [SOURCE CODE]
Perform the TimeStreamDB Init task as a result of the connection information search.
Examples
>>> import SDTcloud
...
>>> sdt_client.init_timestreamdb()
get_timestreamdb_table_info
SDTcloud.get_timestreamdb_table_info() [SOURCE CODE]
Get Database with Table Information of TimeStreamDB
Examples
>>> import SDTcloud
...
>>> sdt_client.init_timestreamdb()
>>> sdt_client.get_timestreamdb_table_info()
>>>
get_timestreamdb_column_info
SDTcloud.get_timestreamdb_column_info(database_name, table_name) [SOURCE CODE]
Get column list DataFrame from TimeStreamDB table.
Parameters
database_name : Database name to query
table_name : Table name to query
Examples
>>> import SDTcloud
...
>>> sdt_client.get_timestreamdb_table_info()
>>>
>>> sdt_client.get_timestreamdb_column_info({database_name}, {table_name})
>>>
get_timestreamdb_data
SDTcloud.get_timestreamdb_data(database_name, table_name, query_condition) [SOURCE CODE]
Get query result DataFrame from TimeStreamDB table.
The query_condition type is dictionary, and the configuration is as follows.
- limit_count : query limit count (Default 1000)
- start_datetime : data query range start_datetime (format: YYYY-mm-DD HH:MM:SS)
- end_datetime : data query range end_datetime (format: YYYY-mm-DD HH:MM:SS)
- column_list : List of columns to search. If no value is entered, the entire column (*) is internally searched. ex.'column_a,column_b,column_c'
Parameters
database_name : Database name to query
table_name : Table name to query
query_condition : Search conditions dictionary
Examples
>>> import SDTcloud
...
...
>>> sdt_client.get_timestream_data({database_name}, {table_name}, {'limit_count': 500, 'start_datetime': '2023-12-07 00:00:00', 'end_datetime': '2023-12-07 23:59:59'})
>>>
init_postgresqldb
SDTcloud.init_postgresqldb() [SOURCE CODE]
Perform the PostgreSQL DB Init task as a result of the connection information search.
Examples
>>> import SDTcloud
...
>>> sdt_client.init_postgresqldb()
get_postgresdb_table_info
SDTcloud.get_postgresdb_table_info() [SOURCE CODE]
Get Database with Table Information of PostgreSQL DB
Examples
>>> import SDTcloud
...
>>> sdt_client.init_postgresqldb()
>>> sdt_client.get_postgresdb_table_info()
>>>
get_postgresdb_column_info
SDTcloud.get_postgresdb_column_info(table_name) [SOURCE CODE]
Get column list DataFrame from PostgreSQL DB table.
Parameters
table_name : Table name to query
Examples
>>> import SDTcloud
...
>>> sdt_client.get_postgresdb_table_info()
>>>
>>> sdt_client.get_postgresdb_column_info({table_name})
>>>
get_postgresdb_data
SDTcloud.get_postgresdb_data(table_name, query_condition) [SOURCE CODE]
Get query result DataFrame from PostgreSQL DB table.
The query_condition type is dictionary, and the configuration is as follows.
- limit_count : query limit count (Default 1000)
- start_datetime : data query range start_datetime (format: YYYY-mm-DD HH:MM:SS)
- end_datetime : data query range end_datetime (format: YYYY-mm-DD HH:MM:SS)
- column_list : List of columns to search. If no value is entered, the entire column (*) is internally searched. ex.'column_a,column_b,column_c'
Parameters
table_name : Table name to query
query_condition : Search conditions dictionary
Examples
>>> import SDTcloud
...
...
>>> sdt_client.get_postgresdb_data({table_name}, {'limit_count': 500, 'start_datetime': '2023-12-07 00:00:00', 'end_datetime': '2023-12-07 23:59:59'})
>>>
s3_init
SDTcloud.s3_init() [SOURCE CODE]
Perform the S3 Init task as a result of the connection information search.
Examples
>>> import SDTcloud
...
>>> sdt_client.s3_init()
s3_file_upload
SDTcloud.s3_file_upload(local_path: str, bucket_name: str) [SOURCE CODE]
Upload your files to S3.
Parameters
local_path : Current path to upload file
bucket_name : bucket name to upload
Examples
>>> import SDTcloud
...
>>> sdt_client.s3_init()
>>> sdt_client.s3_fiile_upload('./test.txt', {bucket_name})
>>>
s3_file_download
SDTcloud.s3_file_download(bucket_name: str, object_key: str, local_path: str) [SOURCE CODE]
Download file from S3.
Parameters
bucket_name : bucket_name to download
object_key : object_key to download
local_path : Path to save
Examples
>>> import SDTcloud
...
>>> sdt_client.s3_init()
>>> sdt_client.s3_file_download({bucket_name}, {keyname_in_bucket}, {local_path})
>>>
s3_list_objet
SDTcloud.s3_list_objet(bucket_name: str) [SOURCE CODE]
Get object list of S3 bucket
Parameters
bucket_name : bucket_name to query
Examples
>>> import SDTcloud
...
>>> sdt_client.s3_init()
>>> sdt_client.s3_list_objet({bucket_name})
>>>
s3_delete_object
SDTcloud.s3_delete_object(bucket_name: str, file_name: str) [SOURCE CODE]
Get object list of S3 bucket
Parameters
bucket_name : bucket_name to delete in S3
file_name : file_name to delete in S3
Examples
>>> import SDTcloud
...
>>> sdt_client.s3_init()
>>> sdt_client.s3_delete_object({bucket_name}, {file_name})
>>>