Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Basic Python 3 Classes for connecting to different types of Databases.

License

Notifications You must be signed in to change notification settings

fastskyz/SimpleDatabaseConnector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Python Database Connectors

Basic Python 3 class for connecting to Databases

I recommend using this as a super class for a custom class, as shown in the quickstart, but can be used without.

Main goal

This is something I built for personal (local) projects. I'll expand this repository when I need a new type of database connection for a project. By doing it this way, I have a nice all-in one package for all my different database connections. The goal is to keep the code and package as small and lightweigth as possible.

Supported Databases

These databases are tested and working with the current build.

  • AzureSQL
  • SQLServer Express

These databases should work, but are not (fully) tested

  • MySQL
  • SQLite

Defaults

  • port: 1433
  • driver: ODBC Driver 17 for SQL Server

Example Code

from SimpleSQLConnector.Connectors import SQLConnector

class CustomSQLConnector(SQLConnector):
    def __init__(self,
            password,
            server="my-server-endpoint",
            database="my-database-name",
            username="my-db-username",
        ):
        super().__init__(username, password, server, database)

db = CustomSQLConnector(password="my-db-password")

# Get a user by his/her id
id = "00000000-1234-5678-abcd-000000000001" # example uuid4
result = db.get_item_by_id("User", id)

print(result)

Wanted features

  • SQL Connector
  • Database Cache
  • MongoDB Connector

About

Basic Python 3 Classes for connecting to different types of Databases.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages