diff --git a/README.md b/README.md index 0acd03a..18f6f96 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,14 @@ You will need a *config.toml* file in the same directory where *inex.py* or inex | logging | Set if, where and level of logging | The following settings are not obvious as to how they affect the application. +> Note the #comments ``` [fortraPlatform] selectedPlatform = "dev" # This will modify which environment the data is pushed to. The tenant_id and secret must be manually modified. [database] overrideEmbeddedquery = true # Choose if embedded query should be overridden. +daysTopull = 30 # This setting is only related to the embedded query. Please note this will not affect query provided in config.toml driver = "ODBC Driver 18 for SQL Server" # Select which windows driver should be used. This one is recommended. [output] diff --git a/config.toml.example b/config.toml.example index 37c4113..d35370a 100644 --- a/config.toml.example +++ b/config.toml.example @@ -24,6 +24,7 @@ secret = "" [database] overrideEmbeddedquery = false +daysTopull = 30 driver = "ODBC Driver 18 for SQL Server" server = "192.168.x.x" database = "EFTDB" diff --git a/inex.py b/inex.py index 1d1af51..fa90f49 100644 --- a/inex.py +++ b/inex.py @@ -52,6 +52,7 @@ class Inex: self.writeJsonfile = self.config["output"]["dumpTojson"] self.pushToplatform = self.config["output"]["pushToplatform"] self.queryOverride = self.config["database"]["overrideEmbeddedquery"] + self.queryDaystopull = self.config["database"]["daysTopull"] except: print("No config.toml. Please use example file and configure appropriately") exit(1) @@ -70,7 +71,7 @@ class Inex: self.cursor = self.ic.inexSql.connectDatabase(self, self.db, self.dbDriver, self.dbServer, self.dbDatabase, self.dbUser, self.dbPassword) - self.data = self.ic.inexSql.databaseQuery(self, self.cursor, self.sq.sqlQuerymodel.queryData(self.queryOverride,self.dbQuery)) + self.data = self.ic.inexSql.databaseQuery(self, self.cursor, self.sq.sqlQuerymodel.queryData(self.queryOverride,self.dbQuery, self.queryDaystopull)) self.modifiedData = processData(self.data, dataTemplate, prd_instance_id=self.prdInstanceID,\ product_guid=self.productGUID,product_name=self.productName,product_version=self.productVersion) diff --git a/inexSqlquery.py b/inexSqlquery.py index 8db92ab..39b7049 100644 --- a/inexSqlquery.py +++ b/inexSqlquery.py @@ -1,5 +1,5 @@ class sqlQuerymodel: - def queryData(overRideflag, configQuery): + def queryData(overRideflag, configQuery, daysTopull): """Embedded query data""" q ="""DECLARE @stopTime DATETIME2 SET @stopTime=DATEADD(DAY, -30, GETDATE()) @@ -7,5 +7,5 @@ class sqlQuerymodel: FROM tbl_Transactions t Full JOIN tbl_ProtocolCommands p ON(t.TransactionID=p.TransactionID) Full join tbl_Authentications a ON(t.TransactionID=a.TransactionID) - WHERE p.Time_stamp>@stopTime AND p.Command IS NOT NULL""" + WHERE p.Time_stamp>@stopTime AND p.Command IS NOT NULL""".replace("30", daysTopull) return configQuery if overRideflag else q \ No newline at end of file