Skip to main content

Brahm Centre internal utility functions

Project description

brahm_centre_utils

init.py: This file will be run at the initialization. It will retrieve functions for quick function calling. Instead of "from bc_utils.salesforce import query_salesforce", it can be "from brahm-centre-utils import query_salesforce"

Brahm-centre-utils

Brahm-centre-utils is a collection of internal utility functions designed to facilitate common tasks at Brahm Centre. This package includes functions for Salesforce interactions, data processing, and more.

Installation

To install Brahm-centre-utils, you need to have pip and virtualenv set up on your system.

Using pip from a local directory

  1. Clone the repository or download the package to your local machine.
  2. Navigate to the project directory.
  3. Run the following command to install the package:
pip install /path/to/BC-UTILS-PACKAGE

Editable Mode (for development)

If you are developing the package and want changes to be immediately reflected in your projects:

pip install -e /path/to/BC-UTILS-PACKAGE

Usage

After installing the package, you can use the functions provided by Brahm-centre-utils in your projects. Below are some examples.

Salesforce Integration

query_salesforce

This function allows you to query Salesforce data using SOQL (Salesforce Object Query Language).

Example:

from salesforce import query_salesforce

# Use the function to query Salesforce
result = query_salesforce("SELECT Id, Name FROM Account")
print(result)

get_Id_from_SF_URL

This function extracts the Salesforce ID from a given Salesforce URL.

Example:

from salesforce import get_Id_from_SF_URL

# Extract Salesforce ID from URL
sf_id = get_Id_from_SF_URL("https://example.my.salesforce.com/0015g00000WvXXq")
print(sf_id)

Common Utilities

normalize_name

This function normalizes a given name by converting it to lowercase and removing extra spaces.

Example:

from common import normalize_name

# Normalize a name
name = normalize_name(" John Doe ")
print(name)  # Output: "john doe"

Full List of Functions

  • salesforce.query_salesforce
  • salesforce.get_Id_from_SF_URL
  • common.normalize_name
  • common.are_names_similar
  • common.get_unique_names

Configuration

Brahm-centre-utils requires certain environment variables for Salesforce integration. These should be stored in a .env file in the root of your project.

Example .env file

SF_USERNAME=your_salesforce_username
SF_PASSWORD=your_salesforce_password
SF_TOKEN=your_salesforce_security_token
SF_DOMAIN=your_salesforce_domain

Loading Environment Variables

Ensure that you load the environment variables at the start of your script.

from dotenv import load_dotenv
load_dotenv()

Upload new package version

  1. Change the version number
  2. Rebuild the Distribution Files
python setup.py sdist bdist_wheel
twine upload dist/*
  1. Install the New Version
twine upload dist/*

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

brahm_centre_utils-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brahm_centre_utils-0.1.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file brahm_centre_utils-0.1.1.tar.gz.

File metadata

  • Download URL: brahm_centre_utils-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for brahm_centre_utils-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e82014539be171872e11b9a30c949f29a35978deb3a33136cf8c89934898ae80
MD5 d0d3095e345cd17b3f1b3d6bf65638b1
BLAKE2b-256 3e3256e762727321d2f5a2e25c21720697a0a8194bc47441f0f69b785fdc37bb

See more details on using hashes here.

File details

Details for the file brahm_centre_utils-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for brahm_centre_utils-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2d536365230bdb5cd614e681bf3b63cfcafd188dc41c97c6dc73529df7166ef
MD5 fa0d178664dce56ebd6e9efe82bda3fd
BLAKE2b-256 1d759c4b8105bb6d5f854961ee272e26b37f7165e473e2bf505ff9b156d5d96c

See more details on using hashes here.

Supported by

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