Load a bulk of data from flat files or databases at once
Project description
Cmotions Dataloader
cmo_dataloader is a Python library created by The Analytics Lab, which is powered by Cmotions. This library combines our most used functionality when it comes to loading flat files or database tables into Python in bulk. Regarding flat files it also tries to take into account which separator, decimal sign and encoding to use when loading a file, this way the data is loaded automatically the best way possible, so you don't have to waste time fixing difficult bugs and errors. Nothing fancy, but very useful for our consultants. Mostly since this package is used in other packages, which makes our workflow simpler and more efficient.
Since we love to share what we do, why not also do that with our packages, that is why we've decided to make (almost) all of our packages open source, this way we hope to give back to the community that brings us so much. Enjoy!
Installation
Install cmo_dataloader using pip
pip install cmo-dataloader
If you want to be able to use the tutorial notebook or the code below, you also need to install dotenv using pip
pip install python-dotenv
Usage
import os
from dotenv import load_dotenv
from cmo_dataloader.resources import get_data_path
import cmo_dataloader as dl
load_dotenv()
# load flat files from a directory
dlc = dl.load_flat_file(get_data_path('formula_1'))
datafiles_dict = dlc.load()
# load tables from a SQL Server database
# using credentials stored in a .env file
ddu = dl.load_database(server=os.getenv("DB1_SERVER")
, db=os.getenv("DB1_DATABASE")
, server_name=os.getenv("DB1_SERVER_NAME")
, usr=os.getenv("DB1_USERNAME")
, pwd=os.getenv("DB1_PASSWORD")
, driver=os.getenv("DB1_DRIVER")
, port=os.getenv("DB1_PORT")
, tables=['dbo.mytable', 'dbo.anothertable'])
datafiles_dict = ddu.load()
# load tables from a SQL Server database
# using your Windows credentials
ddu = dl.load_database(server="localhost"
, db="mylocaldb"
, tables=['dbo.mytable', 'dbo.anothertable'])
datafiles_dict = ddu.load()
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
License
GNU General Public License v3.0
Contributors
Jeanine Schoonemann
Contact us
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
File details
Details for the file cmo_dataloader-0.1.0.tar.gz
.
File metadata
- Download URL: cmo_dataloader-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed638c62122338974aeff4790d813d282573d947350dac86d0f6cd1b6eb1cf82 |
|
MD5 | 340928a367efbd1400f022aa1da6c349 |
|
BLAKE2b-256 | 50653d90e62153eb671592fede8fe682115501b2ce69fae5a803a4f5b99e7546 |
File details
Details for the file cmo_dataloader-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: cmo_dataloader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 398b76a46dfbc9d49833827155f62ac0b8a65c00313933f2a8b255394153e033 |
|
MD5 | 2a9f21b22a83428d95712a952fa0c0db |
|
BLAKE2b-256 | ffd6bafb22ebfb4d6ef9fadbad7d8acdeba73fce5fca39c005e1036bc1c1e9df |