/** Returns a {@link Queryable}, given a fully-qualified table name. */ public static <E> Queryable<E> queryable(DataContext root, Class<E> clazz, String... names) { SchemaPlus schema = root.getRootSchema(); for (int i = 0; i < names.length - 1; i++) { String name = names[i]; schema = schema.getSubSchema(name); } final String tableName = names[names.length - 1]; return queryable(root, schema, clazz, tableName); }
/** Returns a {@link Queryable}, given a schema and table name. */ public static <E> Queryable<E> queryable( DataContext root, SchemaPlus schema, Class<E> clazz, String tableName) { QueryableTable table = (QueryableTable) schema.getTable(tableName); return table.asQueryable(root.getQueryProvider(), schema, tableName); }