Skip to main content
===========
DBMS - DataBases Made Simpler
===========

DBMS is a database took kit that wraps and provides
uniform interface to other DB API compliant adapters.

It manages connections, doing automatic imports and providing a
uniform connection method to most common databases.
Implements DictCursor, NamedTupleCursor and OrderedDictCursor.

It currently supports IBM DB2, Firebird, MSSQL Server, MySQL, Oracle,
PostgreSQL, SQLite and ODBC connections.

Sample usage::
>>> import dbms
>>> db = dbms.connect.postgres('UserName', 'SuperSecret', 'Chinook')
>>> cur = db.cursor()
>>> cur.execute('SELECT * FROM artist WHERE artistid = %s', (101,))
>>> row = cur.fetchone()
>>> row.pprint()
artistid : 101
name : Lulu Santos

# Database Inspection
>>> db.inspect.tables()
['album', 'artist', 'customer', 'employee', 'genre', 'invoice', 'invoiceline', 'mediatype', 'playlist', 'playlisttrack', 'track']
>>> db.inspect.columns('album')
['albumid', 'title', 'artistid']
>>> db.probe.getColumns('album')
[Record('albumid', 'integer', 'N', 'Y'),
Record('title', 'character varying', 'N', None),
Record('artistid', 'integer', 'N', None)]

# Saved connections
>>> dbms.servers.list()
['ChinookPg', 'ChinookLTE']
# open saved connection
>>> db = dbms.servers.open('ChinookPg')
Enter master password:
********

# logged cursor
>>> cur = db.loggedCursor()
>>> cur.execute('SELECT * FROM "Album" WHERE "ArtistId" = %s', (1,))
>>> dbms.logger.view(limit=1)
[Record('2014-07-01 08:11:48', 'ChinookPg', 'SELECT * FROM "Album" WHERE "ArtistId" = %s', (1))]

# utilities
>>> from dbms import utils
>>> query, params = utils.formatQuery(('SELECT * FROM Album WHERE ArtistId = ',
Param(1),
'AND AlbumId < ',
NamedParam('maxAlbumId', 50)),
cur.paramstyle)
>>> cur.execute(query, params)
>>> utils.cursorToXLSX(cur, '/tmp/AlbumList.xlsx')
>>> cur.execute('SELECT * FROM Album')
>>> utils.cursorToCursorCopy(cur, destCur, 'album')
>>> query = 'SELECT * FROM artist WHERE artistid BETWEEN %s AND %s'
>>> cur.execute(query, (100, 105))
>>> utils.cursorToJSON(cur)
[
{"artistid": 100, "name": "Lenny Kravitz"},
{"artistid": 101, "name": "Lulu Santos"},
{"artistid": 102, "name": "Marillion"},
{"artistid": 103, "name": "Marisa Monte"},
{"artistid": 104, "name": "Marvin Gaye"},
{"artistid": 105, "name": "Men At Work"},
]
>>> cur.execute(query, (100, 105))
>>> utils.cursorToFixedWidth(cur)
ARTISTID NAME
100 Lenny Kravitz
101 Lulu Santos
102 Marillion
103 Marisa Monte
104 Marvin Gaye
105 Men At Work

Metadata

Release files for dbms 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbms 1.1.1
File Size Uploaded
dbms-1.1.1.zip 28.0 kB Details

Release files / dbms-1.1.1.zip

Download URL dbms-1.1.1.zip
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
41a846ecaef3d88961dd8d2af5f99609b6fcfb991e4e5ec0aa189d9c500c4aa2
BLAKE2b-256 checksum
How to use checksums
ed94957ab10479fa8da6c5138c18c063e45d70f21a9a63b648cba944b2380260
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.1 This release

1 release file

1.1.0

1 release file

1.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page