Skip to main content

AnalyticsTool is a Python package designed to interface with PostgreSQL and MongoDB databases.

Project description

AnalyticsTool Package

Overview

AnalyticsTool is a Python package designed to interface with PostgreSQL and MongoDB databases, utilizing AWS Secrets Manager for secure access. It provides a streamlined way to query and manipulate data, ideal for analytics and data management tasks.

Features

  • Access and manage data in PostgreSQL and MongoDB databases.
  • Securely manage database credentials using AWS Secrets Manager.
  • Comprehensive query functionalities to retrieve and manipulate data.

Installation

Install AnalyticsTool via pip:

pip install web3m_analytic_tool

Configuration

Before using AnalyticsTool, configure the following environment variables in your .env file for AWS access:

  • AWS_ACCESS_KEY
  • AWS_SECRET_KEY
  • REGION

Usage

Initializing the Tool

Import and initialize AnalyticsTool with your AWS credentials:

from analytics import AnalyticsTool


aws_access_key = 'your access key'
aws_secret_key = 'your secret key'
region = 'your region'

analytics = AnalyticsTool(aws_access_key, aws_secret_key, region)

Example Usage

Fetch Data from PostgreSQL

Retrieve master user data:

master_users = analytics.get_all_master_users_dict()
print(master_users)

Query Data from MongoDB

Get documents from a specific collection:

documents = analytics.get_from_mongo_all_list_collection('your_collection_name')
print(documents)

API Reference

PostgreSQL Data Access

  • get_all_master_users_dict(): Get master user data.
  • get_all_sub_users_dict(): Get sub-user data.
  • get_all_wallet_activities_dict(): Get wallet activity data.
  • get_all_wallets_dict(): Get wallet data.

MongoDB Data Access

  • get_from_mongo_all_list_collection(collection_name): Get all documents from a specified collection.
  • get_from_mongo_records_by_filter(collection_name, user_id=None, type=None): Get filtered documents from a collection.

License

AnalyticsTool is released under the MIT License.

Contributing

Contributions to the AnalyticsTool project are welcome. Please refer to the CONTRIBUTING.md file for guidelines on how to contribute.

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

web3m_analytics_tool-0.1.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

web3m_analytics_tool-0.1.1-py3-none-any.whl (2.4 kB view hashes)

Uploaded Python 3

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