Skip to main content

Python package for connecting and importing data from different DataBases

Project description

Database Connector Package

Overview

dbsconnector is a Python package designed to simplify data integration from various sources, including CSV, Excel, Google Sheets, and MongoDB. The package provides a unified interface to connect, load, and process data with minimal setup, making it easier for Developers and Data Scientists to work across multiple data formats.

Current Features:

  • Connect to CSV files and load them into a Pandas DataFrame
  • Handle Excel files with multiple sheets
  • Fetch data from Google Sheets using an API key
  • Interact with MongoDB collections

Future Features (Upcoming):

  • Support for more databases (SQL, NoSQL)
  • Cloud storage integration (AWS S3, Google Cloud, etc.)
  • API-based data sources

Installation

To install the package, use pip:

pip install dbsconnector==1.3

How to use this package?

Connecting to csv

# import the module:
from dbsconnector.databases import CSV

# load csv file:
df = CSV().load_csv(filepath="filedir/filename.csv", delimiter=",")

# convert dataframe to csv file:
CSV().to_csv(data=df, filepath="filepath.csv")

Connecting to Excel

# import the module:
from dbsconnector.databases import Excel

# load the data:
df = Excel().load_excelsheet(filepath='filedir/filename.xlsx', sheet_name='sheet_name')

# convert dataframe to excel sheet:
Excel().to_excel(data=df, filepath='filedir/filename.xlsx', sheet_name='sheet_name')

Connecting to gsheet

# import the module:
from dbsconnector.databases import GSheet

# load the data:
df = GSheet().load_gsheet(gsheet_id='17r9f4BL7sjmdLBnt92OdQP3CHK5bdT3hozg6DUJXGqU',sheet_name='sample_sheet')

Connecting to MongoDB

# import the module:
from dbsconnector.databases import MongoDB

# load data from mongodb:
df = MongoDB(host_url="mongodb://localhost:27017").load_data(database="database_name", collection_name="collection_name")

# upload data to mongodb:
MongoDB(host_url="mongodb://localhost:27017").upload_data(database="database_name", collection_name="collection_name", data=df)

# upload any kind of objects (preprocessor object or ML model object) to mongodb:
MongoDB(host_url="mongodb://localhost:27017").upload_object(database="database_name", collection_name="collection_name", object_name="preprocessor_object", object_=preprocessor)

# loading object from mongodb:
pre_obj = MongoDB(host_url="mongodb://localhost:27017").load_object(database="database_name", collection_name="collection_name", object_name="preprocessor_object")

Contributions

  • Contributions are welcome! Please open an issue or submit a pull request on GitHub for adding new features, fixing bugs, or improving documentation. Open-source collaboration is highly encouraged!

License

This project is licensed under the MIT License.

Contact

For any questions or suggestions, please contact yuvaneshkm05@gmail.com

Connect

Connect with me on LinkedIn

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

dbsconnector-1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

dbsconnector-1.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file dbsconnector-1.3.tar.gz.

File metadata

  • Download URL: dbsconnector-1.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for dbsconnector-1.3.tar.gz
Algorithm Hash digest
SHA256 bb0a407f616b6d7dfc600002932d8b61769079a9dabbacdee6150405c4427596
MD5 6846be52aef733be0cb97683695f7ae6
BLAKE2b-256 192a2b07bc917e4502777691d727d79338fef581e007bfd903934377f902d67a

See more details on using hashes here.

File details

Details for the file dbsconnector-1.3-py3-none-any.whl.

File metadata

  • Download URL: dbsconnector-1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for dbsconnector-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3315480e0357657a9c7a9d3dbe6d886b0031c9b28eeefc0efa407ef4f7d8ca82
MD5 9f5b2e4e3612eb080e8d695a9ecc0433
BLAKE2b-256 d7b384c6c2233c4acdc167e6a968f1e4b19e94d1489351357916486a2269d6ca

See more details on using hashes here.

Supported by

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