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.2.tar.gz (8.9 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.2-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bellman_tools-0.1.2.tar.gz
  • Upload date:
  • Size: 8.9 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.2.tar.gz
Algorithm Hash digest
SHA256 0a4521c88ca5e74af20525847cf3ac5cec6d3c668eb769de96d660853b6bfe43
MD5 f8055489235f4614b7afdd2c080de64c
BLAKE2b-256 378b987ac719a2cf71b64dd3c90a8c498501ec8671937ce1a929e0b549b6ba81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bellman_tools-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 95840064689cd78781536a129607f151e87e1695aeea183c6702f12db9044d60
MD5 b878bdc7438f5e883f978a0a453412d5
BLAKE2b-256 885a8dbdb3b97e8331a47ca13851fc9124f7e53720ab0a26e1cf09bc6e8c4486

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