-
Notifications
You must be signed in to change notification settings - Fork 105
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
PostgreSQL sink creates table when entity id contains special characters #2220
base: master
Are you sure you want to change the base?
Conversation
Thank you for your contribution! We hope we can provide feedback on it in a short time |
@Kajal-NEC Please, could you provide the entity name, entity type, fiware-service and fiware-servicepath header you are using to create the DB for each datamodel? |
Please find below details:
|
@@ -616,32 +616,32 @@ public String buildTableName(String servicePath, String entity, String entityTyp | |||
+ "dm-by-service-path data model"); | |||
} // if | |||
|
|||
name = NGSIUtils.encode(servicePath, true, false); | |||
name = NGSIUtils.encodePostgresTable(servicePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the changes in this PR, is encode()
still used in other parts of the code? Or it can be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encode() is used in below part of the code:
When "enable encoding=false" that time encode() is used to build DBName and SchemaName in class NGSIPostgreSQLSink. Also it is used in other sink like NGSIPostgisSink, NGSIOracleSink,NGSIMysqlSink etc. So we can't remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification
NTC
@@ -41,9 +41,9 @@ public static String encodePostgreSQL(String in) { | |||
char c = in.charAt(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where encodePostgreSQL() function is used?
It seems this PR fixes it but it is not clear to me where it is used...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When "Enable ecoding=true", encodePostgreSQL() function is used while building schema name, db name and table name.
Organising a bit the information: Parameters used
Datamodels analysis:dm-by-attribute x002fkajalxffffurnx003angsix002dldxffffx0052oomxfffftemperature Differences: R capital ( dm-by-entity x002fkajalxffffurnx003angsix002dldxffffx0052oom Differences: R capital ( dm-by-entity-database x002fkajalxffffurnx003angsix002dldxffffx0052oom Differences: R capital ( dm-by-fixed-entity-type x0052oom Differences: R capital ( dm-by-fixed-entity-type-database x0052oom Differences: R capital ( dm-by-entity-database-schema x002fkajalxffffurnx003angsix002dldxffffx0052oom Differences: R capital ( dm-by-fixed-entity-type-database-schema x0052oom Differences: R capital ( ConclusionAs far as I can see, this PR only fix capitals problems. @Kajal-NEC How this PR approach the issue #1977 regarding the |
@mapedraza , Case 2 mentioned above in PR description is regarding issue #1977.
|
We wonder how this PR would affect to existing deployments (i.e. backward compatibility). Current databases using table names like In order to know the scope of the change, are your modifications changing always the table names? Or only when Thanks! |
CASE 1 from PR discription:
Case 2 From PR discription:
|
This PR fixes issue#1977 i.e case1 and case2
CASE 1: Encoding is enabled
Postgresql sink creates table for all datamodel. But found bug in table name of some data model as shown below:
CASE 2: Encoding is disabled
In this case, postgresql sink create table only for below data models:
and for other data models (dm-by-entity,dm-by-attribute,dm-by-entity-database,dm-by-entity-database-schema) it does not create tables.