cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Move BLOB images from MySQL to CDS

Subject line says it all. I have images stored as BLOBs on a local MySQL database. I can connect to MySQL and see the images in PowerApps just fine but what I want to do is move the data from MySQL to CDS. Of course CDS images are not BLOBs. I initially wanted to do a ForAll(mysqltable, patch(cdsentity and move each record that way but CDS wants images to be records. PowerQuery didn't want to mess with them though I may have been doing something wrong. What's the best way to go about this? I have a few other ideas to plug away at but I'm hoping someone has already figured this out. Thank you very much in advance.

 

EDIT: I think I'm getting close.  I followed these instructions:

https://www.blue-granite.com/blog/simple-steps-to-embed-images-in-power-bi

 

I can convert the columns to base64 text with the jpeg url prefix but it's still a text column. In these instructions he's got a dropdown for Data Category. I can't find this dropdown. I have a dropdown for data type but there's not option for Image URL. I'm trying to find a method in the power query documentation to manually add but haven't yet. Still hoping for some help. Thanks again.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper V
Helper V

Re: Move BLOB images from MySQL to CDS

I did actually figure this out if anyone else ever tries to do the same thing. You can patch the images straight from the mysql table, forget PowerQuery for this. Treat the CDS image field as a table but feed both the .Full and the .Value properties with the same mysql binary data. 

 

Patch(cdsTable, Defaults(cdsTable),

{
cds_image: {Full: MySQLTable.ImageCol, Value: MySQLTable.ImageCol}
}
)

 

If you need to run a bunch at once use a ForAll on a keycolumn on the mysql table. If you need to do many images, I was doing 4 images per cds record, I would highly recommend patching them in with separate ForAll loops. PA was getting all choked up trying to patch in everything at once. I did an initial defaults patch to create the record with most of the text data needed then separate ForAll loops to patch in each image individually to their respective records.

View solution in original post

2 REPLIES 2
Highlighted
Solution Sage
Solution Sage

Re: Move BLOB images from MySQL to CDS

Hi @enelson906,

You can have Image data type filed (in Preview) in CDS to save your image:

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/image-attributes

Hope this helps

Highlighted
Helper V
Helper V

Re: Move BLOB images from MySQL to CDS

I did actually figure this out if anyone else ever tries to do the same thing. You can patch the images straight from the mysql table, forget PowerQuery for this. Treat the CDS image field as a table but feed both the .Full and the .Value properties with the same mysql binary data. 

 

Patch(cdsTable, Defaults(cdsTable),

{
cds_image: {Full: MySQLTable.ImageCol, Value: MySQLTable.ImageCol}
}
)

 

If you need to run a bunch at once use a ForAll on a keycolumn on the mysql table. If you need to do many images, I was doing 4 images per cds record, I would highly recommend patching them in with separate ForAll loops. PA was getting all choked up trying to patch in everything at once. I did an initial defaults patch to create the record with most of the text data needed then separate ForAll loops to patch in each image individually to their respective records.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (8,615)