Can't view tables [work around found]

{
  "browser-info": {
    "language": "en-GB",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.3+7",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.3",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.3+7",
    "os.name": "Linux",
    "os.version": "4.9.184-linuxkit",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "h2",
      "postgres"
    ],
    "hosting-env": "unknown",
    "application-database": "h2",
    "run-mode": "prod",
    "version": {
      "date": "2019-11-19",
      "tag": "v0.33.6",
      "branch": "release-0.33.x",
      "hash": "be1e0e1"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

I am running metabase in a docker container on Windows 10 to connect to a PostgreSQL with an SSH tunnel. docker run -d -p 3000:3000 --name metabase metabase/metabase

I am able to run SQL queries and get a return of data although after a while I get a connection failed message and I have to save the Database connection settings without making changes to get the SSH tunnel to work again.

I also have the full list of tables but when I try and view a table or ask a question I get the error: Distinct, non-empty sequence of Field clauses

How would I go about solving this?

I think the associated logs are:

[68965bc5-dabe-4e26-b2c3-908b7b1fd57e] 2019-12-03T12:34:10+00:00 DEBUG metabase.middleware.log GET /api/table/12/query_metadata 200 2.9 ms (8 DB calls) Jetty threads: 4/50 (3 idle, 0 queued) (79 total active threads) Queries in flight: 0
[68965bc5-dabe-4e26-b2c3-908b7b1fd57e] 2019-12-03T12:34:10+00:00 DEBUG metabase.middleware.log GET /api/table/12/fks 200 2.1 ms (4 DB calls) Jetty threads: 5/50 (3 idle, 1 queued) (79 total active threads) Queries in flight: 0
[68965bc5-dabe-4e26-b2c3-908b7b1fd57e] 2019-12-03T12:34:10+00:00 WARN metabase.query-processor.middleware.process-userland-query Query failure {:status :failed,
:class clojure.lang.ExceptionInfo,
:error "Distinct, non-empty sequence of Field clauses",
:stacktrace
("--> query_processor.middleware.add_implicit_clauses$fn__35061$sorted_implicit_fields_for_table__35066.invoke(add_implicit_clauses.clj:47)"
"query_processor.middleware.add_implicit_clauses$fn__35169$add_implicit_fields__35174$fn__35178.invoke(add_implicit_clauses.clj:92)"
"query_processor.middleware.add_implicit_clauses$fn__35169$add_implicit_fields__35174.invoke(add_implicit_clauses.clj:85)"
"query_processor.middleware.add_implicit_clauses$fn__35257$add_implicit_mbql_clauses__35262$fn__35266.invoke(add_implicit_clauses.clj:129)"
"query_processor.middleware.add_implicit_clauses$fn__35257$add_implicit_mbql_clauses__35262.invoke(add_implicit_clauses.clj:125)"
"query_processor.middleware.add_implicit_clauses$maybe_add_implicit_clauses.invokeStatic(add_implicit_clauses.clj:140)"
"query_processor.middleware.add_implicit_clauses$maybe_add_implicit_clauses.invoke(add_implicit_clauses.clj:136)"
"query_processor.middleware.add_source_metadata$add_source_metadata_for_source_queries$fn__35684.invoke(add_source_metadata.clj:107)"
"query_processor.middleware.resolve_source_table$resolve_source_tables$fn__41181.invoke(resolve_source_table.clj:46)"
"query_processor.middleware.add_row_count_and_status$add_row_count_and_status$fn__35531.invoke(add_row_count_and_status.clj:16)"
"query_processor.middleware.driver_specific$process_query_in_context$fn__37567.invoke(driver_specific.clj:12)"
"query_processor.middleware.add_settings$add_settings$fn__35554.invoke(add_settings.clj:45)"
"query_processor.middleware.resolve_driver$resolve_driver$fn__40795.invoke(resolve_driver.clj:22)"
"query_processor.middleware.bind_effective_timezone$bind_effective_timezone$fn__36881$fn__36882.invoke(bind_effective_timezone.clj:9)"
"util.date$call_with_effective_timezone.invokeStatic(date.clj:88)"
"util.date$call_with_effective_timezone.invoke(date.clj:77)"
"query_processor.middleware.bind_effective_timezone$bind_effective_timezone$fn__36881.invoke(bind_effective_timezone.clj:8)"
"query_processor.middleware.store$initialize_store$fn__43915$fn__43916.invoke(store.clj:11)"
"query_processor.store$do_with_store.invokeStatic(store.clj:46)"
"query_processor.store$do_with_store.invoke(store.clj:40)"
"query_processor.middleware.store$initialize_store$fn__43915.invoke(store.clj:10)"
"query_processor.middleware.async$async__GT_sync$fn__34195.invoke(async.clj:23)"
"query_processor.middleware.async_wait$runnable$fn__36607.invoke(async_wait.clj:89)"),
:query
{:type "query",
:query {:source-table 12},
:parameters [],
:async? true,
:middleware {:add-default-userland-constraints? true, :userland-query? true},
:info
{:executed-by 1,
:context :ad-hoc,
:card-id nil,
:nested? false,
:query-hash [30, -85, -85, 41, 18, 114, 45, -77, 73, -73, 1, -115, -34, 41, -9, 30, 109, -16, 70, -3, -97, 6, 3, -123, 81, -57, -38, 110, -51, 43, 99, 89]},
:constraints {:max-results 10000, :max-results-bare-rows 2000}},
:preprocessed nil,
:native nil,
:ex-data {:type :schema.core/error, :value (), :error (named (not ("Non-empty" a-clojure.lang.LazySeq)) "Distinct, non-empty sequence of Field clauses")}}

Hi @mdodhia
There’s something strange going on, when connecting over SSH. If possible, try to manually create the SSH tunnel instead of using the Metabase configuration option. You’re likely seeing this issue:
https://github.com/metabase/metabase/issues/8396 - upvote by clicking :+1: on the first post

1 Like

Thanks for the reply, I’ll give that a try and report back

I’m now able to see the table data.

For those with this problem or similar problems in the future I just wanted to write down my steps.

I currently use Bitvise SSH client on Windows to connect to my SSH tunnel.

I committed the metabase container with: docker commit metabase metabase2 .

I then ran a new container exposing an extra port for the database connection: docker run -p 3000:3000 -p 5432:5432 -td metabase2

When putting in the IP address of the database instead of localhost I used host.docker.internal

Everything seems to be working which means the problem is most likely metabase’s SSH tunnel implementation. Now I just need to work out the best way of creating the SSH tunnel without using Bitvise.

1 Like