public Schema create( SchemaPlus parentSchema, String name, Map<String, Object> operand) { return JdbcSchema.create(parentSchema, name, operand); } }
public static JdbcSchema create( SchemaPlus parentSchema, String name, DataSource dataSource, SqlDialectFactory dialectFactory, String catalog, String schema) { final Expression expression = Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class); final SqlDialect dialect = createDialect(dialectFactory, dataSource); final JdbcConvention convention = JdbcConvention.of(dialect, expression, name); return new JdbcSchema(dataSource, dialect, convention, catalog, schema); }
public Schema create( SchemaPlus parentSchema, String name, Map<String, Object> operand) { return JdbcSchema.create(parentSchema, name, operand); } }
public static JdbcSchema create( SchemaPlus parentSchema, String name, DataSource dataSource, SqlDialectFactory dialectFactory, String catalog, String schema) { final Expression expression = Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class); final SqlDialect dialect = createDialect(dialectFactory, dataSource); final JdbcConvention convention = JdbcConvention.of(dialect, expression, name); return new JdbcSchema(dataSource, dialect, convention, catalog, schema); }
/** * Adds the schema name to the rootSchema. * * @param rootSchema The calcite schema for the database. * @param dataSource The dataSource for the jdbc schema. * @param schemaName The name of the schema used for the database. * * @return the schema. */ private static SchemaPlus addSchema(SchemaPlus rootSchema, DataSource dataSource, String schemaName) { // todo look into https://github.com/yahoo/fili/issues/509 return rootSchema.add(// avg tests run at ~75-100ms schemaName, JdbcSchema.create(rootSchema, null, dataSource, null, null) ); } }
public Schema create( SchemaPlus parentSchema, String name, Map<String, Object> operand) { SchemaPlus schema = parentSchema.add(name, JdbcSchema.create(parentSchema, name + "$source", operand)); return new CloneSchema(schema); } }
public Schema create( SchemaPlus parentSchema, String name, Map<String, Object> operand) { SchemaPlus schema = parentSchema.add(name, JdbcSchema.create(parentSchema, name + "$source", operand)); return new CloneSchema(schema); } }
public void visit(JsonJdbcSchema jsonSchema) { checkRequiredAttributes(jsonSchema, "name"); final SchemaPlus parentSchema = currentMutableSchema("jdbc schema"); final DataSource dataSource = JdbcSchema.dataSource(jsonSchema.jdbcUrl, jsonSchema.jdbcDriver, jsonSchema.jdbcUser, jsonSchema.jdbcPassword); final JdbcSchema schema; if (jsonSchema.sqlDialectFactory == null || jsonSchema.sqlDialectFactory.isEmpty()) { schema = JdbcSchema.create(parentSchema, jsonSchema.name, dataSource, jsonSchema.jdbcCatalog, jsonSchema.jdbcSchema); } else { SqlDialectFactory factory = AvaticaUtils.instantiatePlugin( SqlDialectFactory.class, jsonSchema.sqlDialectFactory); schema = JdbcSchema.create(parentSchema, jsonSchema.name, dataSource, factory, jsonSchema.jdbcCatalog, jsonSchema.jdbcSchema); } final SchemaPlus schemaPlus = parentSchema.add(jsonSchema.name, schema); populateSchema(jsonSchema, schemaPlus); }
public void visit(JsonJdbcSchema jsonSchema) { checkRequiredAttributes(jsonSchema, "name"); final SchemaPlus parentSchema = currentMutableSchema("jdbc schema"); final DataSource dataSource = JdbcSchema.dataSource(jsonSchema.jdbcUrl, jsonSchema.jdbcDriver, jsonSchema.jdbcUser, jsonSchema.jdbcPassword); final JdbcSchema schema; if (jsonSchema.sqlDialectFactory == null || jsonSchema.sqlDialectFactory.isEmpty()) { schema = JdbcSchema.create(parentSchema, jsonSchema.name, dataSource, jsonSchema.jdbcCatalog, jsonSchema.jdbcSchema); } else { SqlDialectFactory factory = AvaticaUtils.instantiatePlugin( SqlDialectFactory.class, jsonSchema.sqlDialectFactory); schema = JdbcSchema.create(parentSchema, jsonSchema.name, dataSource, factory, jsonSchema.jdbcCatalog, jsonSchema.jdbcSchema); } final SchemaPlus schemaPlus = parentSchema.add(jsonSchema.name, schema); populateSchema(jsonSchema, schemaPlus); }
JdbcSchema.dataSource(db1, "org.hsqldb.jdbcDriver", "", ""); rootSchema.add("DB1", JdbcSchema.create(rootSchema, "DB1", ds1, null, null)); final DataSource ds2 = JdbcSchema.dataSource(db2, "org.hsqldb.jdbcDriver", "", ""); rootSchema.add("DB2", JdbcSchema.create(rootSchema, "DB2", ds2, null, null));
private Connection setup() throws SQLException { // Create a jdbc database & table final String db = TempDb.INSTANCE.getUrl(); Connection c1 = DriverManager.getConnection(db, "", ""); Statement stmt1 = c1.createStatement(); // This is a table we can join with the emps from the hr schema stmt1.execute("create table table1(id integer not null primary key, " + "field1 varchar(10))"); stmt1.execute("insert into table1 values(100, 'foo')"); stmt1.execute("insert into table1 values(200, 'bar')"); c1.close(); // Make a Calcite schema with both a jdbc schema and a non-jdbc schema Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); SchemaPlus rootSchema = calciteConnection.getRootSchema(); rootSchema.add("DB", JdbcSchema.create(rootSchema, "DB", JdbcSchema.dataSource(db, "org.hsqldb.jdbcDriver", "", ""), null, null)); rootSchema.add("hr", new ReflectiveSchema(new JdbcTest.HrSchema())); return connection; }
JdbcSchema.dataSource(db1, "org.hsqldb.jdbcDriver", "", ""); rootSchema.add("DB1", JdbcSchema.create(rootSchema, "DB1", ds1, null, null)); final DataSource ds2 = JdbcSchema.dataSource(db2, "org.hsqldb.jdbcDriver", "", ""); rootSchema.add("DB2", JdbcSchema.create(rootSchema, "DB2", ds2, null, null));
final DataSource ds = JdbcSchema.dataSource(db, "org.hsqldb.jdbcDriver", "", ""); rootSchema.add("DB", JdbcSchema.create(rootSchema, "DB", ds, null, null));
private Connection setup() throws SQLException { // Create a jdbc database & table final String db = TempDb.INSTANCE.getUrl(); Connection c1 = DriverManager.getConnection(db, "", ""); Statement stmt1 = c1.createStatement(); // This is a table we can join with the emps from the hr schema stmt1.execute("create table table1(id integer not null primary key, " + "field1 varchar(10))"); stmt1.execute("insert into table1 values(100, 'foo')"); stmt1.execute("insert into table1 values(200, 'bar')"); c1.close(); // Make a Calcite schema with both a jdbc schema and a non-jdbc schema Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); SchemaPlus rootSchema = calciteConnection.getRootSchema(); rootSchema.add("DB", JdbcSchema.create(rootSchema, "DB", JdbcSchema.dataSource(db, "org.hsqldb.jdbcDriver", "", ""), null, null)); rootSchema.add("hr", new ReflectiveSchema(new JdbcTest.HrSchema())); return connection; }
final DataSource ds = JdbcSchema.dataSource(db, "org.hsqldb.jdbcDriver", "", ""); rootSchema.add("DB", JdbcSchema.create(rootSchema, "DB", ds, null, null));
cs.password); return rootSchema.add(schema.schemaName, JdbcSchema.create(rootSchema, schema.schemaName, dataSource, cs.catalog, cs.schema)); case JDBC_FOODMART: JdbcSchema.dataSource(cs.url, cs.driver, cs.username, cs.password); return rootSchema.add(schema.schemaName, JdbcSchema.create(rootSchema, schema.schemaName, dataSource, cs.catalog, cs.schema)); case JDBC_FOODMART_WITH_LATTICE:
cs.password); return rootSchema.add(schema.schemaName, JdbcSchema.create(rootSchema, schema.schemaName, dataSource, cs.catalog, cs.schema)); case JDBC_FOODMART: JdbcSchema.dataSource(cs.url, cs.driver, cs.username, cs.password); return rootSchema.add(schema.schemaName, JdbcSchema.create(rootSchema, schema.schemaName, dataSource, cs.catalog, cs.schema)); case JDBC_FOODMART_WITH_LATTICE: