Question: Without using the Mitto GUI, can I write a query that returns the SQL query that formed the table?
I am thinking this will be something like Snowflake’s GET_DDL function:
https://docs.snowflake.com/en/sql-reference/functions/get_ddl.html
Question: Without using the Mitto GUI, can I write a query that returns the SQL query that formed the table?
I am thinking this will be something like Snowflake’s GET_DDL function:
https://docs.snowflake.com/en/sql-reference/functions/get_ddl.html
Hey @BlueFlamingo, the way we normally “search” for specific values across all Mitto jobs is by using grep
on the command line:
Here’s an example Mitto SQL job that creates a table named test.union_a
:
drop table test.union_a;
create table test.union_a (id int, value int, updated_at timestamp default now());
insert into test.union_a (id, value) VALUES (1,1),
(2,2);
drop table test.union_b;
create table test.union_b (id int, value int, updated_at timestamp default now());
insert into test.union_b (id, value) VALUES (1,3),
(2,4);
Using the below grep
command, we can find Mitto jobs that reference that table (test.union_a
) in some way:
/var/mitto/conf/plugin_sql___sql_create_test_union_tables.json:4: "drop table test.union_a;",
/var/mitto/conf/plugin_sql___sql_create_test_union_tables.json:5: "create table test.union_a (id int, value int, updated_at timestamp default now());",
/var/mitto/conf/plugin_sql___sql_create_test_union_tables.json:7: "insert into test.union_a (id, value) VALUES (1,1),",
/var/mitto/conf/query_a_test_union_a.json:6: "SELECT 'a' as __source, * FROM test.union_a"
grep
is searching through all the job configs stored on disk in the /var/mitto/conf
directory.
You can use this same command and create a Mitto command line job to generate a file (grep_results.txt
) with the output:
grep -n "test.union_a" /var/mitto/conf/* > /var/mitto/data/grep_results.txt
The results of this txt file can be downloaded or viewed in the browser: