Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

How to get the ConvertJSONToSQL to work with a MySql table that has a space in the name?

avatar
Frequent Visitor

I'm using the ConvertJSONToSQL processor, and the MySql table has a space in the name.  It appears to be the problem because when I remove the name from the table it works as expected.

 

I can successfully query the table from various tools and the mysql command line using back ticks "`" around the table name.

 

The table name:
personal information

 

I've tried the following:


`personal information`

"personal information"

'personal information'

\"personal information\"
[personal information]

 

Any suggestions?

1 ACCEPTED SOLUTION

avatar
Frequent Visitor

I created a hack to solve this problem.

 

In the ConvertJSONtoSQL processor I put table name = personal information.  Notice the space.  This generated the sql like so:

insert into personal information <snipped>

 

Then using a ReplaceTextProcessor I did a find and replace so such that the sql inserts were converted to the following:

insert into `personal information` <snipped>

 

This works but is very hacky...would love to see the correct way to get the back ticks to work

View solution in original post

1 REPLY 1

avatar
Frequent Visitor

I created a hack to solve this problem.

 

In the ConvertJSONtoSQL processor I put table name = personal information.  Notice the space.  This generated the sql like so:

insert into personal information <snipped>

 

Then using a ReplaceTextProcessor I did a find and replace so such that the sql inserts were converted to the following:

insert into `personal information` <snipped>

 

This works but is very hacky...would love to see the correct way to get the back ticks to work