Skip to main content

bellman_tools

Project description

Bellman Tools (bellman_tools)

Python tools to upload data into SQL Server using SQL Alchemy

Installation

  • pip install bellman-tools

Usage

SQL Tools

To retrieve data from a SQL Server. You need first to add connection string to the .env file in the project root folder.

Example of the .env file:

DATABASE_CONNECTION_STRING="mssql+pyodbc://user:password@server_name:1433/{db}?driver=SQL+Server"

Then you can execute this python code :

from bellman_tools import sql_tools
SQL = sql_tools.Sql(db='DB')
df = SQL.load_dataframe_from_query("SELECT TOP 1 * FROM Test")

Notes on environment loading

  • bellman_tools.sql_tools looks for a .env file only in your current working directory (typically your project root) when it is imported. If it does not find one, it prints the current directory and continues.
  • Best practice is to set environment variables outside of your code (shell, CI/CD secrets, process manager). The .env loading is a convenience fallback.

Upload Tools

To upload data into a SQL Server database.

import pandas as pd
from bellman_tools import sql_tools, upload_tools

SQL = sql_tools.Sql(db='SAM')
UPLOAD = upload_tools.Upload(SQL)

from bellman_tools.database import Test

df = pd.DataFrame([dict(Test='Testing with Upload tools')])

UPLOAD.load_basic_df_to_db(
    df,
    SQL_Alchemy_Table=Test.Test,
)

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

bellman_tools-0.1.4.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

bellman_tools-0.1.4-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file bellman_tools-0.1.4.tar.gz.

File metadata

  • Download URL: bellman_tools-0.1.4.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for bellman_tools-0.1.4.tar.gz
Algorithm Hash digest
SHA256 52df4c39ecb8fc0b660246790ae965143d6fefbc5f9e208ec85e4d06c8f0cc2e
MD5 b0a8a6ecb2b0c2a483fad5294698a03b
BLAKE2b-256 5f78722d01bfb049e93277e6c45eff0bfe8034f9d65c85837b6a36a76af12651

See more details on using hashes here.

File details

Details for the file bellman_tools-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: bellman_tools-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for bellman_tools-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 02631ba7f474503f9fd2813a416dd1e88a5a166cf1899cdec2389c9466cc7fcd
MD5 6e0ce93351e1fb361031a042e9df21d5
BLAKE2b-256 35aa8d86ca1a1d65a56ffb25a2fc26b76bc7230d34690c2dbf05cbfa0f96db02

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