SQLite3 support for file walkers.
New in version 0.2.
A file walker with SQLite support.
Different to base file walkers the SQLiteFSWalker stores results of filetree walks in a SQLite database. As a persistent file walker it can make assumptions about added and deleted files.
The database is opened using the given connection_string.
If you pass a path, the database will be created (if it does not exist yet) or reused.
In the database we use a table called filechanges which is expected to have the following format:
| Column | Type | Attributes/Remarks |
|---|---|---|
| id | integer | primary key |
| path | text | Absolute path |
| status | integer | Filechange status |
| ts | datetime | Timestamp |
Furthermore we create a unique index idx_path on path column and set the case_sensitive_like pragma to true, to get case-sensitive LIKE operators.
If the table does not exist already, it will be created on instantiation time of the class.
The string to connect to SQLite DB
Execute the SQL statement with args on cursor.
Safe SQL execution of the given SQL statement. Performs a rollback if unsuccessful and always commits.
Execute the SQL script with args on cursor.
Walk the filetree rooted at root_dir and message changes.
Changes are files, modified in time elapsed since stored timestamp of root_dir (ulif.pynotify.MODIFIED), files that are not yet in the database (ulif.pynotify.ADDED), and files that were in the database but cannot be found in filesystem anymore (ulif.pynotify.DELETED),.
Returns a generator of tuples, containing FSChange objects and a timestamp as datetime.datetime object, giving the datetime of last modification (if ADDED or MODIFIED) or current datetime (if DELETED).
The root_dir, despite of its name can also be a regular file.
Get timestamp for path.
Returns modification time of path as datetime.datetime object.