Hemanth's Scribes

python

Python Datasets

Author Photo

Hemanth HM

Thumbnail

dataset - databases for lazy people!

Install

pip install dataset

Why dataset?

Normal SQLite (26 lines): conn = sqlite3.connect(‘:memory:’) c = conn.cursor() c.execute(‘CREATE TABLE IF NOT EXISTS sometable…’)

… lots more code

With dataset (6 lines):python import dataset db = dataset.connect(‘sqlite:///:memory:’) table = db[‘sometable’] table.insert(dict(name=‘John Doe’, age=37)) table.insert(dict(name=‘Jane Doe’, age=34, gender=‘female’)) john = table.find_one(name=‘John Doe’)


Sweet! 🍯

See also: [Sequel::Dataset](http://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html) for Ruby.
#python#db
Author Photo

About Hemanth HM

Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.