Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SQLite wrapper that makes it easier to create and manage your DB

NotificationsYou must be signed in to change notification settings

coderholic/easydb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A really simpleSQLite wrapper that saves you from having to worry about creating tables or managing connections.

It can be used on existing SQLite database by simply passing in the database filename:

fromeasydbimportEasyDBdb=EasyDB('filename.db')cursor=db.query("SELECT * FROM mytable")

New databases can be creating by specifying your schema as a dictionary, eg:

schema= {'table_name': ['column_name column_type', …],'table_name': ['column_name column_type', …],'table_name': ['column_name column_type', …]}db=EasyDB('filename.db',schema)

If the database file already exists then the schema won't be updated, but if it doesn't exist then it'll be created with the given schema. Here's a full example:

fromeasydbimportEasyDBdb=EasyDB('my.db', {'users': ['username text','description text']})db.query("INSERT INTO users (username, description) VALUES (?, ?)", ('ben','some sort of description'))forresultindb.query("SELECT * FROM users"):printresult# => ('ben', 'some sort of description')

About

SQLite wrapper that makes it easier to create and manage your DB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp