6 Replies Latest reply on Feb 11, 2019 2:55 PM by Manoj Dixit

    How easily I can copy SQL query results to Confluence.

    Manoj Dixit

      Hi,

       

      At work we are using SQL Developer 4.0.3.16.

       

      I want to know if there's an easy and straight forward way to copy SQL query results from the 'Query Results' pane and paste to Confluence (which is owned by Atlassian), easily. At the moment, I have to export the query results to Excel, then copy them from an Excel sheet and paste them to a Confluence page as part of my work documentation. In Confluence, I have tried different add-ins but I have not been able to convert comma, pipe or tab separated contents to proper tables in Confluence. I have referred to Confluence forum as well to see how it's done (and I shall continue exploring). When copied an Excel sheet's contents and pasted to a Confluence page, they appear as a proper table without any special text-to-table conversion.

       

      If someone knows the trick, that will really help me.

       

      Thanks and regards,

       

      Manoj.

        • 1. Re: How easily I can copy SQL query results to Confluence.
          daniel_hauke

          Hi Manoj,

           

          i have done something similar, but i took another approach.

           

          We also wanted to have result of a SQL Query and have this informations in a Confluence Page in a table format. And we wanted this to be updated on a daily base.

          So i wrote a shell script which executes the sql query, generates a csv file, splits this into proper html tags and creates a JSON File out of that all.

          This JSON File is uploaded via the Confluence RestAPI.

           

          The Result is that we have our informations from the sql query in a confluence page in a table format. This script is run by an daily cronjob so we always have actual informations in our table in confluence.

           

          You can take a look at the confluence restapi documentation if you want to: https://docs.atlassian.com/ConfluenceServer/rest/6.14.1/

           

          Greetings Daniel

          • 2. Re: How easily I can copy SQL query results to Confluence.
            thatJeffSmith-Oracle

            so..you know you can do with with ORDS, yes?

            • 3. Re: How easily I can copy SQL query results to Confluence.
              daniel_hauke

              Hi Jeff,

               

              yes, i knew that i can create json with ORDS, but i didn't knew that i can talk directly to the confluence rest api. Because the confluence api needs the informations return by the sql statement in an html table syntax this was my preferred way. And it works like a charm :-)

               

              But i think i will take a closer look to ORDS. Perhaps it will cover it more easily.

               

              Greetings Daniel

              • 4. Re: How easily I can copy SQL query results to Confluence.
                Manoj Dixit

                Hi Daniel,

                 

                Thanks for your reply.

                 

                In this instance I am not looking for an advanced solution. My requirement is just to show little data from the database in a tabular format.

                 

                I have got my original process little less cumbersome now by pasting the query rows from the SQL Developer 'Query Results' pane to an un-named Excel file and from there to the Confluence page (thereby avoiding the export altogether). I am providing the SQL queries too to the readers of the Confluence page so that they themselves can run the SQL and see the latest results later whenever they want.

                 

                Regards,

                 

                Manoj.

                • 5. Re: How easily I can copy SQL query results to Confluence.
                  B.Delmée

                  Not fully automated, but what i've done when pasting to wiki is export my result-set from grid to clipboard as delimited with a vertical bar as delimiter.

                  Then, paste result in a fresh worksheet (i actually use gvim), and replace both start of line (^) and end of line ($) with a vertical bar, and finally double the bars in the first header line, done.

                  It would be nice if this was supported as an extra export format, for sure (but then different wikis support different markups...)

                  1 person found this helpful
                  • 6. Re: How easily I can copy SQL query results to Confluence.
                    Manoj Dixit

                    Thanks for the update. I can now use the same technique (Export >> Pipe Delimited >> Clipboard). And in Confluence use an option to Insert Markup (Confluence Wiki). As they are small data sets, I can manually add a pipe character to each of the lines at the beginning and it produces a table which I can then format further. Got rid of the Excel interface now completely now.