Ask questions based on a view and not a table


#1

Hi,

I’m a newbie and I’m starting to learn SQL so I’m not very technical nor experienced, so please excuse my lack of professional lingo :slight_smile:

I’ve created a View in my database (we use postgresql) because I need some complex joins among my tables in order to get my point.

My plan is to use such View as default table to build Queries with the “visual builder” since I need other non-technical users to create questions, slicing/dicing data in order to have few easy charts.

Unfortunately I can’t see my view in the list of tables, but if I enter the sql editor and run a select from it I get all my data back!

What am I doing wrong? Maybe it’s not possible to use views as input for the query builder?

Thanks, Marco


#2

Metabase doesn’t know about the view you just added. Sync your database again and it should show up in the menu


#3

Thanks camsaul, it did the trick! I was under the assumption that Metabase could read live my db modifications without needing to sync it.


#4

It sounds like you were having the same issue that I am having right now but got it working, did you do anything more than syncing the database to get you view to show up in the list?


#5

No, I just had to sync it and the trick was done.


#6

Dang… I’ve synced it, even fully disconnected and reconnected it, and it still only shows the view when I query using sql.

What kind of database are you using (postgre, mysql, etc.)?


#7

Ouch… Unfortunately I have no clue on how to help you! I’m using postgre, running locally on my laptop via Mapp Stack. I don’t work on the real DB but I use a dump so it’s safer.


#8

Hmm, maybe I’ll try migrating to mysql or postgre (I’m using sqlite right now).


#9

If it works in mysql/postgre but not sqlite can you file an issue?

If it doesn’t work with one of those either, can you share the view with us here so we can try to figure out why it’s not being picked up?

In general, Metabase expects to work with views (see extended ramblings at http://www.metabase.com/blog/Joins) and they should JustWork.


#10

It looks like it was an issue with sqlite. I migrated my database into MySQL and the views are working perfectly now. Where do I file an issue?


#11

Turns out there was a bug in the sqlite driver we used. We’ve reverted and this will be fixed in 0.21.


#12

We are using MB 0.29.3 with PostgreSQL 9.4. We have tried creating Materialized Views and Views in our schema and have re-synced the schema several times. We have also saved the database definition after syncing. The tables in the schema do appear in the Questions drop down and new tables seem appear without the need to sync but views do not show up in the drop down regardless of syncing. Any ideas what we else we should be doing to work with views in PostgreSQL.


#13

@bill.tulskie And you checked database access for those views by running a native SQL query in Metabase?