diff options
author | Helmut Grohne <helmut@subdivi.de> | 2014-03-08 17:38:26 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2014-03-08 17:38:26 +0100 |
commit | e6cc6c64ab46f5d724c8121cdc7deeb48a3bcbfc (patch) | |
tree | cf390ea544ff017f8f1018c19c30af7a50fa40ec /update_sharing.py | |
parent | f846a2487c3d7c14f07e7f9b3d5aa0d803733ed9 (diff) | |
download | debian-dedup-e6cc6c64ab46f5d724c8121cdc7deeb48a3bcbfc.tar.gz |
add sqlalchemy.text wrappersqlalchemy
Without the wrapper sqlalchemy chokes on the query and tries to index
some dictionary on postgres.
Diffstat (limited to 'update_sharing.py')
-rwxr-xr-x | update_sharing.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/update_sharing.py b/update_sharing.py index e41bceb..b6b0fdb 100755 --- a/update_sharing.py +++ b/update_sharing.py @@ -67,9 +67,9 @@ def main(db): conn.execute(sqlalchemy.text("INSERT INTO duplicate (cid) VALUES (:cid);"), cid=cid) process_pkgdict(conn, pkgdict) - conn.execute("INSERT INTO issue (cid, issue) SELECT content.id, 'file named something.gz is not a valid gzip file' FROM content WHERE content.filename LIKE '%.gz' AND NOT EXISTS (SELECT 1 FROM hash JOIN function ON hash.fid = function.id WHERE hash.cid = content.id AND function.name = 'gzip_sha512');") - conn.execute("INSERT INTO issue (cid, issue) SELECT content.id, 'png image not named something.png' FROM content JOIN hash ON content.id = hash.cid JOIN function ON hash.fid = function.id WHERE function.name = 'png_sha512' AND lower(filename) NOT LIKE '%.png';") - conn.execute("INSERT INTO issue (cid, issue) SELECT content.id, 'gif image not named something.gif' FROM content JOIN hash ON content.id = hash.cid JOIN function ON hash.fid = function.id WHERE function.name = 'gif_sha512' AND lower(filename) NOT LIKE '%.gif';") + conn.execute(sqlalchemy.text("INSERT INTO issue (cid, issue) SELECT content.id, 'file named something.gz is not a valid gzip file' FROM content WHERE content.filename LIKE '%.gz' AND NOT EXISTS (SELECT 1 FROM hash JOIN function ON hash.fid = function.id WHERE hash.cid = content.id AND function.name = 'gzip_sha512');")) + conn.execute(sqlalchemy.text("INSERT INTO issue (cid, issue) SELECT content.id, 'png image not named something.png' FROM content JOIN hash ON content.id = hash.cid JOIN function ON hash.fid = function.id WHERE function.name = 'png_sha512' AND lower(filename) NOT LIKE '%.png';")) + conn.execute(sqlalchemy.text("INSERT INTO issue (cid, issue) SELECT content.id, 'gif image not named something.gif' FROM content JOIN hash ON content.id = hash.cid JOIN function ON hash.fid = function.id WHERE function.name = 'gif_sha512' AND lower(filename) NOT LIKE '%.gif';")) if __name__ == "__main__": parser = optparse.OptionParser() |