Skip to content

Commit 8de9a79

Browse files
LennartSchmidtKernlumburovskalinaandhreljaKern
authored
Add text list attribute for sharepoint integration tags (#336)
* model * Added datatype text list to the search helper * Submodules fix * model * PR comments * Submodules update * perf: update alembic revisions * chore: update submodules * chore: update submodules * fix: alembic down_revision * chore: update submodules --------- Co-authored-by: Lina <lina.lumburovska@kern.ai> Co-authored-by: andhreljaKern <andrea.hrelja@kern.ai>
1 parent 2605b73 commit 8de9a79

File tree

5 files changed

+194
-1
lines changed

5 files changed

+194
-1
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
"""change schema
2+
3+
Revision ID: 150ac8a20e59
4+
Revises: 7334713b30a6
5+
Create Date: 2025-07-29 12:44:15.804586
6+
7+
"""
8+
9+
from alembic import op
10+
import sqlalchemy as sa
11+
from sqlalchemy.dialects import postgresql
12+
13+
# revision identifiers, used by Alembic.
14+
revision = "150ac8a20e59"
15+
down_revision = "7334713b30a6"
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_table(
23+
"sharepoint_property_sync",
24+
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
25+
sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True),
26+
sa.Column("created_at", sa.DateTime(), nullable=True),
27+
sa.Column("updated_at", sa.DateTime(), nullable=True),
28+
sa.Column("integration_id", postgresql.UUID(as_uuid=True), nullable=True),
29+
sa.Column("config", sa.JSON(), nullable=True),
30+
sa.Column("logs", sa.ARRAY(sa.String()), nullable=True),
31+
sa.Column("state", sa.String(), nullable=True),
32+
sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"),
33+
sa.ForeignKeyConstraint(
34+
["integration_id"], ["cognition.integration.id"], ondelete="CASCADE"
35+
),
36+
sa.PrimaryKeyConstraint("id"),
37+
schema="integration",
38+
)
39+
op.create_index(
40+
op.f("ix_integration_sharepoint_property_sync_created_by"),
41+
"sharepoint_property_sync",
42+
["created_by"],
43+
unique=False,
44+
schema="integration",
45+
)
46+
op.create_index(
47+
op.f("ix_integration_sharepoint_property_sync_integration_id"),
48+
"sharepoint_property_sync",
49+
["integration_id"],
50+
unique=False,
51+
schema="integration",
52+
)
53+
op.drop_index(
54+
"ix_sharepoint_property_sync_created_by", table_name="sharepoint_property_sync"
55+
)
56+
op.drop_index(
57+
"ix_sharepoint_property_sync_integration_id",
58+
table_name="sharepoint_property_sync",
59+
)
60+
op.drop_table("sharepoint_property_sync")
61+
# ### end Alembic commands ###
62+
63+
64+
def downgrade():
65+
# ### commands auto generated by Alembic - please adjust! ###
66+
op.create_table(
67+
"sharepoint_property_sync",
68+
sa.Column("id", postgresql.UUID(), autoincrement=False, nullable=False),
69+
sa.Column("created_by", postgresql.UUID(), autoincrement=False, nullable=True),
70+
sa.Column(
71+
"created_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
72+
),
73+
sa.Column(
74+
"updated_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
75+
),
76+
sa.Column(
77+
"integration_id", postgresql.UUID(), autoincrement=False, nullable=True
78+
),
79+
sa.Column(
80+
"config",
81+
postgresql.JSON(astext_type=sa.Text()),
82+
autoincrement=False,
83+
nullable=True,
84+
),
85+
sa.Column(
86+
"logs", postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True
87+
),
88+
sa.Column("state", sa.VARCHAR(), autoincrement=False, nullable=True),
89+
sa.ForeignKeyConstraint(
90+
["created_by"],
91+
["user.id"],
92+
name="sharepoint_property_sync_created_by_fkey",
93+
ondelete="SET NULL",
94+
),
95+
sa.ForeignKeyConstraint(
96+
["integration_id"],
97+
["cognition.integration.id"],
98+
name="sharepoint_property_sync_integration_id_fkey",
99+
ondelete="CASCADE",
100+
),
101+
sa.PrimaryKeyConstraint("id", name="sharepoint_property_sync_pkey"),
102+
)
103+
op.create_index(
104+
"ix_sharepoint_property_sync_integration_id",
105+
"sharepoint_property_sync",
106+
["integration_id"],
107+
unique=False,
108+
)
109+
op.create_index(
110+
"ix_sharepoint_property_sync_created_by",
111+
"sharepoint_property_sync",
112+
["created_by"],
113+
unique=False,
114+
)
115+
op.drop_index(
116+
op.f("ix_integration_sharepoint_property_sync_integration_id"),
117+
table_name="sharepoint_property_sync",
118+
schema="integration",
119+
)
120+
op.drop_index(
121+
op.f("ix_integration_sharepoint_property_sync_created_by"),
122+
table_name="sharepoint_property_sync",
123+
schema="integration",
124+
)
125+
op.drop_table("sharepoint_property_sync", schema="integration")
126+
# ### end Alembic commands ###
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
"""add integration sharepoint property sync
2+
3+
Revision ID: 7334713b30a6
4+
Revises: 6868ac66ea92
5+
Create Date: 2025-07-29 12:31:04.171629
6+
7+
"""
8+
9+
from alembic import op
10+
import sqlalchemy as sa
11+
from sqlalchemy.dialects import postgresql
12+
13+
# revision identifiers, used by Alembic.
14+
revision = "7334713b30a6"
15+
down_revision = "312568866ac4"
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_table(
23+
"sharepoint_property_sync",
24+
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
25+
sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True),
26+
sa.Column("created_at", sa.DateTime(), nullable=True),
27+
sa.Column("updated_at", sa.DateTime(), nullable=True),
28+
sa.Column("integration_id", postgresql.UUID(as_uuid=True), nullable=True),
29+
sa.Column("config", sa.JSON(), nullable=True),
30+
sa.Column("logs", sa.ARRAY(sa.String()), nullable=True),
31+
sa.Column("state", sa.String(), nullable=True),
32+
sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"),
33+
sa.ForeignKeyConstraint(
34+
["integration_id"], ["cognition.integration.id"], ondelete="CASCADE"
35+
),
36+
sa.PrimaryKeyConstraint("id"),
37+
)
38+
op.create_index(
39+
op.f("ix_sharepoint_property_sync_created_by"),
40+
"sharepoint_property_sync",
41+
["created_by"],
42+
unique=False,
43+
)
44+
op.create_index(
45+
op.f("ix_sharepoint_property_sync_integration_id"),
46+
"sharepoint_property_sync",
47+
["integration_id"],
48+
unique=False,
49+
)
50+
# ### end Alembic commands ###
51+
52+
53+
def downgrade():
54+
# ### commands auto generated by Alembic - please adjust! ###
55+
op.drop_index(
56+
op.f("ix_sharepoint_property_sync_integration_id"),
57+
table_name="sharepoint_property_sync",
58+
)
59+
op.drop_index(
60+
op.f("ix_sharepoint_property_sync_created_by"),
61+
table_name="sharepoint_property_sync",
62+
)
63+
op.drop_table("sharepoint_property_sync")
64+
# ### end Alembic commands ###

controller/attribute/manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ def calculate_user_attribute_sample_records(
457457
if (
458458
attribute.get(project_id, attribute_id).data_type
459459
== DataTypes.EMBEDDING_LIST.value
460+
or attribute.get(project_id, attribute_id).data_type
461+
== DataTypes.TEXT_LIST.value
460462
):
461463
# values are json serialized so they can be easily transferred to the frontend.
462464
# Since the return type is a list of strings, without json.dumps a str(xxxx) will be called

service/search/search_helper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ def build_order_by_table_select(
280280
DataTypes.CATEGORY.value: "TEXT",
281281
DataTypes.TEXT.value: "TEXT",
282282
DataTypes.LLM_RESPONSE.value: "TEXT",
283+
DataTypes.TEXT_LIST.value: "TEXT",
283284
}
284285

285286

0 commit comments

Comments
 (0)