Mercurial > repos > kellrott > nosql_interface
comparison couchdb_client.xml @ 0:907b95ba9cf7 draft
Uploaded
author | kellrott |
---|---|
date | Tue, 24 Jul 2012 17:40:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:907b95ba9cf7 |
---|---|
1 <tool id="couchdb_client" name="CouchDB Client" version="1.0.0"> | |
2 <description>CouchDB Client</description> | |
3 <command interpreter="python">$scriptfile</command> | |
4 <inputs> | |
5 <param name="url" type="text" size="128" label="Server URL"/> | |
6 <param name="db" type="text" size="32" label="Database"/> | |
7 <param name="query" type="text" area="True" size="5x25" label="Query"> | |
8 <sanitizer> | |
9 <valid initial="string.printable"/> | |
10 <mapping initial="none"> | |
11 <add source=" " target="__cn__"/> | |
12 <add source=""" target="__dq__"/> | |
13 </mapping> | |
14 </sanitizer> | |
15 </param> | |
16 </inputs> | |
17 <outputs> | |
18 <data name="output" format="txt"/> | |
19 </outputs> | |
20 <configfiles> | |
21 | |
22 <configfile name="scriptfile"><![CDATA[#!/usr/bin/env python | |
23 import couchdb.client | |
24 import json | |
25 import galaxy.eggs | |
26 import galaxy.util | |
27 | |
28 server = couchdb.client.Server(galaxy.util.restore_text("$url")) | |
29 db = server['$db'] | |
30 | |
31 query=galaxy.util.restore_text("""$query""") | |
32 print query | |
33 result = db.query(query) | |
34 print result | |
35 handle = open(galaxy.util.restore_text("$output"), "w") | |
36 for row in result: | |
37 handle.write("{\"key\":%s, \"value\":%s}\n" % (json.dumps(row.key), json.dumps(row.value))) | |
38 handle.close() | |
39 | |
40 ]]></configfile> | |
41 </configfiles> | |
42 <help> | |
43 | |
44 | |
45 </help> | |
46 </tool> |