You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by AshwinKumar AshwinKumar <aa...@g.clemson.edu> on 2017/10/04 20:23:23 UTC
Connecting to multiple schemas
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
Assunto: Connecting to multiple schemas
Posted by Luis Fernando Kauer <lf...@yahoo.com.br.INVALID>.
You have to use the schema names when referencing tables. Watch out for case sensitivity.
Enviado do Yahoo Mail no Android
Em qua, 4 4e out 4e 2017 às 17:23, AshwinKumar AshwinKumar&It;aashwin@g.clemson.edu> escreveu: 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 -
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