locked
how to pass output of compose(json) to azure blob and store in azure blob RRS feed

  • Question

  • HI

    I fetching the data from sql table after that i will get output as a json, then i need to store those json to azure blob storage in one folder.

    please help on this.


    Wednesday, July 25, 2018 6:06 AM

Answers

  • Hi Sayyad,

    You need to pass body of fetched data action as content to create blob action . Below is the sample definition which you can use 

     "Create_message_with_sql_resultset": {
                            "inputs": {
                                "body": "@body('Get_sql_storedprocedure_result')",
                                "host": {
                                    "connection": {
                                        "name": "@parameters('$connections')['azureblob_1']['connectionId']"
                                    }
                                },
                                "method": "post",
                                "path": "/datasets/default/files",
                                "queries": {
                                    "folderPath": "/samplefiles",
                                    "name": "sample.json",
                                    "queryParametersSingleEncoded": true
                                }
                            },

     

    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Wednesday, July 25, 2018 6:35 AM

All replies

  • Hi Sayyad,

    You need to pass body of fetched data action as content to create blob action . Below is the sample definition which you can use 

     "Create_message_with_sql_resultset": {
                            "inputs": {
                                "body": "@body('Get_sql_storedprocedure_result')",
                                "host": {
                                    "connection": {
                                        "name": "@parameters('$connections')['azureblob_1']['connectionId']"
                                    }
                                },
                                "method": "post",
                                "path": "/datasets/default/files",
                                "queries": {
                                    "folderPath": "/samplefiles",
                                    "name": "sample.json",
                                    "queryParametersSingleEncoded": true
                                }
                            },

     

    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Wednesday, July 25, 2018 6:35 AM
  • whilst it is already answered below; just want to clarify and also I am curious where are you actually stuck on this one? In blob creation or the SQL part?

    For Blob creation; Output as JSON will be the actual "Body" of the SQL output and you can manually copy paste it like this 


    Since I choose getRows, my example JSON is 

    Also, with this, you can traverse to more granular levels; like columns and output etc. which by the way Logic App gives you suggestions anyways

    for e.g. Entire JSON: @body('Get_rows')

    All the rows in a foreach : @body('Get_rows')?['value']


    Wednesday, July 25, 2018 7:25 PM