Do you understand how “defaultSchema” works? It needs to be the name of one of 
your schemas, and yours isn’t. 

Have you tried qualifying the table name with the schema name, like this:

  select * from “postgrestest”.EMPLOYEES

Julian


> On Oct 3, 2017, at 8:10 PM, AshwinKumar AshwinKumar <[email protected]> 
> wrote:
> 
> Hi Team,
> 
> I have created a model.json file with two connection instances for postgres
> and elastisearch . PFB the file -
> 
> {
>  "version": "1.0",
>  "defaultSchema": "postgrestestelasti",
>  "schemas": [
>    {
>      "name": "postgrestest",
>      "type": "custom",
>      "factory": "org.apache.calcite.adapter.jdbc.JdbcSchema$Factory",
>      "operand": {
>        //"jdbcDriver": "com.mysql.jdbc.Driver",
>       // "jdbcUrl": "jdbc:mysql://localhost/foodmart",
>        "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": "megacorp"
>      }
>    }
>  ]
> }
> 
> 
> The connection is working fine. But when I query a type called EMPLOYEES
> (which I have created in the index megacorp)  , It throws the below error -
> 
> The query is - select * from EMPLOYEES;
> 
> error -
> 
> select * from "EMPLOYEES";
> 2017-10-04 03:54:46,696 [main] ERROR -
> org.apache.calcite.sql.validate.SqlValidatorException: Object 'EMPLOYEES'
> not found
> 2017-10-04 03:54:46,701 [main] ERROR -
> org.apache.calcite.runtime.CalciteContextException: From line 1, column 15
> to line 1, column 25: Object 'EMPLOYEES' not found
> Error: Error while executing SQL "select * from "EMPLOYEES"": From line 1,
> column 15 to line 1, column 25: Object 'EMPLOYEES' not found (state=,code=0)
> 
> Could you please let me know what is the issue here.
> 
> Note - please ignore the path for the modelPost.json file as I have it in
> cassandra folder. This is just a test model file.
> 
> 
> Thanks,
> Ashwin

Reply via email to