diff options
| author | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-10-24 20:16:20 -0400 |
|---|---|---|
| committer | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-10-24 20:16:20 -0400 |
| commit | fafbde26383e42858538046d4b2b3691e21bd898 (patch) | |
| tree | b8f9d164305e92d1bbc8b7f5a278c195a3903a16 /scripts/fill.image_urls.py | |
| parent | d79fb90ae279d0f46606c305688e97e73374eacc (diff) | |
Update python scripts
Diffstat (limited to 'scripts/fill.image_urls.py')
| -rw-r--r-- | scripts/fill.image_urls.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/fill.image_urls.py b/scripts/fill.image_urls.py index 79280b9..4f7c2ea 100644 --- a/scripts/fill.image_urls.py +++ b/scripts/fill.image_urls.py @@ -12,6 +12,13 @@ def get_num_images_in_db(): ps = db.prepare("SELECT COUNT(*) FROM image_urls") return int(ps()[0][0]) +def vacuum_and_analyze(): + print("cleaning db") + ps = db.prepare("VACUUM image_urls") + ps() + ps2 = db.prepare("ANALYZE image_urls") + ps2() + def add_url(url): try: print(url) @@ -83,3 +90,4 @@ if __name__ == "__main__": num_new_images = get_num_images_in_db() - num_existing_images percent_new_images = num_new_images / len(urls) * 100 print(num_new_images, " were new (", percent_new_images ,"%)") + vacuum_and_analyze() |
