Closed dogenius01 closed 6 years ago
There is no such thing as parquet.ParquetFileWriter
. The prevailing pattern is to execute parquet.ParquetWriter.openFile(schema,path,options)
which returns a promise to the writer. You can either execute within an async function and await on the writer:
let writer = await parquet.ParquetWriter.openFile(schema, 'fruits.parquet');
or use the writer within a .then
await parquet.ParquetWriter.openFile(schema, 'fruits.parquet')
.then(writer = {
// write stuff
});
See example in the integration tests: https://github.com/ironSource/parquetjs/blob/master/test/integration.js#L99-L113
@ZJONSSON Thank you! But the code above is copied from https://www.npmjs.com/package/parquetjs. And it gives me an error, when i try >> writer.appendRow... >> SyntaxError: Unexpected token .
I tried the code below....
var parquet = require('parquetjs');
// declare a schema for the
fruits
table var schema = new parquet.ParquetSchema({ name: { type: 'UTF8' }, quantity: { type: 'INT64' }, price: { type: 'DOUBLE' }, in_stock: { type: 'BOOLEAN' } });// create new ParquetWriter that writes to 'fruits.parquet` var writer = new parquet.ParquetFileWriter(schema, 'fruits.parquet');
This gives me an error.