Mysql select - get data by json_extract

Highlighted
Five Stars

Mysql select - get data by json_extract

Hello,

how do I get the result from a json object with json_extract in a mysql select?

My example code:

{"price":"19.99"}

 

select
 a.id,
 a.name,
 JSON_EXTRACT(aa.details, '\"$.price\"') AS JsonAttr,
from article as a
left join article_attributes AS aa ON a.id = aa.articleId

best regards

 

 

Highlighted
Moderator

Re: Mysql select - get data by json_extract

@torbre , do you want to extract the json fields from mysql table? then use tExtractJson after the tDBInput component.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Highlighted
Five Stars

Re: Mysql select - get data by json_extract

Hello,

 

@manodwhb,

Yes, I want to extract the JSON from the db cloumn. Actually, I wanted to avoid another component, since you can extract the data in select using JSON_EXTRACT. My question would still be, why is it not possible to extract the data like this via a select in tMysqlInput?

 

My Solution: I now extract the data using Java code.

 

Thank you for your prompt reply

Best regards

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog