Member since
05-30-2023
43
Posts
4
Kudos Received
0
Solutions
08-30-2023
02:57 AM
1 Kudo
Yes, I ended up changing my ExecuteScript in a way that all column's values are now attributes of my flowFile. Next, I have added PutSql processor and inserting data using ${attributename}. Thanks @SAMSAL for responding.
... View more
08-29-2023
01:30 PM
Thanks @SAMSAL for responding. I will explain what I am trying to accomplish. The ExecuteStreamCommand gives me below results: and I want to use displayName and mail key's values from this result and store it into the database. My current workflow is based on the flow that I will store these two key's value as a attribute and use it in the subsequent processors. However, using AttributestoJson aint also working for me. Can you suggest any other better appraoach to ingest these two values in my database? I have other columns' value to ingest that as well so may be ExecuteSQLCommand processor would be a better choice to use.
... View more
08-29-2023
08:39 AM
Can you help me with a similar issue? My code: import json import collections import java.io import ast from org.apache.commons.io import IOUtils from java.nio.charset import StandardCharsets from org.apache.nifi.processor.io import StreamCallback class ModJSON(StreamCallback) : def __init__(self): pass def process(self, inputStream, outputStream): text = IOUtils.toString(inputStream, StandardCharsets.UTF_8) obj = ast.literal_eval(text) mail = obj['mail'] outputStream.write(bytearray(json.dumps(obj['mail'], indent=4).encode('utf-8'))) outputStream.write(bytearray(json.dumps(obj['id'], indent=4).encode('utf-8'))) flowFile = session.get() if (flowFile != None): flowFile = session.write(flowFile, ModJSON()) flowFile = session.putAttribute(flowFile, "filename", flowFile.getAttribute('filename').split('.')[0]+'_translated.json') flowFile = session.putAttribute(flowFile, "mail", mail) session.transfer(flowFile, REL_SUCCESS) session.commit() I want to get "mail" value and create a new attribute for it. However, mail variable is not accessible when I insert it into the putattribute command. Any feedback?
... View more
08-29-2023
03:20 AM
I am executing python script in ExecuteStreamCommand and my code last line dumps the json key values. My goal is to read those key values into PutDatabaseRecord processor and insert the values in my database. However, I am unable to read content of the flow file of ExecuteStream. I have used ConvertAvrotoJson but it is showing output as "not a avro data file". Is there any workarounf of it? Thanks.
... View more
Labels:
- Labels:
-
Apache NiFi
-
NiFi Registry
08-28-2023
07:50 AM
Thanks for the reply. I did it in the same way you have mentioned (I am importing Selenium module and from this module, Service, WebDriverWait and EC components are imported) but late in the code execution, my scripts gives an error "global name Service is not defined". Any idea whats causing the issue?
... View more
08-28-2023
07:07 AM
@joseomjr I am trying to replicate your suggested method, please answer did you include the import command after sys.path.append command?
... View more
08-28-2023
06:29 AM
I want to run python script using ExecuteScript processor and my script has Selenium module to refer to as well. The Selenium module is written in Python language and I believe, it should run in the processor. Below are few lines of code depicting how I have added the modules: import sys sys.path.append(r"C:/Python311/Lib/site-packages/selenium/") sys.path.append(r"C:/Python311/Lib/site-packages/requests/") from org.apache.commons.io import IOUtils from java.nio.charset import StandardCharsets from org.apache.nifi.processor.io import StreamCallback Notice that after appending module in the path, I am not using "from module_name import.." command. However, in the code, the modules are not being fetched and it gives me error. Any help is appreciated.
... View more
Labels:
- Labels:
-
Apache NiFi
08-17-2023
04:49 AM
1 Kudo
Thanks. It was an issue with the connection string. It was pointing to another database while my processor was inserting into another database.
... View more
08-13-2023
07:20 AM
Should I be using "use statement" in my sql select query?
... View more
08-13-2023
03:48 AM
Hi, My task is to move data from my locally installed SQL server (16.0) to Azure SQL (12.0) hosted on my Azure subscription. So far, I have used ExecuteSQL processor to run my select query from SQL Server and it returns me the rows successfully. I have created a Database Polling Connection Service which connect to my SQL Server. After fetching the rows, I am using PutDatabaseRecord processor to insert the fetched rows into Azure SQL but its showing me error that "use statement is not supported to switch between databases". Note that the Database Polling Connection Service is different for PutDatabaseRecord where I have mentioned connection string of my Azure SQL. Please if anyone can give feedback on this issue and suggest any workaround.
... View more
Labels:
- Labels:
-
Apache NiFi
-
NiFi Registry