Skip to main content

Official Nurtelecom DSML library

Project description

nurtelecom_gras_library

Official Python library for interacting with NurTelecom GRAS databases.

Features

  • Secure credential management via Vault
  • Easy database connection and querying
  • Generate SQL table creation queries from pandas DataFrames

Installation

pip install nurtelecom_gras_library

Usage

Modern Connection (Recommended)

from nurtelecom_gras_library import get_db_connection, get_all_cred_dict, make_table_query_from_pandas

# Retrieve credentials from Vault
all_cred_dict = get_all_cred_dict(
    vault_url=url,
    vault_token=token,
    path_to_secret='path_to_secret',
    mount_point='mount_point'
)

# Create a database connection
database_connection = get_db_connection('login', 'database', all_cred_dict)

# Run a query and get results as a pandas DataFrame
test_query = "select 1 from dual"
test_data = database_connection.get_data(query=test_query)

# Generate a CREATE TABLE SQL statement from the DataFrame
new_table_name = "test_table_name"
create_table_query = make_table_query_from_pandas(df=test_data, table_name=new_table_name)

# Execute the CREATE TABLE statement
database_connection.execute(create_table_query)

Legacy Connection

from nurtelecom_gras_library import PLSQL_data_importer, make_table_query_from_pandas

# Create a legacy database connection
database_connection = PLSQL_data_importer(
    user='user',
    password='pass',
    host='192.168.1.1',
    port='1521'
)

# Run a query and get results as a pandas DataFrame
test_query = "select 1 from dual"
test_data = database_connection.get_data(query=test_query)

# Generate a CREATE TABLE SQL statement from the DataFrame
new_table_name = "test_table_name"
create_table_query = make_table_query_from_pandas(df=test_data, table_name=new_table_name)

# Execute the CREATE TABLE statement
database_connection.execute(create_table_query)

License

MIT License

Contact

For questions or support, please contact the NurTelecom GRAS team.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nurtelecom_gras_library-2.2.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nurtelecom_gras_library-2.2.0-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file nurtelecom_gras_library-2.2.0.tar.gz.

File metadata

  • Download URL: nurtelecom_gras_library-2.2.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for nurtelecom_gras_library-2.2.0.tar.gz
Algorithm Hash digest
SHA256 b5bd6578637540f2d3b6c5528acb1ddd003f0df9dd2193291b5e8f1ad20d7e75
MD5 0e0361944e93d05c689a0ab814c02ec3
BLAKE2b-256 85406b6b91cc530e0d09d9b056ce71b930fda0d70e21bea21d8c7e6a4eee38b5

See more details on using hashes here.

File details

Details for the file nurtelecom_gras_library-2.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nurtelecom_gras_library-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e563b669e9053b84b04c764e8b947009c861095d0187237a3bbcd4c73c77226e
MD5 f9bfb7481ff8208426274b3fa2bb5930
BLAKE2b-256 16614899d4a7d0c1d35218b4d6217988f4cd7006f15f6303ed6bc8cc217937db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page