You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi !
I've got an issue in dev mode where schema compilation are happening all the time.
Also, only happening using cube.py. Got the same scope with cube.js, and working fine (tried to switch to python to get more flexibility..)
With a lot of cubes it makes the playground unresponsive. From the log i can see that schema version seems to have a new hash suffixed all the time, triggering the recompile.
Slack thread: https://cube-js.slack.com/archives/C04NYBJP7RQ/p1733337668458919
Please find below a minimal setup that reproduces the issue.
Just have one model static model defined, in model repository. Refresh key defined but return constant value.
Database is local postgres
cube.py
from cube import config, file_repository
# Define users with their credentials and security context
USERS = {
"arthur": {
"password": "password1",
"securityContext": {
"user": "arthur",
"apiType": "sql_api",
"typologies": ["startup"],
},
}
}
@config('repository_factory')
def repository_factory(ctx: dict) -> list[dict]:
repo = file_repository('model')
# Sort by a stable attribute that all cubes have, e.g. 'name'
repo = sorted(repo, key=lambda x: x.get('name', ''))
return repo
@config('schema_version')
def schema_version(ctx):
return "fixed_schema_version"
@config('check_sql_auth')
def check_sql_auth(req: dict, user_name: str, password: str) -> dict:
"""
Authenticate SQL API users and return their security context.
"""
user_data = USERS.get(user_name)
if user_data:
if user_data["password"] == password:
security_context = user_data["securityContext"]
print(f"User authenticated: {user_name}")
return {"password": password, "securityContext": security_context}
print(f"Authentication failed for user: {user_name}")
raise Exception("Access denied")
@config('context_to_app_id')
def context_to_app_id(ctx: dict) -> str:
access_type = ctx.get('securityContext', {}).get('access_type', None)
app_id = "bi_api" if access_type == "sql_api" else "rest_api"
print(f"Generated appId: {app_id} for access_type: {access_type}")
return app_id
@config('scheduled_refresh_contexts')
def scheduled_refresh_contexts():
return [
{
"securityContext": {
"user": "defaultUser",
"access_type": "sql_api", # Instead of apiType, use access_type to match your code
"typologies": []
}
}
]
Hi !
I've got an issue in dev mode where schema compilation are happening all the time.
Also, only happening using cube.py. Got the same scope with cube.js, and working fine (tried to switch to python to get more flexibility..)
With a lot of cubes it makes the playground unresponsive. From the log i can see that schema version seems to have a new hash suffixed all the time, triggering the recompile.
Slack thread: https://cube-js.slack.com/archives/C04NYBJP7RQ/p1733337668458919
Please find below a minimal setup that reproduces the issue.
Just have one model static model defined, in model repository. Refresh key defined but return constant value.
Database is local postgres
cube.py
docker-compose
Two set of logs
First one; think linked to refresh of cache. Can see schema compilation back to back
Another one when making a query from the playground. again schema compilation
I would expect the schema to be always the same.
At most two schema compilation, due to two possibles app_id
The text was updated successfully, but these errors were encountered: