Docker oracle integration courtesy of egojason/docker-python-oracle
This docker image serves as a microservice to be used in an HTTP transform by executing queries to a database for entities.
docker build -t <your-docker-user>/httpOracle . && docker run --env db_host=$DB_HOST --env db_port=$DB_PORT --env db_database=$DB_DATABASE --env db_username=$DB_USERNAME --env db_password=$DB_PSW --env handler=$DB_HANDLER --env query=$DB_QUERY --env LOG_LEVEL=$DB_LOG_LEVEL --name httpOracle -t -i -p 5000:5000 --rm <your-dockeruser>/httpOracle
SELECT * FROM A WHERE a.ID = '{_id}'
generic_handler returns an entity appended with the query result. This will be a list where each row is a dictionary.dbconnection, variables, logger, entity
curl 0.0.0.0:5000/transform -X POST -d '{"_id":"mock-data"}' and look at the result
docker logs httpOracle{
"_id": "http-oracle-transform",
"type": "system:microservice",
"docker": {
"environment": {
"LOG_LEVEL": "WARNING",
"db_database": "$ENV(HTTP_ORACLE_DATABASE)",
"db_host": "$ENV(HTTP_ORACLE_HOST)",
"db_password": "$SECRET(HTTP_ORACLE_PASSWORD)",
"db_port": 1521,
"db_username": "$ENV(HTTP_ORACLE_USERNAME)",
"handler": "generic_handler",
"query": "SELECT address, zip FROM a WHERE a.ID = '{_id}' AND a.phone_no = '{phone_no}'"
},
"image": "sesamcommunity/oracle-transform:1.1.0",
"port": 5000
},
"verify_ssl": true
}
Pipe example config
{
"_id": "testing-http-transform",
"type": "pipe",
"source": {
"type": "embedded",
"entities":[{
"_id":"im in a query wohoo",
"phone_no": "call me maybe"
}]
},
"transform": [{
"type": "dtl",
"rules": {
"default": [
["copy", "*"],
["add", "::do_query", [<Condition-To-Do-Query>]]
]
}
}.
{
"type": "http",
"system": "http-oracle-transform",
"batch_size": 100,
"url": "/transform"
}, {
"type": "dtl",
"rules": {
"default": [
["copy", "*"]
]
}
}]
}
If the example configs where used above the microservice would put the keys from the entity into the query like this:
SELECT address, zip, subs FROM a WHERE a.ID = 'im in a query wohoo' AND a.phone_no = 'call me maybe'
and if the conditon for do_query == TRUE and the query returned for example two rows, the output would look like this:
{
"_id":"im in a query wohoo",
"phone_no": "call me maybe",
"do_query": true
"query_result": [
{
"adress": "spoofed",
"zip": 1337
}, {
"adress": "MI7",
"zip": 0007
}]
}
Content type
Image
Digest
Size
476.4 MB
Last updated
almost 7 years ago
docker pull gabbebabbe/oracle-transform