Thanks for taking the time for contribution to Cube.js! We're very welcoming community and while it's very much appreciated if you follow these guidelines it's not a requirement.
This project and everyone participating in it is governed by the Cube.js Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to info@statsbot.co.
Cube.js works with Node.js 8+ and uses yarn as a package manager.
- After cloning Cube.js repository run
$ yarninpackages/cubejs-client-coreandpackages/cubejs-reactto install dependencies. - Use
$ yarn linkto add these packages to link registry. - Perform required code changes.
- Use
$ yarn buildin the repository root to build CommonJS and UMD modules. - Use
$ yarn link @cubejs-client/coreand/or$ yarn link @cubejs-client/reactin your project to test changes applied. - Use
$ yarn testwhere available to test your changes. - Ensure commit CommonJS and UMD modules as part of your commit.
- Copy existing driver package structure and name it in
@cubejs-backend/<db-name>-driverformat.@cubejs-backend/mysql-driveris very good candidate for copying this structure. - Please do not copy CHANGELOG.md.
- Name driver class and adjust package.json, README.md accordingly.
- As a rule of thumb please use only Pure JS libraries as a dependencies where possible. It increases driver adoption rate a lot.
- Typically you need to implement only
query()andtestConnection()methods of driver. The rest will be done byBaseDriverclass. - If db requires connection pooling prefer use
generic-poolimplementation with settings similar to other db packages. - Make sure your driver has
release()method in case DB expects graceful shutdowns for connections. - Please use yarn to add any dependencies and run
$ yarnwithin the package before committing to ensure rightyarn.lockis in place. - Add this driver dependency to (cubejs-server-core/core/index.js)[https://github.com/statsbotco/cube.js/blob/master/packages/cubejs-server-core/core/index.js#L8].
- Find most similar
BaseQueryimplementation in@cubejs-backend/schema-compiler/adapter. - Copy it and adjust SQL generation accordingly.
- Add
BaseQueryimplementation to@cubejs-backend/schema-compiler/adapter/QueryBuilder.jswith same name as driver.