Skip to main content
Power Automate
    • Connectors
    • Templates
    • Take a guided tour
    • Digital process automation
    • Robotic process automation
    • Business process automation
    • Process advisor
    • AI Builder
  • Pricing
  • Partners
    • Blog
    • Documentation
    • Roadmap
    • Self-paced learning
    • Webinar
    • Business process and workflow automation topics
    • Overview
    • Issues
    • Give feedback
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • User groups
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Microsoft Power Automate Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power Automate
    • General Power Automate Discussion
    • Using Connectors
    • Building Flows
    • Using Flows
    • Power Automate Desktop
    • Process Advisor
    • AI Builder
    • Power Automate Mobile App
    • Translation Quality Feedback
    • Connector Development
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Galleries
    • Community Connections & How-To Videos
    • Webinars and Video Gallery
    • Power Automate Cookbook
    • Events
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Community Engagement
    • Community AMA
    • Community Blog
    • Power Automate Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power Automate Community
    • Galleries
    • Power Automate Cookbook
    • Re: SQL Batch Create Read Update and Delete

    Re: SQL Batch Create Read Update and Delete

    10-04-2022 17:31 PM - last edited 10-10-2022 13:57 PM

    Super User takolota
    Super User
    5674 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    SQL Batch Create Read Update and Delete

    ‎08-12-2022 09:22 PM

    Generate efficient SQL batch queries for any CRUD operations in any flow or Power App.

    This transforms Power Apps table data or flow action output JSON data into a type of CSV data. Then the main part of the flow efficiently transforms that CSV-like data into SQL queries that can Create, Read, Update, or Delete all the data within a single SQL Query action. There are no slow-running loops in the app or flow.

    Power Apps Test Set-Up & Formula

    PwrAppFormulaV1.5P1.png
    Example Power Apps Formulas (Anytime I post a certain formula to the page, it breaks and won't let me edit the page anymore. You'll have to use the link or download the added zip file below.)
    https://drive.google.com/file/d/1eInULGezXoaxSwsAiairyTBT6FEo9YkN/view?usp=sharing 


    (The part with the Power Apps JSON array string regex & conversion for the flow response was taken from this video:https://youtu.be/2xWiFkBf294
    This can be replaced with the simpler built-in Parse JSON once that feature is in preview or generally available.)



    Power Automate Flow Overview Picture

    takolota_0-1661614045674.png

     


    Example Run Update Section
    BatchSQL4.png

    You can download & import the example flow below. Thanks for any feedback!

    PwrAppFormulaV1.5.zip
    SQL-BatchActionsV1.7.zip
    Labels:
    • Labels:
    • Automated Flows
    • Button flows
    • Scheduled flows
    Message 1 of 12
    7,531 Views
    9 Kudos
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    • « Previous
      • 1
      • 2
    • Next »
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-12-2022 09:24 PM

    You can also check out the template Power Apps premium custom connector template I created with the same batch processing here:
    https://powerusers.microsoft.com/t5/Community-App-Samples/SQL-Batch-Create-Read-Update-and-Delete-Cu...

    This uses some custom connector API calls & Logic Apps instead of Power Automate.

    Message 2 of 12
    7,413 Views
    1 Kudo
    Reply
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-18-2022 03:11 PM

    I forgot to put the extra single quotes around the string-based columns in the non Power Apps example Create CSV action. I also put all the main pieces into a Scope for easier copying between flows.

     

    Can pass 2x amount of Power App table data.

    BatchActionsSQL_V1.zip
    PwrAppFormulasV1.zip
    Message 3 of 12
    6,895 Views
    0 Kudos
    Reply
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-27-2022 08:16 AM

    Version 1.5
    I didn't know the Power Apps JSON function doesn't require any looping to output a full JSON array from a collection. Efficiently forming a JSON array of the data in Power Apps let me change the CSV creation from the Power App back to the flow for that use-case. This simplifies the Power App code & standardizes how to do this for any Power App or flow. So users don't have to learn extra details depending on whether it is a Power App flow or not, it all uses basically the same set-up now where a Create CSV table action intakes a JSON array & forms the needed CSV type data for the rest of the flow. It should be easier to learn & use this same flow across several different use-cases now.

     

    Can pass less table data from Power Apps, but is easier to learn & set up.

    PwrAppFormulaV1.5.zip
    SQL-BatchActionsV1.5.zip
    Message 4 of 12
    6,765 Views
    1 Kudo
    Reply
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-07-2022 09:19 AM

    Power Apps is now releasing an experimental feature to more easily parse JSON: 

    https://mofumofupower.hatenablog.com/entry/2022/09/07/201957?fbclid=IwAR087Tm5FgFzPNOpwsJVHJhEOe4dXN...


    Tutorial: https://youtu.be/FqfLiJDdC3Q

     

    Once this is in preview or generally available, I can adjust this template & replace the more complex REGEX section.

    Message 5 of 12
    6,439 Views
    0 Kudos
    Reply
    JBR15
    JBR15
    Frequent Visitor
    In response to takolota
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-15-2022 06:07 PM

    Hi Takolota,

     

    First of all thank you for your work on this flow, it is very cool. I have realized at the end of it that "Execute a SQL Query (V2)" is not available for on-prem servers. Do you know of an alternative to batch insert CSV or JSON data into SQL?

     

    Thanks!

    Message 6 of 12
    6,156 Views
    1 Kudo
    Reply
    takolota
    Super User takolota
    Super User
    In response to JBR15
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-15-2022 06:17 PM

    @JBR15 


    Is it possible to use an On-Premise Gateway and/or Power Automate Desktop to send the query?

    https://docs.microsoft.com/en-us/power-automate/gateway-reference

    Message 7 of 12
    6,152 Views
    0 Kudos
    Reply
    takolota
    Super User takolota
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-04-2022 05:31 PM

    Version 1.7

    I unnecessarily added something to try to handle in-data comma errors and it actually caused an error in the batch create & batch delete. I removed this additional buggy expression because in-data comma errors should already be avoided in SQL through the single-quotes ' ' around each string-based value. 
    Then the Create CSV action creates some errors when it adds double quotes around any item with a comma in it, so I added some replace expressions to handle that in the DataLines action.

    SQL-BatchActionsV1.7.zip
    Message 8 of 12
    5,674 Views
    2 Kudos
    Reply
    kylzbaba
    kylzbaba Resolver I
    Resolver I
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎01-24-2023 06:12 AM

    Hello Takolota,

     

    Do you have a similar solution for Azure Blob ? 

    Message 9 of 12
    2,133 Views
    0 Kudos
    Reply
    takolota
    Super User takolota
    Super User
    In response to kylzbaba
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎01-24-2023 06:20 AM

    @kylzbaba 

     

    I have not made anything like that. And I’m actually not sure if there is even a technical possibility for a similar batch set up on Microsoft systems at this point.

    If you’re curious about it, you could look for any batch document API call options for Azure Blob &/or for Dataverse.

     

    And if you really really needed batch actions for document storage, then you could try setting something up to send the document base64 as strings to the dataset, then have any front-end or viewing mechanism convert the base 64 back to a document. But that seems needlessly complicated & the strings would be really long for the documents, so you would still likely have small batch sizes.

    Message 10 of 12
    2,126 Views
    0 Kudos
    Reply
    • « Previous
      • 1
      • 2
    • Next »

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign up free
    • Sign in

    Browse

    • Templates
    • Connectors
    • Partners

    Downloads

    • Mobile
    • Gateway

    Learn

    • Documentation
    • Learn
    • Support
    • Community
    • Give feedback
    • Blog
    • Pricing

    • © 2023 Microsoft
    • Contact us
    • Trademarks
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Terms & conditions
    California Consumer Privacy Act (CCPA) Opt-Out Icon Your California Privacy Choices