A Module to enable Hepsiburada Data Science Team to utilize different tools.
Project description
Hepsiburada Data Science Utilities
This module includes utilities for Hepsiburada Data Science Team.
Library is available via PyPi.
Library can be downloaded using pip as follows: pip install heps-ds-utils
Existing library can be upgraded using pip as follows: pip install heps-ds-utils --upgrade
Available Modules
- Hive Operations
import os
from heps_ds_utils import HiveOperations
# A connection is needed to be generated in a specific runtime.
# There are 3 ways to set credentials for connection.
# 1) Instance try to set default credentials from Environment Variables.
hive_ds = HiveOperations()
hive_ds.connect_to_hive()
# 2) One can pass credentials to instance initiation to override default.
hive_ds = HiveOperations(HIVE_HOST="XXX", HIVE_PORT="YYY", HIVE_USER="ZZZ", HIVE_PASS="WWW", HADOOP_EDGE_HOST="QQQ")
hive_ds.connect_to_hive()
# 3) One can change any of the credentials after initiation using appropriate attribute.
hive_ds = HiveOperations()
hive_ds.hive_username = 'XXX'
hive_ds.connect_to_hive()
# Execute an SQL query to retrieve data.
# Currently Implemented Types: DataFrame, Numpy Array, Dictionary, List.
SQL_QUERY = "SELECT * FROM {db}.{table}"
data, columns = hive_ds.execute_query(SQL_QUERY, return_type="dataframe", return_columns=False)
# Execute an SQL query to create and insert data into table.
SQL_QUERY = "INSERT INTO .."
hive_ds.create_insert_table(SQL_QUERY)
# Send Files to Hive and Create a Table with the Data.
# Currently DataFrame or Numpy Array can be sent to Hive.
# While sending Numpy Array columns have to be provided.
SQL_QUERY = "INSERT INTO .."
hive_ds.send_files_to_hive("{db}.{table}", data, columns=None)
# Close the connection at the end of the runtime.
hive_ds.disconnect_from_hive()
- BigQuery Operations
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 heps_ds_utils-0.2.0.tar.gz.
File metadata
- Download URL: heps_ds_utils-0.2.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/2.7.18 Darwin/21.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df75767b81c2fff310f5e5b540da5a103c4b51a9815488c2591a6379d75aed7e
|
|
| MD5 |
52cfd7f2105fbc9c133e3e893fb2c13a
|
|
| BLAKE2b-256 |
1bde0ea1571095f8ae7284d33c980e66fe98db25fc1cf0139e0ac9820a923214
|
File details
Details for the file heps_ds_utils-0.2.0-py3-none-any.whl.
File metadata
- Download URL: heps_ds_utils-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/2.7.18 Darwin/21.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0e2fee57f8397f26d9d2ca16c29c6ea5f1744d8364357f5d3e9ff8ed343ee7e
|
|
| MD5 |
e84bb102837cbe1bb625eaabd0fb869d
|
|
| BLAKE2b-256 |
1afb9901a64b30183730d9289b605b96b4f26c64d57c64d41573b876bbb0b2e0
|