diff --git a/setup.py b/setup.py index 27edb0ffa..c272b3f11 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ ] setup(name='toucan_connectors', - version='0.17.0', + version='0.17.1', description='Toucan Toco Connectors', author='Toucan Toco', author_email='dev@toucantoco.com', diff --git a/toucan_connectors/odata/odata_connector.py b/toucan_connectors/odata/odata_connector.py index 25b24f6df..e5ced4dee 100644 --- a/toucan_connectors/odata/odata_connector.py +++ b/toucan_connectors/odata/odata_connector.py @@ -1,10 +1,22 @@ import pandas as pd from odata import ODataService +from odata.metadata import MetaData from toucan_connectors.common import Auth from toucan_connectors.toucan_connector import ToucanConnector, ToucanDataSource +# monkey patch MetaData's __init__ +# (cf. https://github.com/tuomur/python-odata/issues/22) +def metadata_init_patched(self, service): + self._original_init(service) + self.url = service.url.rstrip('/') + '/$metadata' + + +MetaData._original_init = MetaData.__init__ +MetaData.__init__ = metadata_init_patched + + class ODataDataSource(ToucanDataSource): entity: str query: dict