-
1. Re: Creating virtual view above multiple schemas(not public) in Postgres
rareddy Jan 10, 2019 9:51 AM (in response to tamarm)you can add a property in application.properties
spring.datasource.{source-name}.importer.schemaPattern={schema-name}
-
2. Re: Creating virtual view above multiple schemas(not public) in Postgres
tamarm Jan 10, 2019 10:15 AM (in response to rareddy)Thanks Ramesh, but I want to create the virtual view from multiple schemas(which non of them is the "public" schema)
Is it posible?
-
3. Re: Creating virtual view above multiple schemas(not public) in Postgres
rareddy Jan 10, 2019 10:30 AM (in response to tamarm)yes, you can define multiple data sources with the same credentials one for each schema you want to build. So, using the above property define two different data sources for each schema.
Then using the @SelectQuery construct define a view that joins the tables from multiple schemas. Note to qualify the names of the tables using their data source name. For ex: if you have two data sources A and B, then
@SelectQuery("select x, y,z from A.foo join B.bar on A.foo.x = B.bar.z")
If you are familiar with the traditional way of defining the VDB in -vdb.xml I recently added a feature to deploy that VDB in spring-boot if you want to take that route. However, IMO above is much simpler for a java developer.