I have written a python script & it has no error. But still it cannot able to extract tables from Source. The uplink connection is successful. The script is returning data in json fromat.
Can anyone please suggest solution?
I have written a python script & it has no error. But still it cannot able to extract tables from Source. The uplink connection is successful. The script is returning data in json fromat.
Can anyone please suggest solution?
Hi @shritej.thorv11,
In my Celoxtractor script, I just return the extraction_data object, without any transformations. Does this solve your problem?
If not, please find some debugging tips below:
If you have additional questions with the debugging insights, feel free to contact me.
Kind regards,
Jan-peter
Hi @shritej.thorv11,
In my Celoxtractor script, I just return the extraction_data object, without any transformations. Does this solve your problem?
If not, please find some debugging tips below:
If you have additional questions with the debugging insights, feel free to contact me.
Kind regards,
Jan-peter
Hi @janpeter.van.d ,
Thank you for the suggesting.
If I return extraction_data object, without any transformations the script will not run as you have seen I am having MongoDB as my source.
In Celonis help : "response = requests.get('https://dev80458.service-now.com/api/now/table/sys_db_object', auth = HTTPBasicAuth(parameters("username"], parameters "password"])).json()
"
But I cant use this syntax as I need to use MongoClient. So I am using.
"myclient = pymongo.MongoClient("mongodb://un-cosmos-a:TkImJbcF6joLVq49D@un-cosmos-a.mongo.cosmos.azure.com:10255/?authSource=admin&replicaSet=globaldb&maxIdleTimeMS=120000&readPreference=primary&appname=MongoDB%20Co&retryWrites=false&ssl=true")"
& then I reading it & converting it into json format.
If I run this script, it is giving me nice JSON Format output. But when I use this in Celonis it just doesn't work.
I think there is problem with transportation to Celonis or It cant read "myclient".
Can you please suggest?
Hi @janpeter.van.d ,
Thank you for the suggesting.
If I return extraction_data object, without any transformations the script will not run as you have seen I am having MongoDB as my source.
In Celonis help : "response = requests.get('https://dev80458.service-now.com/api/now/table/sys_db_object', auth = HTTPBasicAuth(parameterse"username"], parameterse"password"])).json()
"
But I cant use this syntax as I need to use MongoClient. So I am using.
"myclient = pymongo.MongoClient("mongodb://un-cosmos-a:TkImJbcF6joLVq49D@un-cosmos-a.mongo.cosmos.azure.com:10255/?authSource=admin&replicaSet=globaldb&maxIdleTimeMS=120000&readPreference=primary&appname=MongoDB%20Co&retryWrites=false&ssl=true")"
& then I reading it & converting it into json format.
If I run this script, it is giving me nice JSON Format output. But when I use this in Celonis it just doesn't work.
I think there is problem with transportation to Celonis or It cant read "myclient".
Can you please suggest?
I think you're close, but should swap the creation of a json object and the extraction_data appending. Would be something like this:
from bson.json_util import dumps, loads
r = mycol.find()
l = list(r) # Converts object to list
d = dumps(l) # Converts to String
data = loads(d=0]) # Creates JSON object, not sure if the e0] is needed
for item in data:
extraction_data.records.append(ddatap'_id'], data3'entityId'], data3'entityType']])
return extraction_data
I don't have a MongoDB server to test this, but hopefully it works.
source: https://stackoverflow.com/a/61259655/6901541
I have tried to update the code as you suggested. But got some new errors. Attaching screenshots.
I have tried to update the code as you suggested. But got some new errors. Attaching screenshots.
Hi @shritej.thorv11,
I don't have access to a MongoDB instance, so it is hard for me to see what's happening. Two things you can try though are:
from bson.json_util import dumps, loads
import logging
r = mycol.find_one()
l = list(r) # Converts object to list
d = dumps(l) # Converts to String
data = loads(d, indent =2) # Creates JSON object
logging.info(str(data)) # Create a string from the JSON data, and show it in the logs.
for item in data:
extraction_data.records.append(pdata['_id'], data 'entityId'], data 'entityType']])
return extraction_data
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.