I'm looking for a best practice on where people pu...
# troubleshooting
p
I'm looking for a best practice on where people put their SQL code. I saw alot of examples, where the code is just put into string variables. I don't like this for various reasons (missing syntax highlighting, hard to copy / paste, hard to read, not ideal in code reviews). So I guess my question is, what everyone else is doing? Thanks for your feedback 🙂
p
What I usually do is add the SQL files into
resources
and load them before spinning the job up. I like that for 2 main reasons: 1. Java code gets clean and you see only the "infra" part of it 2. It's easier to people outside java to edit and understand the SQL files. I created a small class to load all SQL classes in a specific directory. I list the files, order them by name and execute them in order. This gives me a feeling of "migrations-like" approach. I either use timestamp as a file prefix OR enumerated files from 001 to XXX.
p
Thanks for this info. This makes alot of sense, specifically the ordering part. This is how we handle normal DB migrations in other projects, too. I also put them into
resources
now but was very unsure, as I'm not only new to flink but also to java (coming from .NET world). Thanks for the confirmation though, helps big time! 🙂
🙌 1
p
I'm happy it helps 💪
p
I've got a connected question regarding this I guess, if you want When you have multiple jobs doing different things, but working on the same topics (or tables in the flink sense), do you create multiple jobs in one project? And if so, do you have one common job, which only takes care of creating the respective tables and other jobs SELECTing on those?
p
I try to keep all of them running in a single place if possible. I always use application mode. So, if I have to have two
insert (...) select (...)
I have to break them into two jobs/pipelines. I do have a common project (not job) which holds such infrastructure pieces.
🙌 1
p
Just for me to confirm my current state of knowledge 😉 Application mode means: You package Job and Runtime into a container which is running standalone and you do not have a shared session based cluster?
p
That's it indeed.