cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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
EricRegnier
Super User
Super User

Hi @Anonymous,

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

Anonymous
Not applicable

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.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (4,639)