This addresses #17

This commit is contained in:
Jonathan Branan 2024-08-14 15:00:53 -05:00
parent 8dc6efe40e
commit de3a3fd03d
4 changed files with 7 additions and 3 deletions

View File

@ -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]

View File

@ -24,6 +24,7 @@ secret = ""
[database]
overrideEmbeddedquery = false
daysTopull = 30
driver = "ODBC Driver 18 for SQL Server"
server = "192.168.x.x"
database = "EFTDB"

View File

@ -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)

View File

@ -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