pyrooka / metabase-cubejs-driver

Connect Metabase with Cube.js.
GNU Affero General Public License v3.0
4 stars 6 forks source link

Driver sends an empty query #37

Closed alexesDev closed 4 years ago

alexesDev commented 4 years ago

Hi. I installed the plugin and nothing works... After after adding the database, cubejs got two requests with empty query:

/cubejs-api/v1/meta?query= HTTP/1.1
authorization: xxx
accept: application/json
accept-encoding: gzip, deflate
host: analytics-xxx.local
user-agent: Apache-HttpClient/4.5.5 (Java/11.0.3)

GET /cubejs-api/v1/meta?query= HTTP/1.1
authorization: xxx
accept: application/json
accept-encoding: gzip, deflate
host: analytics-xxx.local
user-agent: Apache-HttpClient/4.5.5 (Java/11.0.3)

Metabase: v0.33.6 @cubejs-backend/server@0.13.5

What am I doing wrong?

pyrooka commented 4 years ago

Hi, Sorry for the late reply, but the holidays. Your problem is strange. I will publish a new release in a few days, so you can give it a try. If the problem still exists I investigate it.

pyrooka commented 4 years ago

I've just dropped a new release. You can get it from HERE, but note that it only works with Metabase v0.34.0 or newer from now. Please close the issue if it is working or provide some more details if not.

alexesDev commented 4 years ago

Hi, I upgrade Metabase and the plugin, but I have same results. What details can I provide?

pyrooka commented 4 years ago

Okay, I've noticed that the endpoint in your requests is the cube.js meta, which responses with the metadata about your data.

What are you doing when you get this? Just because this endpoint only used when the driver fetching the schema from the Cube.js REST API. Can you try to re-add the DB to Metabase if you haven't done it yet?

If the above solution doesn't work:

  1. If you select the whole table do you get any result?
  2. Is the native query working?
  3. Do you see any error in the Metabase log?

Sorry if this comment a little bit messy, but I haven't faced any issues like this.

alexesDev commented 4 years ago

Sorry, my bad. I found in the logs

ERROR: insert or update on table "metric"
violates foreign key constraint "fk_metric_ref_creator_id"
Key (creator_id)=(1) is not present in table "core_user".

Then I found https://github.com/lili-data/metabase-cubejs-driver/blob/master/src/metabase/driver/cubejs.clj#L267 Then I rebuild plugin with valid creater_id and now it works.

Thanks for the plugin :+1:

pyrooka commented 4 years ago

Glad you found the problem! I am continuously trying to improve the code, but expect some bugs. And thanks for using the driver!