“Machine Utilization Example” - Push data to MSSQL Database¶
In this file, data is pushed to an MSSQL database.
Download: utilization-push-sql.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | description: > Sample MSSQL service commissioning file metadata: name: MSSQL push service icon: https://www.cybus.io/wp-content/uploads/2017/10/for-whom1.svg provider: cybus homepage: https://www.cybus.io version: 1.0.0 parameters: mssqlHost: type: string default: 172.17.0.1 mssqlPort: type: integer default: 1433 mssqlUser: type: string default: sa mssqlPassword: type: string default: SomeLongSecurePassw0rd mssqlDatabase: type: string default: tempdb resources: mssqlDB: type: Cybus::Container properties: image: mcr.microsoft.com/mssql/server ports: - 1433:1433/tcp environment: SA_PASSWORD: 'SomeLongSecurePassw0rd' ACCEPT_EULA: 'Y' mssqlConnection: type: Cybus::Connection properties: protocol: Mssql connection: host: !ref mssqlHost port: !ref mssqlPort username: !ref mssqlUser password: !ref mssqlPassword database: !ref mssqlDatabase mssqlQuery2: type: Cybus::Endpoint properties: protocol: Mssql connection: !ref mssqlConnection write: # Here we use the placeholder @someValue. The protocol driver will insert # the value from the input JSON message under the key someValue query: 'INSERT INTO machine (powerlevel, state, timestamp) VALUES (@powerlevel, @state, @timestamp)' mapping: type: Cybus::Mapping properties: mappings: - subscribe: topic: 'machine-state' publish: endpoint: !ref mssqlQuery2 |