Hi devs,

I am trying to create multiple schemas within the a single model.json file
as shown below -

{
  "version": "2.0",
  "defaultSchema": "elastpost",
  "schemas": [
    {
      "name": "postgrestest",
      "type": "custom",
      "factory": "org.apache.calcite.adapter.jdbc.JdbcSchema$Factory",
      "operand": {
        "jdbcDriver": "org.postgresql.Driver",
        "jdbcUrl": "jdbc:postgresql://localhost/bigdawg_catalog",
        "jdbcUser": "pguser",
        "jdbcPassword": "test"
      }
    },
    {
      "type": "custom",
      "name": "elasticsearch",
      "factory":
"org.apache.calcite.adapter.elasticsearch2.Elasticsearch2SchemaFactory",
      "operand": {
        "coordinates": "{'127.0.0.1': 9300}",
        "userConfig": "{'bulk.flush.max.actions': 10,
'bulk.flush.max.size.mb': 1}",
        "index": "i1"
      }
    }
  ]
}

I am able to connect to both the instances (postgres and elastisearch ) and
when I execute !tables  command , I am able to see all the tables in both
the instances as shown below -


[image: Inline image 2]

However, when I execute "select * from TABLE4" , it gives an error shown
object TABLE4 not found. TABLE4 is present in postgrestest schema . The
same thing applies for "select * from T2". T2 is present in elastisearch
schema. These queries work when I set one of the schema as default schema.
Could you please let me know what should I do to refer to both the
instances without setting one of them as default. I am planning to join the
postgres tables and elastisearch type.

Thanks,
Ashwin

Reply via email to