Skip to content

Commit

Permalink
Merge pull request #2210 from Kajal-NEC/cygnusIssue
Browse files Browse the repository at this point in the history
Removes  "_ " in schema name for DM -schema family
  • Loading branch information
fgalan authored Jan 11, 2023
2 parents 54084c4 + 2db6590 commit c7d6f13
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
[cygnus-common] Upgrade postgresql from 42.4.1 to 42.4.3
[cygnus-common] OracleSQL backend (#2195)
[cygnus-ngsi] OracleSQL ngsi sink added (for OracleS 11g and 12c) (#2195)
[cygnus-ngsi] Removes "_" in schema name for DM -schema family (#2201)
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ public String buildSchemaName(String service, String subService) throws CygnusBa
case DMBYENTITYDATABASESCHEMA:
case DMBYENTITYTYPEDATABASESCHEMA:
case DMBYFIXEDENTITYTYPEDATABASESCHEMA:
name = NGSIUtils.encode(subService, false, true);
name = NGSIUtils.encode(subService, true, false);
break;
default:
name = NGSIUtils.encode(service, false, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ private NGSIUtils() {
*/
public static String encode(String in, boolean deleteSlash, boolean encodeSlash) {
if (deleteSlash) {
return ENCODEPATTERN.matcher(in.substring(1)).replaceAll("_");
if (in.startsWith("/")) {
return ENCODEPATTERN.matcher(in.substring(1)).replaceAll("_");
} else {
return ENCODEPATTERN.matcher(in).replaceAll("_");
}
} else if (encodeSlash) {
return ENCODEPATTERN.matcher(in).replaceAll("_");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ For a given entity, `entityname`, of type `entitytype`, inside a tenant `service
| datamodel name | database name | schema name | table name | note |
|-------------------------------------------|---------------|--------------|-----------------------------------|---------------------------------------------------|
| by default | `agent.conf` | service | servicepath_entityname_entitytype | Automatic schema creation |
| `dm-by-fixed-entity-type-database-schema` | service | _servicepath | entitytype | Database and schema need to be created in advance |
| `dm-by-fixed-entity-type-database-schema` | service | servicepath | entitytype | Database and schema need to be created in advance |
| `dm-by-fixed-entity-type-database` | service | service | entitytype | Database and schema need to be created in advance |
| `dm-by-fixed-entity-type` | `agent.conf` | service | entitytype | Automatic schema creation |
| `dm-by-entity-database-schema` | service | _servicepath | servicepath_entityname_entitytype | Database and schema need to be created in advance |
| `dm-by-entity-database-schema` | service | servicepath | servicepath_entityname_entitytype | Database and schema need to be created in advance |
| `dm-by-entity-database` | service | service | servicepath_entityname_entitytype | Database and schema need to be created in advance |
| `dm-by-entity-type-database-schema` | service | _servicepath | servicepath_entitytype | Database and schema need to be created in advance |
| `dm-by-entity-type-database-schema` | service | servicepath | servicepath_entitytype | Database and schema need to be created in advance |
| `dm-by-entity-type-database` | service | service | servicepath_entitytype | Database and schema need to be created in advance |
| `dm-by-entity-type` | `agent.conf` | service | servicepath_entitytype | Automatic schema creation |
| `dm-by-service-path` | `agent.conf` | service | servicepath | Automatic schema creation |
Expand All @@ -68,9 +68,6 @@ For a given entity, `entityname`, of type `entitytype`, inside a tenant `service

Where [`agent.conf`](https://github.com/telefonicaid/fiware-cygnus/blob/master/doc/cygnus-ngsi/installation_and_administration_guide/ngsi_agent_conf.md) is the default database name selected in that file under the field `cygnus-ngsi.sinks.postgresql-sink.postgresql_database` or the env var `CYGNUS_POSTGRESQL_DATABASE`

**NOTE:** the leading underscore `_` in schema name column for `*-schema` cases is not a typo. However, this may change in the future,
see issue [#2201](https://github.com/telefonicaid/fiware-cygnus/issues/2201).

[Top](#top)

#### <a name="section1.2.1"></a>PostgreSQL databases naming considerations
Expand Down

0 comments on commit c7d6f13

Please sign in to comment.