SistemaStrategy / HiveThrift

Node API for fast querying of Hive using Thrift middleware
1 stars 4 forks source link

basic usage is missing a file: no such file or directory, open './config.json' #1

Open jcollum opened 8 years ago

jcollum commented 8 years ago
$ npm i -S hive-thrift
...
├─┬ hive-thrift@1.0.5 

$ node
> var client = require ('hive-thrift')
Error: ENOENT: no such file or directory, open './config.json'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at /Users/collumj/work/crdb/data-utilities/node_modules/hive-thrift/src/
HiveThriftClient.js:15:40
    at Object.<anonymous> (/Users/collumj/work/crdb/data-utilities/node_modules/
hive-thrift/src/HiveThriftClient.js:416:3)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

$ node --version
v6.5.0

I think that covers it for the error report. If the library requires a config there's nothing about it in the sample: https://github.com/SistemaStrategy/HiveThrift/blob/master/examples/simple-example.js. If a config is required the library should throw an error when no config is present.

I see that this is covered in the readme, the config.json requirement. I think this is a poor approach, I've not seen another database library use this pattern. Typically they ask that configuration be passed in as an object when the connection is made or the configuration be set on the library after it is required but before it is used.

If I need to pull in environment variables for my connections, how would I do that with your library?