public class JdbcSchema extends Object implements org.apache.calcite.schema.Schema
Schema that is backed by a JDBC data source.
The tables in the JDBC data source appear to be tables in this schema; queries against this schema are executed against those tables, pushing down as much as possible of the query logic to SQL.
| Modifier and Type | Class and Description |
|---|---|
static class |
JdbcSchema.Factory
Schema factory that creates a
JdbcSchema. |
static interface |
JdbcSchema.Foo
Do not use.
|
| Modifier and Type | Field and Description |
|---|---|
org.apache.calcite.sql.SqlDialect |
dialect |
static ThreadLocal<JdbcSchema.Foo> |
THREAD_METADATA |
| Constructor and Description |
|---|
JdbcSchema(DataSource dataSource,
org.apache.calcite.sql.SqlDialect dialect,
org.apache.calcite.adapter.jdbc.JdbcConvention convention,
@Nullable String catalog,
@Nullable String schema)
Creates a JDBC schema.
|
| Modifier and Type | Method and Description |
|---|---|
static JdbcSchema |
create(org.apache.calcite.schema.SchemaPlus parentSchema,
String name,
DataSource dataSource,
org.apache.calcite.sql.SqlDialectFactory dialectFactory,
@Nullable String catalog,
@Nullable String schema) |
static JdbcSchema |
create(org.apache.calcite.schema.SchemaPlus parentSchema,
String name,
DataSource dataSource,
@Nullable String catalog,
@Nullable String schema) |
static JdbcSchema |
create(org.apache.calcite.schema.SchemaPlus parentSchema,
String name,
Map<String,Object> operand)
Creates a JdbcSchema, taking credentials from a map.
|
static org.apache.calcite.sql.SqlDialect |
createDialect(DataSource dataSource)
Deprecated.
Use
createDialect(SqlDialectFactory, DataSource) instead |
static org.apache.calcite.sql.SqlDialect |
createDialect(org.apache.calcite.sql.SqlDialectFactory dialectFactory,
DataSource dataSource)
Returns a suitable SQL dialect for the given data source.
|
static DataSource |
dataSource(String url,
@Nullable String driverClassName,
@Nullable String username,
@Nullable String password)
Creates a JDBC data source with the given specification.
|
DataSource |
getDataSource() |
org.apache.calcite.linq4j.tree.Expression |
getExpression(@Nullable org.apache.calcite.schema.SchemaPlus parentSchema,
String name) |
Set<String> |
getFunctionNames() |
protected com.google.common.collect.Multimap<String,org.apache.calcite.schema.Function> |
getFunctions() |
Collection<org.apache.calcite.schema.Function> |
getFunctions(String name) |
@Nullable org.apache.calcite.schema.Schema |
getSubSchema(String name) |
Set<String> |
getSubSchemaNames() |
@Nullable org.apache.calcite.schema.Table |
getTable(String name) |
Set<String> |
getTableNames() |
@Nullable org.apache.calcite.rel.type.RelProtoDataType |
getType(String name) |
Set<String> |
getTypeNames() |
protected Map<String,org.apache.calcite.rel.type.RelProtoDataType> |
getTypes() |
boolean |
isMutable() |
org.apache.calcite.schema.Schema |
snapshot(org.apache.calcite.schema.SchemaVersion version) |
public final org.apache.calcite.sql.SqlDialect dialect
public static final ThreadLocal<JdbcSchema.Foo> THREAD_METADATA
public JdbcSchema(DataSource dataSource, org.apache.calcite.sql.SqlDialect dialect, org.apache.calcite.adapter.jdbc.JdbcConvention convention, @Nullable String catalog, @Nullable String schema)
dataSource - Data sourcedialect - SQL dialectconvention - Calling conventioncatalog - Catalog name, or nullschema - Schema name patternpublic static JdbcSchema create(org.apache.calcite.schema.SchemaPlus parentSchema, String name, DataSource dataSource, @Nullable String catalog, @Nullable String schema)
public static JdbcSchema create(org.apache.calcite.schema.SchemaPlus parentSchema, String name, DataSource dataSource, org.apache.calcite.sql.SqlDialectFactory dialectFactory, @Nullable String catalog, @Nullable String schema)
public static JdbcSchema create(org.apache.calcite.schema.SchemaPlus parentSchema, String name, Map<String,Object> operand)
parentSchema - Parent schemaname - Nameoperand - Map of property/value pairs@Deprecated public static org.apache.calcite.sql.SqlDialect createDialect(DataSource dataSource)
createDialect(SqlDialectFactory, DataSource) insteaddataSource - The data sourcepublic static org.apache.calcite.sql.SqlDialect createDialect(org.apache.calcite.sql.SqlDialectFactory dialectFactory,
DataSource dataSource)
public static DataSource dataSource(String url, @Nullable String driverClassName, @Nullable String username, @Nullable String password)
public boolean isMutable()
isMutable in interface org.apache.calcite.schema.Schemapublic org.apache.calcite.schema.Schema snapshot(org.apache.calcite.schema.SchemaVersion version)
snapshot in interface org.apache.calcite.schema.Schemapublic DataSource getDataSource()
public org.apache.calcite.linq4j.tree.Expression getExpression(@Nullable org.apache.calcite.schema.SchemaPlus parentSchema,
String name)
getExpression in interface org.apache.calcite.schema.Schemaprotected com.google.common.collect.Multimap<String,org.apache.calcite.schema.Function> getFunctions()
public final Collection<org.apache.calcite.schema.Function> getFunctions(String name)
getFunctions in interface org.apache.calcite.schema.Schemapublic final Set<String> getFunctionNames()
getFunctionNames in interface org.apache.calcite.schema.Schemapublic @Nullable org.apache.calcite.schema.Table getTable(String name)
getTable in interface org.apache.calcite.schema.Schemapublic Set<String> getTableNames()
getTableNames in interface org.apache.calcite.schema.Schemapublic @Nullable org.apache.calcite.rel.type.RelProtoDataType getType(String name)
getType in interface org.apache.calcite.schema.Schemapublic Set<String> getTypeNames()
getTypeNames in interface org.apache.calcite.schema.Schemapublic @Nullable org.apache.calcite.schema.Schema getSubSchema(String name)
getSubSchema in interface org.apache.calcite.schema.SchemaCopyright © 2020–2023 The Apache Software Foundation. All rights reserved.