Skip to content

luivilella/dbaggregator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dbaggregator

==============

Package helpful to manage database connections

Instalation

pip install git+https://github.com/luivilella/dbaggregator.git

Basic Usage

from dbaggregator import DBAggregator

db = DBAggregator()

db.add('psql', 'postgresql+psycopg2://usr:123change@127.0.0.1:5432/localdb')
db.add('mysql', 'mysql://usr:123change@127.0.0.1:3306/localdb')
db.add('sqlite', ''sqlite:///tests/foo.db'')

sess = db.psql.session()
tbls = db.psql.tables

#find
row = sess.query(tbls.TableA).filter(tbls.TableA.id == 1).first()

#insert
obj = TableA()
obj.name = 'test'

sess.add(obj)
sess.commit()

#sql
sess.execute('SELECT * FROM table_a')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages