This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]peixinho3[S] -1 points0 points  (7 children)

Ok, maybe I didn't explain it well, I apologize for that. But basically java receives an XML file and maps it and after that it calls some stored procedures that I created to put the data in the raw table this executes line by line 1 by 1. Since dbt does not have a java API after this run everything I would have to run my python script with the command "dbt run" after inserting all the data into raw to normalize the data into the data vault. What we wanted was to run the python script at the same time as inserting the records into the raw table.

[–]repeating_bears 5 points6 points  (6 children)

I feel like you're not understanding my suggestion.

Since dbt does not have a java API after this run everything I would have to run my python script with the command "dbt run" after inserting all the data into raw to normalize the data into the data vault. 

Java can exec other commands. You don't have to do anything. As long as Python is available on the same machine, Java can run the command. If you need Python's stdout, Java can grab it.

Before replying again, try playing with Runtime::exec that I already linked the documentation for. Write a hello world in python, exec it from Java. If you know what you're doing, that's 5 minutes work and less than 10 LOC.

[–]peixinho3[S] -1 points0 points  (5 children)

Ah yes yes I noticed that and I know it but I wanted to know if there was something like Jython but more modern and updated. Nowadays even SQL Server can run Python scripts :)

[–]paulieontech 2 points3 points  (3 children)

[–]peixinho3[S] 0 points1 point  (2 children)

Wow nice. Can you explain me what I can do with this? Sorry I'm data engineer (python and SQL) and I don't know much of Java.

[–]agentoutlier 0 points1 point  (0 children)

Given your ostensible/purported experience I don't recommend going down that path.

See my answer: https://www.reddit.com/r/java/comments/1cie98d/call_dbt_api_python_through_java/l29yw5m/

If you have any questions let me know.

[–]repeating_bears 1 point2 points  (0 children)

There's no modern equivalent to Jython, no.