Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases #51

Open
floris-b opened this issue Jan 25, 2021 · 2 comments

Comments

@floris-b
Copy link

floris-b commented Jan 25, 2021

What could be the cause of the error message when loading metadata?

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

@floris-b
Copy link
Author

floris-b commented Feb 9, 2021

It goes wrong on the second entity set is load:

      <EntityType Name="Right_DataRight"
                  BaseType="OData.Right">
        <Property Name="Read"
                  Type="Edm.Boolean" />
        <Property Name="Delete"
                  Type="Edm.Boolean" />
        <Property Name="Create"
                  Type="Edm.Boolean" />
        <Property Name="Update"
                  Type="Edm.Boolean" />
      </EntityType>

      <EntityType Name="EntityType"
                  BaseType="OData.Entity">
        <Property Name="HasInvolved"
                  Type="Edm.Boolean" />
        <Property Name="IsNameHiddenForUser"
                  Type="Edm.Boolean" />
        <Property Name="HasProducts"
                  Type="Edm.Boolean" />
        <Property Name="AllowNoteOrAttachmentDuringConstruction"
                  Type="Edm.Boolean" />
        <Property Name="IsInUserPack"
                  Type="Edm.Boolean" />
        <Property Name="IsOverridable"
                  Type="Edm.Boolean" />
        <Property Name="IsMetadata"
                  Type="Edm.Boolean" />
        <Property Name="Metadata"
                  Type="Edm.String" />
        <Property Name="Name"
                  Type="Edm.String" />
        <NavigationProperty Name="DataRight"
                            Type="Collection(OData.Right_DataRight)" />


        <NavigationProperty Name="DataRight"
                            Type="Collection(OData.Right_DataRight)" />

        <EntitySet Name="OData.Right_DataRight"
                   EntityType="OData.Right.DataRight" />

      </EntityType>

      <EntityType Name="Right"
                  BaseType="OData.Entity">
        <NavigationProperty Name="Role"
                            Type="OData.RightsProfile" />
      </EntityType>

2021-02-09 08:20:47,063 INFO 239:metadata.py(1525) - Load {'name': 'OData.LayoutTemplate', 'type': 'OData.LayoutTemplate', 'schema': {'name': 'LayoutTemplate', 'type': 'OData.LayoutTemplate', 'properties': [{'name': 'Specification', 'type': 'Edm.String', 'is_primary_key': False, 'is_collection': False, 'is_computed_value': False}], 'navigation_properties': [], 'base_type': 'OData.Entity'}} entity set
2021-02-09 08:20:47,070 INFO 239:metadata.py(1525) - Load {'name': 'OData.Right_DataRight', 'type': 'OData.Right.DataRight', 'schema': None} entity set

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-45-d43293df7892> in <module>
----> 1 Service = ODataService(SERVICE_URL,reflect_entities=True,session=oauth)

~/work/odata/service.py in __init__(self, url, base, reflect_entities, session, auth)
    140 
    141         if reflect_entities:
--> 142             _, self.entities, self.types = self.metadata.get_entity_sets(base=self.Entity)
    143 
    144         self.Entity.__odata_url_base__ = url

~/work/odata/metadata.py in get_entity_sets(self, base)
    241             set_name = entity_set.get('name')
    242             is_singleton = entity_set.get('singleton', False)
--> 243             set_class = type('EntitySet' + set_name, (entity_class,), dict(__odata_collection__=set_name, __odata_singleton__=is_singleton))
    244             sets[set_name] = set_class
    245 

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

@floris-b
Copy link
Author

floris-b commented Feb 9, 2021

where does the OData.LayoutTemplate come from? I do not see any mention of it in the metadata

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant