因为官方mysql driver的bug,暂时issue 还没合并,所以临时开发了一个修复bug 的driver 可以直接参考使用
参考使用
- 环境准备
version: "3"
services:
ocenbase:
image: oceanbase/obce-mini
ports:
- "2881:2881"
- 代码集成
.env
CUBEJS_DB_HOST=localhost
CUBEJS_DB_PORT=2881
CUBEJS_DB_NAME=test
CUBEJS_DB_USER=sqluser01
CUBEJS_DB_PASS=123456
CUBEJS_WEB_SOCKETS=true
CUBEJS_DEV_MODE=true
CUBEJS_DB_TYPE=mysql
CUBEJS_API_SECRET=e727de30526a5029f87a5979e88ca5a211657ccc8f67877c366f170d80b1d81fc21671e3c0dc27813522316a17572aaff371db06769eda6077f35fc36aa4afe9
package.json
{
"name": "cubejs",
"version": "1.0.0",
"main": "app.js",
"license": "MIT",
"bin": "app.js",
"scripts": {
"dev": "cubejs-server"
},
"devDependencies": {
"@cubejs-backend/server": "^0.28.57"
},
"dependencies": {
"@dalongrong/mymysql-cubejs-driver": "^1.0.0"
}
}
cube.js
const {MySqlDriver,MySqlQuery} = require("@dalongrong/mymysql-cubejs-driver")
module.exports = {
dialectFactory: (dataSource) => {
// need config datasource for multitenant env
return MySqlQuery
},
dbType: ({ dataSource } = {}) => {
return "mymysql"
},
driverFactory: ({ dataSource } = {}) => {
return new MySqlDriver({})
}
};
- 效果
说明
已经push npm 私服了,可以直接使用,对于需要想体验cube.js 集成oceanbase的可以直接使用