Open MuravevAV opened 9 months ago
Hi @MuravevAV 👋
Could you please provide more info on your setup (platform?) and how you build the custom image?
Hi @igorlukanin! Thank you for your help! My setup platform is Oracle Linux 7.9 , Cent OS 7 and MAC OS. I tested all the steps (below) on these three platforms and got the same error. I need Vertica_driver and I did the following steps:
docker build -t cubejs/cube:vertica -f dev.Dockerfile ../../
docker images
docker run -p 4000:4000\
-v ${PWD}:/cube/conf\
-e CUBEJS_DEV_MODE=true \
-e CUBEJS_DB_TYPE=vertica \
-e CUBEJS_DB_HOST=127.*****.0 \
-e CUBEJS_DB_NAME=devdb \
-e CUBEJS_DB_PORT=5433 \
-e CUBEJS_DB_USER=******** \
-e CUBEJS_DB_PASS=****** \
cubejs/cube:vertica
from cube import TemplateContext
template = TemplateContext()
@template.function('load_data')
def load_data():
client = MyApiClient("example.com")
return client.load_data()
class MyApiClient:
def __init__(self, api_url):
self.api_url = api_url
# mock API call
def load_data(self):
api_response = {
"cubes": [
{
"name": "cube_from_api_with_dimensions",
"measures": [
{ "name": "quote_pricemidpoint", "type": "sum", "sql": "quote_price_midpoint" },
],
"dimensions": [
{ "name": "quotecode", "sql": "quote__quoterole__quote_code", "type": "string" },
{ "name": "calendardate", "sql": "calendar_reportdate_calendar_date_full", "type": "time" }
]
}
]
}
return api_response
Python (loadPythonContext) is not supported because you are using the fallback build of native extension.
docker pull cubejs/cube:latest
docker run -p 4000:4000\
-v ${PWD}:/cube/conf\
-e CUBEJS_DEV_MODE=true \
cubejs/cube
I would like to get a docker image as cubejs/cube:latest (because there is no (loadPythonContext) error there) with a built-in Vertica_driver.
@MuravevAV Thanks for such a complete list of reproduction steps, really appreciate that.
These steps strike my attention:
I need Vertica_driver I downloaded this Code in ZIP format to my MAC from the link https://github.com/KnowItAllAus/cube.js-korowa/tree/vertica_driver
I don't think that building a custom image of Cube as a whole is really necessary in this case.
Please take a look in the docs: https://cube.dev/docs/product/configuration/data-sources#third-party-drivers
Vertica driver is published as an npm package, so you can install it inside the container and use with driver_factory
: https://cube.dev/docs/reference/configuration/config#driver_factory
Alternatively, you can extend the Docker image without rebuilding it from scratch. This would be better because I can see that the fork is many releases behind the current version of Cube: https://cube.dev/docs/product/deployment/core#extend-the-docker-image
I hope this helps.
Thank you @igorlukanin! Based on your recommendation, I did this:
Dockerfile:
FROM cubejs/cube:latest
COPY . .
RUN npm i @knowitall/vertica-driver
.dockerignore
node_modules
schema
cube.py
cube.js
.env
node_modules
npm-debug.log
docker run -p 4000:4000\
-v ${PWD}:/cube/conf\
-e CUBEJS_DEV_MODE=true \
-e CUBEJS_DB_TYPE=vertica \
-e CUBEJS_DB_HOST=127.*****.0 \
-e CUBEJS_DB_NAME=devdb \
-e CUBEJS_DB_PORT=5433 \
-e CUBEJS_DB_USER=******** \
-e CUBEJS_DB_PASS=****** \
vertica:v1
Error: Unsupported db type: vertica
at driverDependencies (/cube/node_modules/@cubejs-backend/server-core/src/core/DriverResolvers.ts:27:9)
at lookupDriverClass (/cube/node_modules/@cubejs-backend/server-core/src/core/DriverResolvers.ts:39:23)
at Function.createDriver (/cube/node_modules/@cubejs-backend/server-core/src/core/DriverResolvers.ts:70:40)
at CubejsServerCore.resolveDriver (/cube/node_modules/@cubejs-backend/server-core/src/core/server.ts:826:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at CubejsServerCore.getDriver (/cube/node_modules/@cubejs-backend/server-core/src/core/server.ts:799:22)
at /cube/node_modules/@cubejs-backend/server-core/src/core/DevServer.ts:108:22
at /cube/node_modules/@cubejs-backend/server-core/src/core/DevServer.ts:78:9
Maybe I incorrectly wrote the commands in the Dockerfile? Or I started the docker container incorrectly?
I tried different options for building Docker images. When I build the image using the dev.Docker file, then Vertica driver works, but Python does not work (Error: Python (loadPythonContext) is not supported because you are using the fallback build of native extension.). If I build Docker image using a latest.Dockerfile, then Python works, but the Vertica driver does not work (Error: Unsupported db type: vertica). Please, help create Docker image in which both Python and the vertica driver will work. We want to make cube cluster.
I built a docker image using dev.Dockerfile. I'm successfully running a docker container and I want to use global.py file to run a dynamic model. But when I start *global.py** I get an error like this. Please tell me how to create a docker image to avoid this error?:
_Python (loadPythonContext) is not supported because you are using the fallback build of native extension. Read more: https://github.com/cube-js/cube/blob/master/packages/cubejs-backend-native/README.md#supported-architectures-and-platforms