Repository 'pg_import'
hg clone https://toolshed.g2.bx.psu.edu/repos/bgruening/pg_import

Changeset 0:2c43bac3579f (2019-04-24)
Commit message:
planemo upload for repository https://github.com/bgruening/galaxytools/tools/pgtools commit ab93c4c70fa487e55a24863a7786e102e7d92272
added:
macros.xml
pg-import.xml
test-data/init-galaxy-db.sql.in
test-data/pg_import_result1.pg.tar.bz2
test-data/pg_query_result1.txt
test-data/pg_query_result2.txt
b
diff -r 000000000000 -r 2c43bac3579f macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml Wed Apr 24 06:11:25 2019 -0400
[
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<macros>
+    <xml name="inputs_outputs">
+        <inputs>
+            <param format="tabular" help="" label="Input tabular dataset" name="in_file" type="data" />
+            <yield />
+        </inputs>
+        <outputs>
+            <data format="tabular" name="out_file" label="${tool.name} on ${on_string}" />
+        </outputs>
+    </xml>
+
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@PG_VERSION@">postgresql</requirement>
+            <requirement type="package" version="0.1">pglite</requirement>
+        </requirements>
+    </xml>
+
+    <token name="@PG_VERSION@">11.2</token>
+
+    <token name="@HELP_FOOTER@">
+    The postgresql tools, are using a postgresql database in user-space. Databases are packed into a tarball and stored in the user-history.
+    </token>
+
+    <token name="@UNTAR_INFILE@"><![CDATA[
+        tar -xjvf '$infile' &&
+        export PWD=`pwd` &&
+        sed -i.bak "s|unix_socket_directories.*|unix_socket_directories = '\$PWD/postgresql/'|" ./postgresql/db/postgresql.conf
+    ]]>
+    </token>
+
+    <token name="@PG_SETUP@"><![CDATA[
+        pglite setup -d ./postgresql &&
+        @PG_START@
+    ]]>
+    </token>
+
+    <token name="@PSQL@"><![CDATA[
+        psql "\$(pglite url -d ./postgresql)"
+    ]]>
+    </token>
+
+    <token name="@STATUS_RUNNING@"><![CDATA[
+        timeout 60 bash -c 'until pglite status -d ./postgresql | grep -F -q "server is running"; do sleep 1; done' &&
+        pglite status -d ./postgresql &&
+        timeout 60 bash -c 'until ls -la ./postgresql | grep -F -q ".s.PGSQL.5432"; do sleep 1; done'
+        && pglite status -d ./postgresql 
+    ]]>
+    </token>
+
+    <token name="@STOPPED@"><![CDATA[
+        timeout 60 bash -c 'until pglite status -d ./postgresql | grep -F -q "no server running"; do sleep 1; done'
+    ]]>
+    </token>
+
+    <token name="@PG_START@"><![CDATA[
+        pglite start  -d ./postgresql &&
+        @STATUS_RUNNING@
+    ]]>
+    </token>
+
+    <token name="@PG_STOP@"><![CDATA[
+        pglite stop -d ./postgresql &&
+        @STOPPED@
+    ]]>
+    </token>
+
+    <token name="@ARCHIVE_DATABASE@"><![CDATA[
+        tar -cvjf postgresql_out.tar.bz2 postgresql
+    ]]>
+    </token>
+    <xml name="citations">
+        <citations></citations>
+    </xml>
+</macros>
b
diff -r 000000000000 -r 2c43bac3579f pg-import.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pg-import.xml Wed Apr 24 06:11:25 2019 -0400
[
@@ -0,0 +1,36 @@
+<tool id="pg_import" name="Postgresql" version="@PG_VERSION@">
+    <description>import sql dump</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <command detect_errors="aggressive"><![CDATA[
+            @PG_SETUP@ &&
+            ls -l ./postgresql &&
+            @PSQL@ -f '$infile' -L logfile.log &&
+            @PG_STOP@ &&
+            @ARCHIVE_DATABASE@ &&
+            cat logfile.log
+    ]]>
+    </command>
+    <inputs>
+        <param format="txt" name="infile" type="data" label="Input SQL dump" />
+    </inputs>
+    <outputs>
+        <data format="postgresql" name="outfile" from_work_dir="postgresql_out.tar.bz2" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="infile" value="init-galaxy-db.sql.in" ftype="txt" />
+            <output file="pg_import_result1.pg.tar.bz2" name="outfile" ftype="postgresql" compare="sim_size" delta="200000" />
+        </test>
+    </tests>
+    <help>
+<![CDATA[
+
+@HELP_FOOTER@
+
+]]>
+    </help>
+    <expand macro="citations" />
+</tool>
b
diff -r 000000000000 -r 2c43bac3579f test-data/init-galaxy-db.sql.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/init-galaxy-db.sql.in Wed Apr 24 06:11:25 2019 -0400
b
b"@@ -0,0 +1,16059 @@\n+--\n+-- PostgreSQL database dump\n+--\n+\n+-- Dumped from database version 11.2\n+-- Dumped by pg_dump version 11.2\n+\n+SET statement_timeout = 0;\n+SET lock_timeout = 0;\n+SET idle_in_transaction_session_timeout = 0;\n+SET client_encoding = 'UTF8';\n+SET standard_conforming_strings = on;\n+SELECT pg_catalog.set_config('search_path', '', false);\n+SET check_function_bodies = false;\n+SET client_min_messages = warning;\n+SET row_security = off;\n+\n+SET default_tablespace = '';\n+\n+SET default_with_oids = false;\n+\n+--\n+-- Name: api_keys; Type: TABLE; Schema: public; Owner: lite\n+--\n+\n+CREATE TABLE public.api_keys (\n+    id integer NOT NULL,\n+    create_time timestamp without time zone,\n+    user_id integer,\n+    key character varying(32)\n+);\n+\n+\n+ALTER TABLE public.api_keys OWNER TO lite;\n+\n+--\n+-- Name: api_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: lite\n+--\n+\n+CREATE SEQUENCE public.api_keys_id_seq\n+    START WITH 1\n+    INCREMENT BY 1\n+    NO MINVALUE\n+    NO MAXVALUE\n+    CACHE 1;\n+\n+\n+ALTER TABLE public.api_keys_id_seq OWNER TO lite;\n+\n+--\n+-- Name: api_keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: lite\n+--\n+\n+ALTER SEQUENCE public.api_keys_id_seq OWNED BY public.api_keys.id;\n+\n+\n+--\n+-- Name: cleanup_event; Type: TABLE; Schema: public; Owner: lite\n+--\n+\n+CREATE TABLE public.cleanup_event (\n+    id integer NOT NULL,\n+    create_time timestamp without time zone,\n+    message character varying(1024)\n+);\n+\n+\n+ALTER TABLE public.cleanup_event OWNER TO lite;\n+\n+--\n+-- Name: cleanup_event_dataset_association; Type: TABLE; Schema: public; Owner: lite\n+--\n+\n+CREATE TABLE public.cleanup_event_dataset_association (\n+    id integer NOT NULL,\n+    create_time timestamp without time zone,\n+    cleanup_event_id integer,\n+    dataset_id integer\n+);\n+\n+\n+ALTER TABLE public.cleanup_event_dataset_association OWNER TO lite;\n+\n+--\n+-- Name: cleanup_event_dataset_association_id_seq; Type: SEQUENCE; Schema: public; Owner: lite\n+--\n+\n+CREATE SEQUENCE public.cleanup_event_dataset_association_id_seq\n+    START WITH 1\n+    INCREMENT BY 1\n+    NO MINVALUE\n+    NO MAXVALUE\n+    CACHE 1;\n+\n+\n+ALTER TABLE public.cleanup_event_dataset_association_id_seq OWNER TO lite;\n+\n+--\n+-- Name: cleanup_event_dataset_association_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: lite\n+--\n+\n+ALTER SEQUENCE public.cleanup_event_dataset_association_id_seq OWNED BY public.cleanup_event_dataset_association.id;\n+\n+\n+--\n+-- Name: cleanup_event_hda_association; Type: TABLE; Schema: public; Owner: lite\n+--\n+\n+CREATE TABLE public.cleanup_event_hda_association (\n+    id integer NOT NULL,\n+    create_time timestamp without time zone,\n+    cleanup_event_id integer,\n+    hda_id integer\n+);\n+\n+\n+ALTER TABLE public.cleanup_event_hda_association OWNER TO lite;\n+\n+--\n+-- Name: cleanup_event_hda_association_id_seq; Type: SEQUENCE; Schema: public; Owner: lite\n+--\n+\n+CREATE SEQUENCE public.cleanup_event_hda_association_id_seq\n+    START WITH 1\n+    INCREMENT BY 1\n+    NO MINVALUE\n+    NO MAXVALUE\n+    CACHE 1;\n+\n+\n+ALTER TABLE public.cleanup_event_hda_association_id_seq OWNER TO lite;\n+\n+--\n+-- Name: cleanup_event_hda_association_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: lite\n+--\n+\n+ALTER SEQUENCE public.cleanup_event_hda_association_id_seq OWNED BY public.cleanup_event_hda_association.id;\n+\n+\n+--\n+-- Name: cleanup_event_history_association; Type: TABLE; Schema: public; Owner: lite\n+--\n+\n+CREATE TABLE public.cleanup_event_history_association (\n+    id integer NOT NULL,\n+    create_time timestamp without time zone,\n+    cleanup_event_id integer,\n+    history_id integer\n+);\n+\n+\n+ALTER TABLE public.cleanup_event_history_association OWNER TO lite;\n+\n+--\n+-- Name: cleanup_event_history_association_id_seq; Type: SEQUENCE; Schema: public; Owner: lite\n+--\n+\n+CREATE SEQUENCE public.cleanup_event_history_association_id_seq\n+    START WITH 1\n+    INCREMENT BY 1\n+    NO MINVALUE\n+    NO MAXVALUE\n+    CACHE 1;\n+\n+\n+ALTER TABLE public.cleanup_event_his"..b' public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step_annotation_association\n+    ADD CONSTRAINT workflow_step_annotation_association_workflow_step_id_fkey FOREIGN KEY (workflow_step_id) REFERENCES public.workflow_step(id);\n+\n+\n+--\n+-- Name: workflow_step_connection workflow_step_connection_input_step_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step_connection\n+    ADD CONSTRAINT workflow_step_connection_input_step_id_fkey FOREIGN KEY (input_step_id) REFERENCES public.workflow_step(id);\n+\n+\n+--\n+-- Name: workflow_step_connection workflow_step_connection_input_subworkflow_step_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step_connection\n+    ADD CONSTRAINT workflow_step_connection_input_subworkflow_step_id_fkey FOREIGN KEY (input_subworkflow_step_id) REFERENCES public.workflow_step(id);\n+\n+\n+--\n+-- Name: workflow_step_connection workflow_step_connection_output_step_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step_connection\n+    ADD CONSTRAINT workflow_step_connection_output_step_id_fkey FOREIGN KEY (output_step_id) REFERENCES public.workflow_step(id);\n+\n+\n+--\n+-- Name: workflow_step workflow_step_subworkflow_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step\n+    ADD CONSTRAINT workflow_step_subworkflow_id_fkey FOREIGN KEY (subworkflow_id) REFERENCES public.workflow(id);\n+\n+\n+--\n+-- Name: workflow_step_tag_association workflow_step_tag_association_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step_tag_association\n+    ADD CONSTRAINT workflow_step_tag_association_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.tag(id);\n+\n+\n+--\n+-- Name: workflow_step_tag_association workflow_step_tag_association_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step_tag_association\n+    ADD CONSTRAINT workflow_step_tag_association_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.galaxy_user(id);\n+\n+\n+--\n+-- Name: workflow_step_tag_association workflow_step_tag_association_workflow_step_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step_tag_association\n+    ADD CONSTRAINT workflow_step_tag_association_workflow_step_id_fkey FOREIGN KEY (workflow_step_id) REFERENCES public.workflow_step(id);\n+\n+\n+--\n+-- Name: workflow_step workflow_step_workflow_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_step\n+    ADD CONSTRAINT workflow_step_workflow_id_fkey FOREIGN KEY (workflow_id) REFERENCES public.workflow(id);\n+\n+\n+--\n+-- Name: workflow workflow_stored_workflow_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow\n+    ADD CONSTRAINT workflow_stored_workflow_id_fkey FOREIGN KEY (stored_workflow_id) REFERENCES public.stored_workflow(id);\n+\n+\n+--\n+-- Name: workflow_tag_association workflow_tag_association_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_tag_association\n+    ADD CONSTRAINT workflow_tag_association_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.tag(id);\n+\n+\n+--\n+-- Name: workflow_tag_association workflow_tag_association_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_tag_association\n+    ADD CONSTRAINT workflow_tag_association_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.galaxy_user(id);\n+\n+\n+--\n+-- Name: workflow_tag_association workflow_tag_association_workflow_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: lite\n+--\n+\n+ALTER TABLE ONLY public.workflow_tag_association\n+    ADD CONSTRAINT workflow_tag_association_workflow_id_fkey FOREIGN KEY (workflow_id) REFERENCES public.workflow(id);\n+\n+\n+--\n+-- PostgreSQL database dump complete\n+--\n+\n'
b
diff -r 000000000000 -r 2c43bac3579f test-data/pg_import_result1.pg.tar.bz2
b
Binary file test-data/pg_import_result1.pg.tar.bz2 has changed
b
diff -r 000000000000 -r 2c43bac3579f test-data/pg_query_result1.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/pg_query_result1.txt Wed Apr 24 06:11:25 2019 -0400
b
@@ -0,0 +1,2 @@
+version
+135
b
diff -r 000000000000 -r 2c43bac3579f test-data/pg_query_result2.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/pg_query_result2.txt Wed Apr 24 06:11:25 2019 -0400
b
@@ -0,0 +1,1 @@
+id create_time update_time email password external deleted purged username form_values_id disk_usage activation_token active last_password_change