[Collab-qa-commits] r1777 - in udd: sql udd

Charles Plessy plessy at alioth.debian.org
Tue Aug 17 23:52:49 UTC 2010


Author: plessy
Date: 2010-08-17 23:52:49 +0000 (Tue, 17 Aug 2010)
New Revision: 1777

Added:
   udd/sql/bibref.sql
Modified:
   udd/udd/bibref_gatherer.py
Log:
Syntactic corrections to the bibref gatherer, and SQL table creation script.


Added: udd/sql/bibref.sql
===================================================================
--- udd/sql/bibref.sql	                        (rev 0)
+++ udd/sql/bibref.sql	2010-08-17 23:52:49 UTC (rev 1777)
@@ -0,0 +1,26 @@
+-- http://upstream-metadata.debian.net/for_UDD/biblio.yaml
+
+BEGIN;
+
+DROP TABLE IF EXISTS bibref CASCADE;
+
+CREATE TABLE bibref (
+	package			text NOT NULL,
+	key			text NOT NULL,
+	value			text NOT NULL
+);
+
+GRANT SELECT ON bibref TO PUBLIC;
+
+COMMIT;
+
+-- 'name'       --> 'package'
+-- 'section'
+-- 'maintainer'
+-- 'maintainer_email'
+-- 'version'
+-- 'homepage'
+-- 'description'
+-- 'url'
+-- 'large_image_url'
+-- 'small_image_url'

Modified: udd/udd/bibref_gatherer.py
===================================================================
--- udd/udd/bibref_gatherer.py	2010-08-16 20:26:53 UTC (rev 1776)
+++ udd/udd/bibref_gatherer.py	2010-08-17 23:52:49 UTC (rev 1777)
@@ -6,13 +6,14 @@
 
 from gatherer import gatherer
 from sys import stderr, exit
+from yaml import safe_load_all
 
 online=0
 
 def get_gatherer(connection, config, source):
   return bibref_gatherer(connection, config, source)
 
-class screenshot_gatherer(gatherer):
+class bibref_gatherer(gatherer):
   """
   Bibliographic references from upstream-metadata.debian.net.
   """
@@ -46,12 +47,11 @@
 
     for res in safe_load_all(result):
       package, key, value = res
-      query = """EXECUTE bibref_insert
-                        (%(package)s, %(key)s, %(value)s)"""
+      query = "EXECUTE bibref_insert (%s, %s, %s)"
       try:
-        cur.execute(query, res)
+        cur.execute(query, (package, key, value))
       except UnicodeEncodeError, err:
-        print >>stderr, "Unable to inject data for package %s. %s" % (res['name'], err)
+        print >>stderr, "Unable to inject data for package %s. %s" % (package, err)
         print >>stderr,  "-->", res
     cur.execute("DEALLOCATE bibref_insert")
     cur.execute("ANALYZE %s" % my_config['table'])
@@ -60,4 +60,3 @@
   main()
 
 # vim:set et tabstop=2:
-




More information about the Collab-qa-commits mailing list