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
fb6967bb
Commit
fb6967bb
authored
3 years ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev' into f-fix-json-schema
parents
6227568a
9d0083a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!33
MAINT: change arguments of create_user
,
!29
Revert "Revert "Merge branch 'f-validate-config' into 'dev'""
Pipeline
#14627
passed
3 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/doc/tutorials/Data-Insertion.rst
+29
-7
29 additions, 7 deletions
src/doc/tutorials/Data-Insertion.rst
with
29 additions
and
7 deletions
src/doc/tutorials/Data-Insertion.rst
+
29
−
7
View file @
fb6967bb
...
...
@@ -49,11 +49,11 @@ resolution, but we'll omit this for the sake of brevity for now.
.. code:: python
rt = db.RecordType(name="2D_BarkleySimulation",
description="Spatially extended Barkley simulation")
description="Spatially extended Barkley simulation")
# inherit all properties from the BarkleySimulation RecordType
rt.add_parent(name="BarkleySimulation", inheritance="all")
rt.insert()
print(rt.get_property(name="epsilon").importance) ### rt has a "epsilon" property with the same importance as "BarkleySimulation"
The parameter ``inheritance=(obligatory|recommended|fix|all|none)`` of
...
...
@@ -135,15 +135,37 @@ Useful is also, that you can insert directly tabular data.
.. code:: python
from caosadvancedtools.table_converter import from_tsv
recs = from_tsv("test.csv", "Experiment")
print(recs)
recs.insert()
from caosadvancedtools.table_converter import from_tsv
recs = from_tsv("test.csv", "Experiment")
print(recs)
recs.insert()
With this example file
`test.csv <uploads/4f2c8756a26a3984c0af09d206d583e5/test.csv>`__.
List Properties
---------------
As you may already know, properties can also have list values instead of scalar
values. They can be accessed, set, and updated as you would expect from any
list-valued attribute in Python, as the following example illustrates.
.. code:: python
import caosdb as db
db.Property(name="TestList", datatype=db.LIST(db.DOUBLE)).insert()
db.RecordType(name="TestType").add_property(name="TestList").insert()
db.Record(name="TestRec").add_parent("TestType").add_property(
name="TestList", value=[1,2,3]).insert()
retrieved = db.Record(name="TestRec").retrieve()
retrieved.get_property("TestList").value += [4,5]
retrieved.update()
# Check update
retrieved = db.Record(name="TestRec").retrieve()
print(retrieved.get_property("TestList").value)
File Update
-----------
...
...
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