Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySql Sink, Unquoted field names. #1863

Closed
pmo-sdr opened this issue Apr 30, 2020 · 3 comments
Closed

MySql Sink, Unquoted field names. #1863

pmo-sdr opened this issue Apr 30, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@pmo-sdr
Copy link
Collaborator

pmo-sdr commented Apr 30, 2020

Mysql sink sends insert statements not quoting field names, this results on Sql errors when field name is equal to some reserved word.

IE:

When you try to create a field named "load":

com.telefonica.iot.cygnus.sinks.NGSISink[569] : 
BadContextData (SQLException). 
	MYSQL Data insertion error. Query: 
		insert into `traffic_TrafficFlow` 
			(recvTime,fiwareServicePath,entityId,entityType, load,load_md,) 
			values ('2020-04-29 15:22:49.869','/traffic','1','TrafficFlowObserved','178','[]')
		(You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'load,load_md) values ('2020-04-29 15' at line 1). 

Sql statement should be properly quoted to avoid this kind of errors.

@pmo-sdr pmo-sdr added the bug label Apr 30, 2020
@pmo-sdr pmo-sdr self-assigned this Apr 30, 2020
@pmo-sdr pmo-sdr changed the title MySqul Sink, Unquoted field names. MySql Sink, Unquoted field names. Apr 30, 2020
dmartinezgomez added a commit to Stdri/fiware-cygnus that referenced this issue Apr 30, 2020
@fgalan fgalan added this to the release/2.1.0 milestone Apr 30, 2020
pmo-sdr added a commit to Stdri/fiware-cygnus that referenced this issue May 4, 2020
@AlvaroVega
Copy link
Member

What is the expected sentence?

insert into `traffic_TrafficFlow` 
			('recvTime','fiwareServicePath,'entityId','entityType','load','load_md',) 
			values ('2020-04-29 15:22:49.869','/traffic','1','TrafficFlowObserved','178','[]')

@pmo-sdr
Copy link
Collaborator Author

pmo-sdr commented May 4, 2020

Actual sentence:

insert into `traffic_TrafficFlow` 
			(recvTime,fiwareServicePath,entityId,entityType, load,load_md)
...

Expeted after fix:

insert into `traffic_TrafficFlow` 
			(`recvTime`,`fiwareServicePath`,`entityId`,`entityType`, `load`,`load_md`)
...

@fgalan fgalan modified the milestones: release/2.1.0, release/2.2.0 May 7, 2020
@fgalan fgalan modified the milestones: release/2.2.0, release/2.3.0 Jun 23, 2020
@fgalan fgalan modified the milestones: release/2.3.0, release/2.4.0 Jul 15, 2020
@fgalan fgalan modified the milestones: release/2.4.0, release/2.5.0 Sep 4, 2020
@fgalan
Copy link
Member

fgalan commented Oct 20, 2020

Once the PR with the fix has been merged, we understand this issue can be closed. Of course if we are wrong, please tell about it so we can reopen.

@fgalan fgalan closed this as completed Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants