summaryrefslogtreecommitdiff
path: root/readyaml.py
diff options
context:
space:
mode:
Diffstat (limited to 'readyaml.py')
-rwxr-xr-xreadyaml.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/readyaml.py b/readyaml.py
index 8ba82fa..fac3c40 100755
--- a/readyaml.py
+++ b/readyaml.py
@@ -9,6 +9,7 @@ from debian.debian_support import version_compare
import sqlalchemy
import yaml
+from dedup import schema
from dedup.utils import configure_database_engine
def readyaml(conn, stream):
@@ -36,10 +37,10 @@ def readyaml(conn, stream):
architecture=metadata["architecture"],
source=metadata["source"], pid=pid)
else:
- pid = conn.execute(sqlalchemy.text("INSERT INTO package (name, version, architecture, source) VALUES (:name, :version, :architecture, :source);"),
+ pid = conn.execute(schema.package.insert().values(
name=package, version=metadata["version"],
architecture=metadata["architecture"],
- source=metadata["source"]).lastrowid
+ source=metadata["source"])).inserted_primary_key[0]
if metadata["depends"]:
conn.execute(sqlalchemy.text("INSERT INTO dependency (pid, required) VALUES (:pid, :required);"),
[dict(pid=pid, required=dep)
@@ -48,9 +49,9 @@ def readyaml(conn, stream):
if entry == "commit":
return
- cur = conn.execute(sqlalchemy.text("INSERT INTO content (pid, filename, size) VALUES (:pid, :filename, :size);"),
+ cid = conn.execute(schema.content.insert().values(
pid=pid, filename=entry["name"], size=entry["size"])
- cid = cur.lastrowid
+ ).inserted_primary_key[0]
if entry["hashes"]:
conn.execute(sqlalchemy.text("INSERT INTO hash (cid, fid, hash) VALUES (:cid, :fid, :hash);"),
[dict(cid=cid, fid=funcmapping[func], hash=hexhash)