Libreria para data engineering
Project description
treinta_redshift
treinta_redshift es una librería Python diseñada para facilitar la interacción con Amazon Redshift, permitiendo a los usuarios de Python realizar operaciones comunes como consultar datos, cargar datos desde y hacia S3, ejecutar procedimientos almacenados, y manejar tablas dentro de Redshift de una manera sencilla y eficiente.
Características
- Consultar datos de Redshift y cargar los resultados en un DataFrame de pandas.
- Exportar DataFrames de pandas a S3 en formatos CSV o Parquet.
- Cargar datos desde archivos en S3 a tablas en Redshift.
- Ejecutar procedimientos almacenados en Redshift.
- Truncar y eliminar tablas en Redshift.
Instalación
Puedes instalar treinta_redshift utilizando pip:
pip install treinta_redshift
Uso
Consultar Datos de Redshift
from treinta_redshift import query_to_dataframe
sql_query = "SELECT * FROM mi_esquema.mi_tabla LIMIT 10;"
df = query_to_dataframe(sql_query, cluster_identifier='micluster', database='midatabase', db_user='miusuario')
print(df)
Cargar Datos a S3
from treinta_redshift import dataframe_to_s3
import pandas as pd
df = pd.DataFrame({'col1': [1, 2], 'col2': ['A', 'B']})
s3_path = dataframe_to_s3(df, bucket='mi-bucket-s3')
print(f"Datos cargados a {s3_path}")
Cargar Datos desde S3 a Redshift
from treinta_redshift import load_s3_to_redshift
load_s3_to_redshift('mi_tabla', 's3://mi-bucket-s3/mi-archivo.csv', cluster_identifier='mi-cluster', database='mi-database', db_user='mi-usuario')
Licencia
Este proyecto está licenciado bajo la Licencia MIT - vea el archivo LICENSE.md para más detalles.
Soporte
Si encuentras un problema o tienes una pregunta, por favor abre un issue en el repositorio de GitHub.
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 treinta_redshift-0.1.4.tar.gz.
File metadata
- Download URL: treinta_redshift-0.1.4.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0909b1ac215062f4063fe6ad8f777b6f0cc51ee8fd0be40664a31d905d989218
|
|
| MD5 |
084c7fb494e5315e98aa7d01025cd62f
|
|
| BLAKE2b-256 |
433549b6436539e7fb7edd2a8e7304c5fbb134f92645b5e706aab8c466ae0db7
|
File details
Details for the file treinta_redshift-0.1.4-py3-none-any.whl.
File metadata
- Download URL: treinta_redshift-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
691f4ecf894050d51f58ccf86eac372d9256aa1a9971fba39e4775234fa3d085
|
|
| MD5 |
3e09a89571c1ab73ffedda480607c23e
|
|
| BLAKE2b-256 |
fec9adbbc7c272af655ab709adc0853203c05b3d82eca44fee44896c5aada920
|