# PyBIS: new\_object\_type does not have "description"

**URL:** <https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264>\
**Category:** Installation & maintenance\
**Created:** [27 October 2023 11:41 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264 "2023-10-27T11:41:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kerzel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.openbis.ch/kerzel/32/30_2.png) [@kerzel](https://community.openbis.ch/u/kerzel)\
**Post date:** [27 October 2023 11:41 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/1 "2023-10-27T11:41:02Z")

</div>

Dear all,

it seems that in version pybis==1.36.3 the parameter “description” is not there?

```auto
    obj_electronmicroscope_new = oBis.new_object_type(
        code = code_obj_electronmicroscope,
        generatedCodePrefix = 'ELECTRON_MICROSCOPE',
        #description = 'Electron Microscope',
        autoGeneratedCode = True
    )

```

Many thanks  
Ulrich

---

<div class="post-metadata">

**Author:** ![alaskowski](https://dub1.discourse-cdn.com/flex013/user_avatar/community.openbis.ch/alaskowski/32/65_2.png) [@alaskowski](https://community.openbis.ch/u/alaskowski)\
**Post date:** [20 November 2023 19:40 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/2 "2023-11-20T19:40:59Z")

</div>

Dear Ulrich,

‘Description’ is not part of the ‘new\_object\_type’ method parameter (and never has been). It is an attribute you can set, i.e:

```auto
obj_electronmicroscope_new = oBis.new_object_type(
        code = code_obj_electronmicroscope,
        generatedCodePrefix = 'ELECTRON_MICROSCOPE',
        autoGeneratedCode = True
    )
obj_electronmicroscope_new.description = 'Electron Microscope'

```

Where did you find this snippet? I can not find it in PyBIS docs

Best,  
Adam

---

<div class="post-metadata">

**Author:** ![kerzel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.openbis.ch/kerzel/32/30_2.png) [@kerzel](https://community.openbis.ch/u/kerzel)\
**Post date:** [22 November 2023 09:23 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/3 "2023-11-22T09:23:02Z")

</div>

Dear @alaskowski

great, thank you.  
I’m in the process of coding up our metadata schema, as well as populating it with instruments, consumables and (some) protocols in python.  
(Similar to what you prepared in Java for the tutorials, but python based as I’m not sure how much people know about Java…  
If you’re interested, I’m happy to share it with you once I’ve made some more progress?

All the best  
Ulrich

---

<div class="post-metadata">

**Author:** ![alaskowski](https://dub1.discourse-cdn.com/flex013/user_avatar/community.openbis.ch/alaskowski/32/65_2.png) [@alaskowski](https://community.openbis.ch/u/alaskowski)\
**Post date:** [24 November 2023 11:45 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/4 "2023-11-24T11:45:25Z")

</div>

Dear @kerzel

Sure, I don’t mind checking it out but I strongly recommend to share it with the whole community via our community github repo: [openbis · GitHub](https://github.com/openbis)

It may benefit other people in the future or someone may point out some improvements as well 😉

Best,  
Adam

---

<div class="post-metadata">

**Author:** ![kerzel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.openbis.ch/kerzel/32/30_2.png) [@kerzel](https://community.openbis.ch/u/kerzel)\
**Post date:** [24 November 2023 12:02 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/5 "2023-11-24T12:02:16Z")

</div>

Dear @alaskowski

of course - the code will go into a repo that is then shared with the community.  
However, I though it maybe helpful if we do a little peer-review first and see if we can spot any things that should be improved, etc? I’d upload the code to the same repo though, it’s more a matter when to announce to the community they can have a look if they find it helpful.

All the best  
bon weekend  
Uli

---

<div class="post-metadata">

**Author:** ![bafe](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bafe](https://community.openbis.ch/u/bafe)\
**Post date:** [24 November 2023 18:17 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/6 "2023-11-24T18:17:35Z")

</div>

Hello @kerzel , you could also consider the following options to populate the schema:

- the Excel master data service
- The new import API (coming in the next version)
- Our JSON based schema export/import

The advantage over a simple pybis script is that these solutions all offer transactional behaviour

---

<div class="post-metadata">

**Author:** ![kerzel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.openbis.ch/kerzel/32/30_2.png) [@kerzel](https://community.openbis.ch/u/kerzel)\
**Post date:** [27 November 2023 06:37 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/7 "2023-11-27T06:37:11Z")

</div>

Dear @bafe,

many thanks - true.  
It’s not just the metadata though, but also the instruments and devices, consumables, protocols, etc.  
though, of course, some stuff will be filled by hand, we aim for talking to all groups, get their working environment and code it - I’m not sure we can track down everyone and everything over time otherwise…

All the best  
Ulrich

---

<div class="post-metadata">

**Author:** ![bafe](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bafe](https://community.openbis.ch/u/bafe)\
**Post date:** [27 November 2023 06:58 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/8 "2023-11-27T06:58:53Z")

</div>

Hello Ulrich,  
Importing metadata on top of just a schema should be possible with any of the methods above.

I don’t want to sell you anything, but having done the custom scripting way before I’d like to stress the fact that the standard way is well though out and offers significant advantages compared to scripts when it comes to robustness and user friendliness.

Let me explain a bit.The excel import (as well as the Java V3 API, therefore our JSON import) support OpenBIS transactions:

All the creation/import operations specified in a configuration file happen in the same transaction (a “unit of work”). If anything fails during the import, the state of the OpenBIS database is rolled back to the state before the import, leaving a clean database behind.

If you don’t use transactions, an error happening midway during an import will result in an incomplete database with a potentially large number of objects but not the data you wanted to import. This might require manual clean-up.

I hope this helps clarify why I stress the importance of these features

---

<div class="post-metadata">

**Author:** ![kerzel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.openbis.ch/kerzel/32/30_2.png) [@kerzel](https://community.openbis.ch/u/kerzel)\
**Post date:** [27 November 2023 07:33 UTC](https://community.openbis.ch/t/pybis-new-object-type-does-not-have-description/264/9 "2023-11-27T07:33:06Z")

</div>

Dear Simone,

many thanks for the detailed explanation. I’ll take another look at the options you suggested and investigate a bit more in detail.  
Realistically, using Java will be difficult as most people will have some knowledge of Python but typically not to the level where they could code a more complex scenario

All the best  
Uli
