Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-pylib
Commits
76184d95
Commit
76184d95
authored
2 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
DRAFT: Implement possible fix for missing list datatype
parent
f1797a49
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!93
Release 0.11.0
,
!92
F merge missing list datatype
Pipeline
#32556
failed
2 years ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosdb/apiutils.py
+11
-1
11 additions, 1 deletion
src/caosdb/apiutils.py
with
11 additions
and
1 deletion
src/caosdb/apiutils.py
+
11
−
1
View file @
76184d95
...
...
@@ -37,7 +37,7 @@ from subprocess import call
from
typing
import
Optional
,
Any
,
Dict
,
List
from
caosdb.common.datatype
import
(
BOOLEAN
,
DATETIME
,
DOUBLE
,
FILE
,
INTEGER
,
REFERENCE
,
TEXT
,
is_reference
)
LIST
,
REFERENCE
,
TEXT
,
is_reference
)
from
caosdb.common.models
import
(
Container
,
Entity
,
File
,
Property
,
Query
,
Record
,
RecordType
,
execute_query
,
get_config
,
SPECIAL_ATTRIBUTES
)
...
...
@@ -442,6 +442,16 @@ def merge_entities(entity_a: Entity, entity_b: Entity, merge_references_with_emp
setattr
(
entity_a
.
get_property
(
key
),
attribute
,
diff_r2
[
"
properties
"
][
key
][
attribute
])
elif
force
:
if
attribute
==
"
value
"
:
# Very special case of a property that has a scalar
# datatype being fored to a list value without
# having been assigned the correct datatype before.
if
isinstance
(
diff_r2
[
"
properties
"
][
key
][
attribute
],
list
):
if
((
entity_a
.
get_property
(
key
).
datatype
is
not
None
)
and
(
not
entity_a
.
get_property
(
key
).
datatype
.
startswith
(
"
LIST<
"
))):
entity_a
.
get_property
(
key
).
datatype
=
LIST
(
entity_a
.
get_property
(
key
).
datatype
)
setattr
(
entity_a
.
get_property
(
key
),
attribute
,
diff_r2
[
"
properties
"
][
key
][
attribute
])
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment