Skip to content

oci-serviceconnector-streaming-json-to-csv-python not working #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MarcGueury opened this issue Aug 29, 2022 · 1 comment
Open

oci-serviceconnector-streaming-json-to-csv-python not working #50

MarcGueury opened this issue Aug 29, 2022 · 1 comment

Comments

@MarcGueury
Copy link

The sample is not working.

https://github.com/oracle-samples/oracle-functions-samples)/[samples](https://github.com/oracle-samples/oracle-functions-samples/tree/master/samples)/oci-serviceconnector-streaming-json-to-csv-python/

The input of the service connector looks like this:

"01GBK286021BT0Q4RZJ002PCNH - root - INFO - {'stream': 'mg-input-sc', 'partition': '0', 'key': None, 'value': 'W3sic3RyZWFtIjogIm15bmV3c3RyZWFtIiwicGFydGl0aW9uIjogIjAiLCJ2YWx1ZSI6ICJleUp1WVcxbElqb2lhV2R2Y2lJc0lDSnNiMk5oZEdsdmJpSTZJQ0pFZFdKc2FXNGlmUT09Iiwib2Zmc2V0IjogMCwidGltZXN0YW1wIjogIjIwMTgtMDQtMjZUMDE6MDM6MDYuMDUxWiJ9LHsic3RyZWFtIjogIm15bmV3c3RyZWFtIiwicGFydGl0aW9uIjogIjAiLCJ2YWx1ZSI6ICJleUp1WVcxbElqb2lZbkpwWVc0aUxDSm1hV1ZzWkRFaU9pSjBaWE4wSW4wPSIsIm9mZnNldCI6IDAsInRpbWVzdGFtcCI6ICIyMDE4LTA0LTI2VDAxOjAzOjA2LjA1MVoifV0=', 'offset': 10, 'timestamp': 1661718357219}"

Notice that key is None.

I am not sure why it is written this part of the code but this is causing issue:

        if 'key' in item:
            item['key'] = base64_decode(item['key'])

The same problem happens also with the test.json file that is in the sample directory.
If you remove the lines, it works. I am not sure of the intention of these 2 lines.

@rinkooy
Copy link

rinkooy commented Nov 22, 2022

I am also facing same issue, if there is only one tupple there in file ({"stream": "mynewstream"}), then code is working.
But if more entries then not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants