SAP / python-pyodata

Enterprise-ready Python OData client
Apache License 2.0
223 stars 93 forks source link

No result from get_entities #87

Closed heiqs closed 4 years ago

heiqs commented 4 years ago

Hi,

I am using the library to get data from an endpoint. Here is my endpoint:

https://.../sap/c4c/odata/v1/collection/

However, the API only returns the ObjectID and not other columns.

When I do a call like this:

>>> client.entity_sets.Collection.get_entities().select('LastChangeDate').execute() I get the following error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/.../service.py", line 779, in __repr__
    return self._entity_key.to_key_string()
AttributeError: 'NoneType' object has no attribute 'to_key_string'

For following command I only get the objectID back:

>>> client.entity_sets.Collection.get_entities().top(1).execute()

[('00163E08ABF01ED792DXXXXX')

Any Help?

filak-sap commented 4 years ago

Hi @heiqs, thank you for taking the time to report this issue.

Can you please post the response obtained in your browser or postman?

heiqs commented 4 years ago

Hi, thanks for fast response. Using your bin/pyodata, now I am getting data. Now, I understand how to use the library :)

Just a question: doing like this is not correct, true? I get this to_key_string error.

client.entity_sets.Collection.get_entities().select('PartyID').top(1).execute() It is similar to this from docu: employees = northwind.entity_sets.Employees.get_entities().select('EmployeeID,LastName').execute() So. It is fixed for me. We can close this issue.

filak-sap commented 4 years ago

Hmm, that looks like a bug. We probably expect all key properties are always returned. Anyways, I cannot tell what's wrong without more details about the service.

Thank you for the follow up. Closing this message for now.