Release Connectors v0.1.21 with external knowledge integration
Module Package Release / publish-packages (push) Successful in 12s

This commit is contained in:
2026-08-22 14:34:36 +02:00
parent 2c2b11f860
commit 79e2315e89
28 changed files with 6351 additions and 33 deletions
@@ -0,0 +1,207 @@
"""MediaWiki and BlueSpice knowledge connector state
Revision ID: b9e0f1a2c3d4
Revises: a8d9e0f1b2c3
Create Date: 2026-08-22 14:00:00.000000
"""
from __future__ import annotations
from alembic import op
import sqlalchemy as sa
revision = "b9e0f1a2c3d4"
down_revision = "a8d9e0f1b2c3"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
"connector_knowledge_profiles",
sa.Column("id", sa.String(length=36), nullable=False),
sa.Column("tenant_id", sa.String(length=36), nullable=False),
sa.Column("configuration_id", sa.String(length=36), nullable=False),
sa.Column("status", sa.String(length=30), nullable=False),
sa.Column("product", sa.String(length=50), nullable=False),
sa.Column("product_version", sa.String(length=100), nullable=True),
sa.Column("desired_maturity", sa.String(length=30), nullable=False),
sa.Column("discovered_maturity", sa.String(length=30), nullable=False),
sa.Column("source_authority_mode", sa.String(length=40), nullable=False),
sa.Column("default_visibility", sa.String(length=30), nullable=False),
sa.Column("default_acl_tokens", sa.JSON(), nullable=False),
sa.Column("namespace_mappings", sa.JSON(), nullable=False),
sa.Column("capabilities", sa.JSON(), nullable=False),
sa.Column("discovery_revision", sa.String(length=255), nullable=True),
sa.Column("discovery_evidence", sa.JSON(), nullable=False),
sa.Column("health_status", sa.String(length=30), nullable=False),
sa.Column("health_details", sa.JSON(), nullable=False),
sa.Column("discovered_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("last_sync_cursor", sa.String(length=500), nullable=True),
sa.Column("last_high_watermark", sa.String(length=500), nullable=True),
sa.Column("resource_revision", sa.Integer(), nullable=False),
sa.Column("updated_by", sa.String(length=255), nullable=True),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
sa.ForeignKeyConstraint(
["configuration_id"],
["connector_configurations.id"],
name=op.f(
"fk_connector_knowledge_profiles_configuration_id_connector_configurations"
),
ondelete="RESTRICT",
),
sa.PrimaryKeyConstraint(
"id", name=op.f("pk_connector_knowledge_profiles")
),
sa.UniqueConstraint(
"tenant_id",
"configuration_id",
name="uq_connector_knowledge_profile_configuration",
),
)
for name, columns in (
("ix_connector_knowledge_profiles_tenant_id", ["tenant_id"]),
("ix_connector_knowledge_profiles_configuration_id", ["configuration_id"]),
("ix_connector_knowledge_profiles_status", ["status"]),
("ix_connector_knowledge_profiles_product", ["product"]),
("ix_connector_knowledge_profiles_discovery_revision", ["discovery_revision"]),
("ix_connector_knowledge_profiles_health_status", ["health_status"]),
("ix_connector_knowledge_profiles_updated_by", ["updated_by"]),
):
op.create_index(op.f(name), "connector_knowledge_profiles", columns)
op.create_index(
"ix_connector_knowledge_profiles_tenant_status",
"connector_knowledge_profiles",
["tenant_id", "status"],
)
op.create_table(
"connector_knowledge_objects",
sa.Column("id", sa.String(length=36), nullable=False),
sa.Column("tenant_id", sa.String(length=36), nullable=False),
sa.Column("profile_id", sa.String(length=36), nullable=False),
sa.Column("object_type", sa.String(length=40), nullable=False),
sa.Column("external_id", sa.String(length=255), nullable=False),
sa.Column("external_page_id", sa.String(length=255), nullable=True),
sa.Column("external_revision_id", sa.String(length=255), nullable=True),
sa.Column("namespace_id", sa.Integer(), nullable=True),
sa.Column("title", sa.String(length=500), nullable=False),
sa.Column("canonical_url", sa.String(length=1500), nullable=True),
sa.Column("status", sa.String(length=30), nullable=False),
sa.Column("redirect_target_external_id", sa.String(length=255), nullable=True),
sa.Column("source_revision", sa.String(length=255), nullable=False),
sa.Column("content_hash", sa.String(length=64), nullable=False),
sa.Column("visibility", sa.String(length=30), nullable=False),
sa.Column("acl_tokens", sa.JSON(), nullable=False),
sa.Column("mapped_data", sa.JSON(), nullable=False),
sa.Column("provenance", sa.JSON(), nullable=False),
sa.Column("change_cursor", sa.String(length=500), nullable=True),
sa.Column("source_updated_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("observed_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("resource_revision", sa.Integer(), nullable=False),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
sa.ForeignKeyConstraint(
["profile_id"],
["connector_knowledge_profiles.id"],
name=op.f(
"fk_connector_knowledge_objects_profile_id_connector_knowledge_profiles"
),
ondelete="CASCADE",
),
sa.PrimaryKeyConstraint(
"id", name=op.f("pk_connector_knowledge_objects")
),
sa.UniqueConstraint(
"profile_id",
"object_type",
"external_id",
name="uq_connector_knowledge_object_identity",
),
)
for name, columns in (
("ix_connector_knowledge_objects_tenant_id", ["tenant_id"]),
("ix_connector_knowledge_objects_profile_id", ["profile_id"]),
("ix_connector_knowledge_objects_object_type", ["object_type"]),
("ix_connector_knowledge_objects_external_page_id", ["external_page_id"]),
("ix_connector_knowledge_objects_external_revision_id", ["external_revision_id"]),
("ix_connector_knowledge_objects_namespace_id", ["namespace_id"]),
("ix_connector_knowledge_objects_status", ["status"]),
("ix_connector_knowledge_objects_content_hash", ["content_hash"]),
("ix_connector_knowledge_objects_change_cursor", ["change_cursor"]),
("ix_connector_knowledge_objects_source_updated_at", ["source_updated_at"]),
("ix_connector_knowledge_objects_observed_at", ["observed_at"]),
):
op.create_index(op.f(name), "connector_knowledge_objects", columns)
op.create_index(
"ix_connector_knowledge_objects_tenant_profile_status",
"connector_knowledge_objects",
["tenant_id", "profile_id", "status"],
)
op.create_index(
"ix_connector_knowledge_objects_tenant_updated",
"connector_knowledge_objects",
["tenant_id", "source_updated_at"],
)
op.create_table(
"connector_knowledge_sync_runs",
sa.Column("id", sa.String(length=36), nullable=False),
sa.Column("tenant_id", sa.String(length=36), nullable=False),
sa.Column("profile_id", sa.String(length=36), nullable=False),
sa.Column("mode", sa.String(length=40), nullable=False),
sa.Column("idempotency_key", sa.String(length=255), nullable=False),
sa.Column("request_hash", sa.String(length=64), nullable=False),
sa.Column("status", sa.String(length=30), nullable=False),
sa.Column("cursor_before", sa.String(length=500), nullable=True),
sa.Column("cursor_after", sa.String(length=500), nullable=True),
sa.Column("high_watermark", sa.String(length=500), nullable=True),
sa.Column("counts", sa.JSON(), nullable=False),
sa.Column("effects", sa.JSON(), nullable=False),
sa.Column("diagnostics", sa.JSON(), nullable=False),
sa.Column("provenance", sa.JSON(), nullable=False),
sa.Column("created_by", sa.String(length=255), nullable=True),
sa.Column("started_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("finished_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
sa.ForeignKeyConstraint(
["profile_id"],
["connector_knowledge_profiles.id"],
name=op.f(
"fk_connector_knowledge_sync_runs_profile_id_connector_knowledge_profiles"
),
ondelete="CASCADE",
),
sa.PrimaryKeyConstraint(
"id", name=op.f("pk_connector_knowledge_sync_runs")
),
sa.UniqueConstraint(
"tenant_id",
"profile_id",
"mode",
"idempotency_key",
name="uq_connector_knowledge_sync_run_idempotency",
),
)
for name, columns in (
("ix_connector_knowledge_sync_runs_tenant_id", ["tenant_id"]),
("ix_connector_knowledge_sync_runs_profile_id", ["profile_id"]),
("ix_connector_knowledge_sync_runs_mode", ["mode"]),
("ix_connector_knowledge_sync_runs_status", ["status"]),
("ix_connector_knowledge_sync_runs_created_by", ["created_by"]),
("ix_connector_knowledge_sync_runs_started_at", ["started_at"]),
):
op.create_index(op.f(name), "connector_knowledge_sync_runs", columns)
op.create_index(
"ix_connector_knowledge_sync_runs_profile_started",
"connector_knowledge_sync_runs",
["tenant_id", "profile_id", "started_at"],
)
def downgrade() -> None:
op.drop_table("connector_knowledge_sync_runs")
op.drop_table("connector_knowledge_objects")
op.drop_table("connector_knowledge_profiles")