SQLite is a in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose, commercial or private. SQLite is currently found in more applications than we can count, including several high-profile projects.
SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file. The database file format is cross-platform - you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures.
The SQLite library is a light-weight embedded SQL engine, with a nice DB-API compliant Python binding, originally developed by Michael Owens.
A newer version, called sqlite3, was added to Python’s standard library in Python 2.5 to up.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
db = sqlite3.connect("database.db") | |
c = db.cursor() | |
c.execute("create table mytable (timestamp, size, file)") | |
for file in os.listdir("."): | |
c.execute( | |
"insert into mytable values (?, ?, ?)", | |
os.path.getmtime(file), os.path.getsize(file), file | |
) | |
c.execute("select file, size from mytable where size > 1000000") | |
for file, size in c.fetchall(): | |
print file, size |
Hai,
ReplyDeleteSudah lama aku nggak blogwalking. Karena memang dah lama juga nggak blogging. Hehehehehe.... Datang sekedar menyapa. Semoga dirimu sehat dan selalu bahagia.... dan semoga belum lupa dengan persahabatan kita.
:)
Salam,
Ninneta
Alhamdulillah sehat,.. semoga kamu juga sehat
ReplyDelete