Feature Request: show tables relationship data for hand-written queries

Hi guys, I’ve run into a huge problem and I fear the solution might only be an improvement on tables relationships data. I’ll try to explain myself:

Basically, I need to update some tables ad views by adding / deleting and modifying columns.
To do so I need to know in advance where (in which queries) I’m using these tables so that I can update them and avoid breaking my BI dashboards.

Unfortunately, under the Data Reference > Databases > Tables > Questions about this table section I have no queries listed. I assume it’s because I’m using the SQL editor and not the query builder.

It would be great if I could see in this page where a table is recalled by a select and where I recall it in a join.

Do you think this is something you might be implementing in the future? Thanks in advance! :beers:

1 Like

Yeah, I think this boils down to the fact that we’re not parsing SQL at the moment, but I’ll let one of our more technically adroit team members confirm or deny that.

1 Like

Hi @maz, any news on this topic?
I’ll be re-factoring a few things once again and I’m already desperate knowing the immense amount of work it took for the same task me last year.

Is there any way that I could be able to “look up” some tables / columns within the 700+ queries I have?

:crossed_fingers:

Basicly, a huge “find and replace” that runs through my queries would be of immense help… thanks!

In the Metabase database, there’s a table called report_card. This includes all the questions. The dataset_query contains the source data. to find the tables with native queries use:

SELECT * FROM metabase.report_card where dataset_query like '%native%';

The dataset_query column will contain something like:

{"database":2,"type":"native","native":{"query":"select teamcode, Description from tblTeam","collection":"pt_DashboardSettings","template_tags":{}}}

Next bit is ‘just’ replacing the bit that needs changing.

2 Likes

WOW!!!

This is a game changer for me… I just browsed through pgAdmin the report_card table and it seems to be exactly what I need. Will try to do some find/replace updating the field… hopefully I can succeed!

Thanks @AndrewMBaines

I’m currently learning Clojure. Once I’m get somewhere, it’s the admin side I’ll be looking at more than the pretty front end stuff. Just need to find more time.

Andrew, that is amazing - I didn´t know that this list of native queries is available - and as I hit my 444. native query today that is a really, really good feature - especially when you think about changing the database or something and need to adjust synax.
You made my day!!