diff --git a/config/config_defaults.go b/config/config_defaults.go index 59af66b12..c9a2654f8 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -380,7 +380,7 @@ const CGRATES_CFG_JSON = ` // "exchange": "", // "exchangeType": "", // "routingKey": "", - + // "exchangeProcessed": "", // "exchangeTypeProcessed": "", // "routingKeyProcessed": "", @@ -395,11 +395,11 @@ const CGRATES_CFG_JSON = ` // SQL // "dbName": "cgrates", // the name of the database from were the events are read - // "tableName": "cdrs", // the name of the table from were the events are read + // "sqlTableName": "cdrs", // the name of the table from were the events are read // "sslmode": "disable", // the postgresSSLMode for postgres db // "dbNameProcessed": "", // the name of the database were the events are sent after they are processed - // "tableNameProcessed": "", // the name of the table were the events are sent after they are processed + // "sqlTableNameProcessed": "", // the name of the table were the events are sent after they are processed // "sslmodeProcessed": "", // the postgresSSLMode for postgres db // SQS and S3 @@ -451,7 +451,7 @@ const CGRATES_CFG_JSON = ` "type": "*none", // exporter type "export_path": "/var/spool/cgrates/ees", // path where the exported events will be placed "opts": { - + // General // "queueID": "cgrates_cdrs", // the queue id where events are exported @@ -479,7 +479,7 @@ const CGRATES_CFG_JSON = ` // "sqlMaxConnLifetime": 0, // SQLMaxConnLifetime - // "tableName":"cdrs", // the name of the table from where the events are exported + // "sqlTableName":"cdrs", // the name of the table from where the events are exported // "dbName": "cgrates", // the name of the database from where the events are exported // "sslmode": "disable", // the postgresSSLMode for postgres diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index d2251fb35..0e364306f 100755 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -374,11 +374,11 @@ // // SQL // // "dbName": "cgrates", // the name of the database from were the events are read -// // "tableName": "cdrs", // the name of the table from were the events are read +// // "sqlTableName": "cdrs", // the name of the table from were the events are read // // "sslmode": "disable", // the ssl mode for postgres db // // "dbNameProcessed": "", // the name of the database were the events are sent after they are processed -// // "tableNameProcessed": "", // the name of the table were the events are sent after they are processed +// // "sqlTableNameProcessed": "", // the name of the table were the events are sent after they are processed // // "sslmodeProcessed": "", // the ssl mode for postgres db // // SQS and S3 diff --git a/data/conf/samples/ees/cgrates.json b/data/conf/samples/ees/cgrates.json index 37d46354b..c199983fc 100644 --- a/data/conf/samples/ees/cgrates.json +++ b/data/conf/samples/ees/cgrates.json @@ -395,7 +395,7 @@ "attempts": 1, "opts": { "dbName": "exportedDatabase", // if dbName is not present "cgrates" will be used as default - "tableName": "expTable", // tableName is mandatory in opts for sql exporter + "sqlTableName": "expTable", // tableName is mandatory in opts for sql exporter "sslmode": "disable", "sqlMaxIdleConns": "10", "sqlMaxOpenConns": "100", @@ -416,7 +416,7 @@ "attempts": 1, "opts": { "dbName": "exportedDatabase", - "tableName": "expTable", + "sqlTableName": "expTable", "sslmode": "disable", "sqlMaxIdleConns": "10", "sqlMaxOpenConns": "100", diff --git a/ees/ee_test.go b/ees/ee_test.go index a6c791657..1e502c44e 100644 --- a/ees/ee_test.go +++ b/ees/ee_test.go @@ -235,7 +235,7 @@ func TestNewEventExporterCase8(t *testing.T) { cgrCfg.EEsCfg().Exporters[0].Type = utils.MetaSQL filterS := engine.NewFilterS(cgrCfg, nil, nil) _, err := NewEventExporter(cgrCfg, 0, filterS) - errExpect := "MANDATORY_IE_MISSING: [tableName]" + errExpect := "MANDATORY_IE_MISSING: [sqlTableName]" if err == nil || err.Error() != errExpect { t.Errorf("Expected %+v \n but got %+v", errExpect, err) } diff --git a/ers/sql.go b/ers/sql.go index 9b82fae2f..de6b6b059 100644 --- a/ers/sql.go +++ b/ers/sql.go @@ -328,6 +328,7 @@ func (rdr *SQLEventReader) setURL(inURL, outURL string, opts map[string]interfac rdr.expTableName = utils.CDRsTBL if vals, has := processedOpt[utils.SQLTableName]; has { rdr.expTableName = utils.IfaceAsString(vals) + } switch rdr.expConnType { diff --git a/ers/sql_it_test.go b/ers/sql_it_test.go index 3b399fb45..a9d4fc143 100644 --- a/ers/sql_it_test.go +++ b/ers/sql_it_test.go @@ -100,7 +100,7 @@ func testSQLInitConfig(t *testing.T) { "opts": { "dbName":"cgrates2", "dbNameProcessed":"cgrates2", - "tableNameProcessed":"cdrs2", + "sqlTableNameProcessed":"cdrs2", }, "processed_path": "", // move processed data here "tenant": "cgrates.org", // tenant used by import @@ -377,7 +377,7 @@ func testSQLInitConfig2(t *testing.T) { "opts": { "dbName":"cgrates2", "dbNameProcessed":"cgrates2", - "tableNameProcessed":"cdrs2", + "sqlTableNameProcessed":"cdrs2", }, "processed_path": "", // move processed data here "tenant": "cgrates.org", // tenant used by import diff --git a/ers/sql_test.go b/ers/sql_test.go index 3f2b8f600..ee1705094 100644 --- a/ers/sql_test.go +++ b/ers/sql_test.go @@ -41,13 +41,13 @@ func TestSQLSetURL(t *testing.T) { inURL := "*mysql://cgrates:CGRateS.org@127.0.0.1:3306" outURL := "*mysql://cgrates:CGRateS.org@127.0.0.1:3306" if err := sql.setURL(inURL, outURL, map[string]interface{}{ - "dbName": "cgrates2", - "tableName": "cdrs2", - "sslmode": "enabled", + "dbName": "cgrates2", + utils.SQLTableName: "cdrs2", + "sslmode": "enabled", - "dbNameProcessed": "cgrates3", - "tableNameProcessed": "cdrs3", - "sslmodeProcessed": "enabled", + "dbNameProcessed": "cgrates3", + "sqlTableNameProcessed": "cdrs3", + "sslmodeProcessed": "enabled", }); err != nil { t.Fatal(err) } else if expsql.connString != sql.connString { @@ -76,13 +76,13 @@ func TestSQLSetURL(t *testing.T) { inURL = "*postgres://cgrates:CGRateS.org@127.0.0.1:3306" outURL = "*postgres://cgrates:CGRateS.org@127.0.0.1:3306" if err := sql.setURL(inURL, outURL, map[string]interface{}{ - "dbName": "cgrates2", - "tableName": "cdrs2", - "sslmode": "enabled", + "dbName": "cgrates2", + "sqlTableName": "cdrs2", + "sslmode": "enabled", - "dbNameProcessed": "cgrates3", - "tableNameProcessed": "cdrs3", - "sslmodeProcessed": "enabled", + "dbNameProcessed": "cgrates3", + "sqlTableNameProcessed": "cdrs3", + "sslmodeProcessed": "enabled", }); err != nil { t.Fatal(err) } else if expsql.connString != sql.connString { @@ -111,13 +111,13 @@ func TestSQLSetURL(t *testing.T) { inURL = "*postgres://cgrates:CGRateS.org@127.0.0.1:3306" outURL = "" if err := sql.setURL(inURL, outURL, map[string]interface{}{ - "dbName": "cgrates2", - "tableName": "cdrs2", - "sslmode": "enabled", + "dbName": "cgrates2", + "sqlTableName": "cdrs2", + "sslmode": "enabled", - "dbNameProcessed": "cgrates2", - "tableNameProcessed": "cdrs2", - "sslmodeProcessed": "enabled", + "dbNameProcessed": "cgrates2", + "sqlTableNameProcessed": "cdrs2", + "sslmodeProcessed": "enabled", }); err != nil { t.Fatal(err) } else if expsql.connString != sql.connString { diff --git a/utils/consts.go b/utils/consts.go index a88852841..8791cfa93 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -2559,7 +2559,7 @@ const ( KafkaDefaultMaxWait = time.Millisecond SQLDBName = "dbName" - SQLTableName = "tableName" + SQLTableName = "sqlTableName" SQLDefaultSSLMode = "disable" SQLDefaultDBName = "cgrates"