Search in sources :

Example 1 with SnowflakeReader

use of org.talend.components.snowflake.runtime.SnowflakeReader in project components by Talend.

the class SnowflakeRuntimeIT method readRows.

protected List<IndexedRecord> readRows(SnowflakeConnectionTableProperties props, RuntimeContainer container) throws IOException {
    TSnowflakeInputProperties inputProps = null;
    if (props instanceof TSnowflakeInputProperties) {
        inputProps = (TSnowflakeInputProperties) props;
    } else {
        inputProps = (TSnowflakeInputProperties) new TSnowflakeInputProperties("bar").init();
    }
    inputProps.connection = props.connection;
    inputProps.table = props.table;
    BoundedReader<IndexedRecord> reader = (SnowflakeReader) createBoundedReader(inputProps, container);
    boolean hasRecord = reader.start();
    List<IndexedRecord> rows = new ArrayList<>();
    while (hasRecord) {
        org.apache.avro.generic.IndexedRecord unenforced = reader.getCurrent();
        rows.add(unenforced);
        hasRecord = reader.advance();
    }
    reader.close();
    return rows;
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) ArrayList(java.util.ArrayList) TSnowflakeInputProperties(org.talend.components.snowflake.tsnowflakeinput.TSnowflakeInputProperties) IndexedRecord(org.apache.avro.generic.IndexedRecord) SnowflakeReader(org.talend.components.snowflake.runtime.SnowflakeReader)

Aggregations

ArrayList (java.util.ArrayList)1 IndexedRecord (org.apache.avro.generic.IndexedRecord)1 SnowflakeReader (org.talend.components.snowflake.runtime.SnowflakeReader)1 TSnowflakeInputProperties (org.talend.components.snowflake.tsnowflakeinput.TSnowflakeInputProperties)1