Merge pull request #40 from overhangio/redwood
Feat: Upgrade to redwood
This commit is contained in:
commit
0066855708
@ -19,6 +19,15 @@ instructions, because git commits are used to generate release notes:
|
||||
|
||||
<!-- scriv-insert-here -->
|
||||
|
||||
<a id='changelog-18.0.0'></a>
|
||||
## v18.0.0 (2024-06-20)
|
||||
|
||||
- 💥[Feature] Upgrade to Redwood. (by @Fahadkhalid210)
|
||||
- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb)
|
||||
- [Improvement] Update User Activity dataset query by extending time span to 120 seconds and selecting all events where course ID is not null to improve average time spent in course. (by @Fahadkhalid210)
|
||||
- [Improvement] Added CORS for embedded Dashboards. (by @Fahadkhalid210)
|
||||
- 💥[Feature] Upgrade Clickhouse to version 24.1.8.22 and fix query issues due to deprecation of live views. (by @Fahadkhalid210)
|
||||
|
||||
<a id='changelog-17.1.0'></a>
|
||||
## v17.1.0 (2024-02-09)
|
||||
|
||||
|
||||
@ -1 +0,0 @@
|
||||
- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb)
|
||||
@ -1 +0,0 @@
|
||||
- [Improvement] Update User Activity dataset query by extending time span to 120 seconds and selecting all events where course ID is not null to improve average time spent in course. (by @Fahadkhalid210)
|
||||
4
setup.py
4
setup.py
@ -41,8 +41,8 @@ setup(
|
||||
packages=find_packages(exclude=["tests*"]),
|
||||
include_package_data=True,
|
||||
python_requires=">=3.8",
|
||||
install_requires=["tutor>=17.0.0,<18.0.0"],
|
||||
extras_require={"dev": ["tutor[dev]>=17.0.0,<18.0.0"]},
|
||||
install_requires=["tutor>=18.0.0,<19.0.0"],
|
||||
extras_require={"dev": ["tutor[dev]>=18.0.0,<19.0.0"]},
|
||||
entry_points={"tutor.plugin.v1": ["cairn = tutorcairn.plugin"]},
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
|
||||
@ -1 +1 @@
|
||||
__version__ = "17.1.0"
|
||||
__version__ = "18.0.0"
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
RENAME TABLE _openedx_course_enrollments TO openedx_course_enrollments;
|
||||
RENAME TABLE _openedx_user_profiles TO openedx_user_profiles;
|
||||
RENAME TABLE _openedx_users TO openedx_users;
|
||||
|
||||
DROP TABLE course_enrollments;
|
||||
CREATE VIEW course_enrollments AS
|
||||
SELECT
|
||||
openedx_course_enrollments.course_id AS course_id,
|
||||
openedx_course_enrollments.created AS enrollment_created,
|
||||
openedx_course_enrollments.is_active AS enrollment_is_active,
|
||||
openedx_course_enrollments.mode AS enrollment_mode,
|
||||
openedx_course_enrollments.user_id AS user_id,
|
||||
openedx_users.username AS username,
|
||||
openedx_users.email AS user_email,
|
||||
openedx_user_profiles.year_of_birth AS user_year_of_birth,
|
||||
openedx_user_profiles.gender AS user_gender,
|
||||
openedx_user_profiles.level_of_education AS user_level_of_education,
|
||||
openedx_user_profiles.city AS user_city,
|
||||
openedx_user_profiles.state AS user_state,
|
||||
openedx_user_profiles.country AS user_country
|
||||
FROM openedx_course_enrollments
|
||||
INNER JOIN openedx_user_profiles ON openedx_course_enrollments.user_id = openedx_user_profiles.user_id
|
||||
INNER JOIN openedx_users ON openedx_course_enrollments.user_id = openedx_users.id;
|
||||
@ -0,0 +1,15 @@
|
||||
RENAME TABLE _openedx_block_completion TO openedx_block_completion;
|
||||
|
||||
DROP TABLE course_block_completion;
|
||||
|
||||
CREATE VIEW course_block_completion AS
|
||||
SELECT
|
||||
openedx_block_completion.course_key AS course_id,
|
||||
openedx_block_completion.block_key AS block_key,
|
||||
openedx_block_completion.user_id AS user_id,
|
||||
openedx_block_completion.completion AS completion,
|
||||
course_blocks.position as position,
|
||||
course_blocks.display_name as display_name,
|
||||
course_blocks.full_name as full_name
|
||||
FROM openedx_block_completion
|
||||
INNER JOIN course_blocks ON openedx_block_completion.block_key = course_blocks.block_key;
|
||||
@ -41,6 +41,7 @@ available_languages = {
|
||||
"ru": {"flag": "ru", "name": "Russian"},
|
||||
"sk": {"flag": "sk", "name": "Slovak"},
|
||||
"sl": {"flag": "si", "name": "Slovenian"},
|
||||
"uk": {"flag": "uk", "name": "Ukranian"},
|
||||
"zh": {"flag": "cn", "name": "Chinese"},
|
||||
}
|
||||
{#- https://github.com/apache/superset/blob/master/docs/docs/contributing/translations.mdx#enabling-language-selection #}
|
||||
|
||||
@ -1,11 +1,6 @@
|
||||
# https://hub.docker.com/r/yandex/clickhouse-server/tags
|
||||
FROM docker.io/yandex/clickhouse-server:22.1.3.7
|
||||
# https://hub.docker.com/r/clickhouse/clickhouse-server/tags
|
||||
FROM docker.io/clickhouse/clickhouse-server:24.1.8.22
|
||||
|
||||
# The clickhouse repo is currently unavailable in some parts of the world. If we don't
|
||||
# remove this repo here then `apt update` will fail. Check if the problem is resolved with:
|
||||
# curl https://repo.yandex.ru/clickhouse/deb/stable/
|
||||
# The above command should be a 200, and not a 404.
|
||||
RUN rm /etc/apt/sources.list.d/clickhouse.list
|
||||
RUN apt update && apt install -y python3
|
||||
COPY ./scripts /scripts
|
||||
RUN chmod a+x /scripts/*
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# https://github.com/apache/superset/releases
|
||||
# https://github.com/apache/superset/blob/master/Dockerfile
|
||||
# https://superset.apache.org/docs/databases/installing-database-drivers
|
||||
FROM docker.io/apache/superset:3.0.1
|
||||
FROM docker.io/apache/superset:4.0.0
|
||||
|
||||
USER root
|
||||
|
||||
@ -18,11 +18,11 @@ RUN apt-get update \
|
||||
pkg-config
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/pip,sharing=shared pip install \
|
||||
clickhouse-driver==0.2.6 \
|
||||
mysqlclient==2.2.0 \
|
||||
clickhouse-connect==0.6.20 \
|
||||
clickhouse-driver==0.2.7 \
|
||||
mysqlclient==2.2.4 \
|
||||
clickhouse-connect==0.7.8 \
|
||||
clickhouse-sqlalchemy==0.2.4 \
|
||||
authlib==1.2.1
|
||||
authlib==1.3.0
|
||||
|
||||
USER superset
|
||||
|
||||
|
||||
@ -88,7 +88,8 @@ def create_superset_db_role(role_name: str, superset_database_name: str) -> None
|
||||
return False
|
||||
|
||||
# Create or update role with the same name as the user
|
||||
security_manager.set_role(role_name, check_permission)
|
||||
pvms = security_manager._get_all_pvms()
|
||||
security_manager.set_role(role_name, check_permission, pvms)
|
||||
|
||||
|
||||
def create_clickhouse_user(clickhouse_username):
|
||||
@ -117,11 +118,17 @@ def grant_clickhouse_row_based_access(clickhouse_username, course_ids=None):
|
||||
for table in make_clickhouse_query("SHOW TABLES").split("\n"):
|
||||
if not table.startswith("_"):
|
||||
make_clickhouse_query(
|
||||
f"""GRANT SELECT ON {table} TO '{clickhouse_username}';"""
|
||||
)
|
||||
make_clickhouse_query(
|
||||
f"""CREATE ROW POLICY OR REPLACE '{clickhouse_username}' ON {table} AS RESTRICTIVE FOR SELECT USING {condition} TO '{clickhouse_username}';"""
|
||||
)
|
||||
f"""GRANT SELECT ON {table} TO '{clickhouse_username}';"""
|
||||
)
|
||||
|
||||
if table in ["openedx_users", "openedx_user_profiles", "openedx_block_completion"]:
|
||||
make_clickhouse_query(
|
||||
f"""CREATE ROW POLICY OR REPLACE '{clickhouse_username}' ON {table} AS RESTRICTIVE FOR SELECT USING 1 TO '{clickhouse_username}';"""
|
||||
)
|
||||
else:
|
||||
make_clickhouse_query(
|
||||
f"""CREATE ROW POLICY OR REPLACE '{clickhouse_username}' ON {table} AS RESTRICTIVE FOR SELECT USING {condition} TO '{clickhouse_username}';"""
|
||||
)
|
||||
|
||||
|
||||
def make_clickhouse_query(query):
|
||||
|
||||
@ -13,7 +13,7 @@ from superset.connectors.sqla.models import SqlaTable
|
||||
from superset.models.core import Database
|
||||
from superset.models.slice import Slice
|
||||
from superset.extensions import db, security_manager
|
||||
import superset.dashboards.commands.importers.v0 as importers
|
||||
import superset.commands.dashboard.importers.v0 as importers
|
||||
from werkzeug.security import generate_password_hash
|
||||
|
||||
# Our convenient library
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user