[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [GSoC] Adding information to UDD and inject the rendering to tasks,py



Hi,

On Tue, Apr 7, 2015 at 1:46 PM, Andreas Tille <andreas@an3as.eu> wrote:

 ./only-run.sh blends-prospective
Traceback (most recent call last):
  File "/srv/udd.debian.org/udd//udd.py", line 86, in <module>
    exec "gatherer.%s()" % command
  File "<string>", line 1, in <module>
  File "/srv/udd.debian.org/udd/udd/blends_prospective_gatherer.py", line 422, in run
    cur.execute(query)
psycopg2.ProgrammingError: FEHLER:  Syntaxfehler bei „REPLACE“
LINE 1: ...RE bibref_insert (text, text, text, text, int) AS REPLACE IN...
                                                             ^

The REPLACE function works only in MySQL. In postgresql, there is not in-built function to update or insert. I am sending a patch which defines modifies 'udd/blends_prospective_gatherer.py'. I have written a function "Upsert" which returns a string - "UPDATE ..... SET .... WHERE...." or "INSERT INTO .... VALUES ...". This string is then appended to a "PREPARE ..... AS ...." query, and the final query is executed.  

I am sending a 'rows' parameter to Upsert() which basically is the count of rows in bibref table where the primary keys (source, key, package, rank) are checked and LIMIT 1. So, 
if rows == 0:
    "insert"
else:
    "update"
There are no packages which get updated, because there seem to be no records with duplicate primary keys. PFA  the output for the above (insert / update) code snippet. Can you please review the patch ?

Regards,
Akshita 
INSERT:  0 {'source': 'mauve', 'value': '10.1101/gr.2289704', 'key': 'doi', 'rank': 0, 'package': ''}

INSERT:  0 {'source': 'mauve', 'value': 'Aaron C. E. Darling and Bob Mau and Frederick R. Blattner and Nicole T. Perna', 'key': 'title', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': 'http://genome.cshlp.org/content/14/7/1394.short', 'key': 'url', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': 'Genome research', 'key': 'journal', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': 'Mauve: multiple alignment of conserved genomic sequence with rearrangements', 'key': 'author', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': '7', 'key': 'number', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': '14', 'key': 'volume', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': 'http://genome.cshlp.org/content/14/7/1394.full.pdf+html', 'key': 'eprint', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': '2004', 'key': 'year', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': '15231754', 'key': 'pmid', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': '1394-1403', 'key': 'pages', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauve', 'value': 'mauve', 'key': 'bibtex', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': '10.1371/journal.pone.0012651', 'key': 'doi', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': 'Murasaki: A Fast, Parallelizable Algorithm to Find Anchors from Multiple Genomes', 'key': 'title', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': 'http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0012651', 'key': 'url', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': 'PLOS one', 'key': 'journal', 'rank': 0, 'package': ''}

INSERT:  0 {'source': 'murasaki', 'value': 'Kris Popendorf and Hachiya Tsuyoshi and Yasunori Osana and Yasubumi Sakakibara', 'key': 'author', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': '9', 'key': 'number', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': '5', 'key': 'volume', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': 'http://www.plosone.org/article/fetchObject.action?uri=info:doi/10.1371/journal.pone.0012651&representation=PDF', 'key': 'eprint', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': '2010', 'key': 'year', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': '20885980', 'key': 'pmid', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': 'e12651', 'key': 'pages', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'murasaki', 'value': 'murasaki', 'key': 'bibtex', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': '10.1371/journal.pone.0011147', 'key': 'doi', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': 'progressiveMauve: multiple genome alignment with gene gain, loss and rearrangement', 'key': 'title', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': 'http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0011147', 'key': 'url', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': 'PloS one', 'key': 'journal', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': 'Aaron E. Darling and Bob Mau and Nicole T. Perna', 'key': 'author', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': '6', 'key': 'number', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': '5', 'key': 'volume', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': 'http://www.plosone.org/article/fetchObject.action?uri=info:doi/10.1371/journal.pone.0011147&representation=PDF', 'key': 'eprint', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': '2010', 'key': 'year', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': '20593022', 'key': 'pmid', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': 'e11147', 'key': 'pages', 'rank': 0, 'package': ''}


INSERT:  0 {'source': 'mauvealigner', 'value': 'mauvealigner', 'key': 'bibtex', 'rank': 0, 'package': ''}

Reply to: