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

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.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Kudoed Authors
Users online (20,498)