Skip to content

Entity type named as python reserved keyword #14

Description

@lb-consult

Hello,

I'm trying to use python-odata (version 0.6.3) to query Microsoft Dataverse.

python v3.13.1
python-odata v0.6.3

By default, Microsoft Dataverse defines an entity type name "import":
(from the $metadata endpoint)

[...]
<EntityType Name="import" BaseType="mscrm.crmbaseentity">
    <Key>
        <PropertyRef Name="importid" />
    </Key>
    [...]
</EntityType>
[...]

When creating a ODataService with the option reflect_entities: True, a class named import is generated which create an error when trying to import this class as import is a reserved word.

class import(ReflectionBase):               <- Error: invalid syntax (entities.py, line 24704)
    __odata_collection__ = None
    __odata_type__ = "Microsoft.Dynamics.CRM.import"
  
    # Simple properties
    [...] 

Any idea how to workaround this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions