Member since
07-25-2024
8
Posts
6
Kudos Received
0
Solutions
08-16-2024
08:43 AM
@Adyant001 Oracle has auto increment IDENTITY feature as below. Table definition takes care of setting primary key incremental value. No need to send this value in json payload I think all other major RDBMS have similar feature to assign auto increment value. CREATE TABLE roletab (id NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY (START WITH 1 INCREMENT BY 1 NOCYCLE), role_id NUMBER, role_name VARCHAR(100), PRIMARY KEY (id) ); INSERT INTO roletab (role_id, role_name) VALUES (10, 'Admin'); INSERT INTO roletab (role_id, role_name) VALUES (20, 'Developer'); commit; SELECT * FROM roletab; ID |ROLE_ID|ROLE_NAME| --+-------+---------+ 1 | 10 | Admin | 2 | 20 |Developer|
... View more
08-13-2024
09:28 PM
@mburgess -- I am reading from Oracle table, not sure about the incoming flowfile
... View more
08-12-2024
11:00 PM
1 Kudo
@Adyant001 wrote: Need to save Json data to multiple child tables. How should i do? choice advantage login Hello, To save JSON data to multiple Oracle tables, use the JSON_TABLE function to parse the JSON and then insert the parsed data into the respective tables. Here’s a concise example: Parse JSON Data SELECT *
FROM JSON_TABLE(
'{"employee": {"id": 1, "name": "John Doe", "department": "Sales", "address": {"street": "123 Main St", "city": "Anytown", "state": "CA"}}}',
'$.employee'
COLUMNS (
id NUMBER PATH '$.id',
name VARCHAR2(50) PATH '$.name',
department VARCHAR2(50) PATH '$.department',
street VARCHAR2(50) PATH '$.address.street',
city VARCHAR2(50) PATH '$.address.city',
state VARCHAR2(2) PATH '$.address.state'
)
) jt; Insert Data into Tables -- Insert into employee table
INSERT INTO employee (id, name, department)
SELECT id, name, department
FROM JSON_TABLE(
'{"employee": {"id": 1, "name": "John Doe", "department": "Sales", "address": {"street": "123 Main St", "city": "Anytown", "state": "CA"}}}',
'$.employee'
COLUMNS (
id NUMBER PATH '$.id',
name VARCHAR2(50) PATH '$.name',
department VARCHAR2(50) PATH '$.department'
)
);
-- Insert into address table
INSERT INTO address (employee_id, street, city, state)
SELECT id, street, city, state
FROM JSON_TABLE(
'{"employee": {"id": 1, "name": "John Doe", "department": "Sales", "address": {"street": "123 Main St", "city": "Anytown", "state": "CA"}}}',
'$.employee'
COLUMNS (
id NUMBER PATH '$.id',
street VARCHAR2(50) PATH '$.address.street',
city VARCHAR2(50) PATH '$.address.city',
state VARCHAR2(2) PATH '$.address.state'
)
); This should help you get started! Best regards, florence0239
... View more
08-02-2024
08:33 AM
1 Kudo
@Adyant001 The JsonQueryElasticSearch processor does not store state. If the processor has no inbound connection, it will be scheduled to execute its code using the configured properties and scheduling configured. So upon every execution it is going to make the same same query to ElasticSearch. This processor can also be triggered by an inbound FlowFile. So you would have some upstream dataflow to build a query in to its content and that FlowFile is fed to the JsonQueryElasticSearch processor to fetch that specific result. The processor would then not execute again until it received another inbound FlowFile to trigger the execution. Please help our community thrive. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped. Thank you, Matt
... View more
07-31-2024
03:23 AM
1 Kudo
@Adyant001, Welcome to the Cloudera Community. As this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.
... View more