You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@streampipes.apache.org by "tenthe (via GitHub)" <gi...@apache.org> on 2023/04/06 15:25:28 UTC
[PR] Sp 1367 Use QueryResult as return type for data lake measure API (streampipes)
tenthe opened a new pull request, #1492:
URL: https://github.com/apache/streampipes/pull/1492
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<!--
Thanks for contributing! Here are some tips you can follow to help us incorporate your contribution quickly and easily:
1. If this is your first time, please read our contributor guidelines:
- https://streampipes.apache.org/getinvolved.html
- https://cwiki.apache.org/confluence/display/STREAMPIPES/Getting+Started
2. Make sure the PR title is formatted like: `[#<GitHub issue id>] PR title ...`
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., `[WIP][#<GitHub issue id>] PR title ...`.
4. Please write your PR title to summarize what this PR proposes/fixes.
5. Link the PR to the corresponding GitHub issue (if present) in the `Development` section in the right menu bar.
6. Be sure to keep the PR description updated to reflect all changes.
7. If possible, provide a concise example to reproduce the issue for a faster review.
8. Make sure tests pass via `mvn clean install`.
9. (Optional) If the contribution is large, please file an Apache ICLA
- http://apache.org/licenses/icla.pdf
-->
### Purpose
<!--
Please clarify what changes you are proposing and describe how those changes will address the issue.
Furthermore, describe potential consequences the changes might have.
-->
Fixes #1367
### Remarks
<!--
Is there anything left we need to pay attention on?
Are there some references that might be important? E.g. links to Confluence, or discussions
on the mailing list or GitHub.
-->
PR introduces (a) breaking change(s): <yes/no>
PR introduces (a) deprecation(s): <yes/no>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@streampipes.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Sp 1367 Use QueryResult as return type for data lake measure API (streampipes)
Posted by "bossenti (via GitHub)" <gi...@apache.org>.
bossenti closed pull request #1492: Sp 1367 Use QueryResult as return type for data lake measure API
URL: https://github.com/apache/streampipes/pull/1492
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@streampipes.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Sp 1367 Use QueryResult as return type for data lake measure API (streampipes)
Posted by "bossenti (via GitHub)" <gi...@apache.org>.
bossenti commented on code in PR #1492:
URL: https://github.com/apache/streampipes/pull/1492#discussion_r1160532634
##########
streampipes-client-python/streampipes/model/resource/data_lake_series.py:
##########
@@ -22,26 +22,15 @@
Review Comment:
We should rename the file to `data_series.py`, right?
##########
streampipes-client-python/streampipes/model/resource/data_lake_series.py:
##########
@@ -22,26 +22,15 @@
import pandas as pd
from pydantic import StrictInt, StrictStr
+from streampipes.model.resource.exceptions import StreamPipesUnsupportedDataLakeSeries
from streampipes.model.resource.resource import Resource
__all__ = [
- "DataLakeSeries",
+ "DataSeries",
]
-class StreamPipesUnsupportedDataLakeSeries(Exception):
- """Exception to be raised when the returned data lake series
- cannot be parsed with the current implementation of the resource.
- """
-
- def __init__(self):
- super().__init__(
- "The Data Lake series returned by the API appears "
- "to have a structure that is not currently supported by the Python client."
- )
-
-
-class DataLakeSeries(Resource):
+class DataSeries(Resource):
"""Implementation of a resource for data lake series.
Review Comment:
for data series
##########
streampipes-client-python/streampipes/model/resource/data_lake_series.py:
##########
@@ -56,7 +45,7 @@ class DataLakeSeries(Resource):
"""
@classmethod
- def from_json(cls, json_string: str) -> DataLakeSeries:
+ def from_json(cls, json_string: str) -> DataSeries:
"""Creates an instance of `DataLakeSeries` from a given JSON string.
Review Comment:
DataSeries
##########
streampipes-client-python/streampipes/model/resource/data_lake_series.py:
##########
@@ -70,7 +59,7 @@ def from_json(cls, json_string: str) -> DataLakeSeries:
Returns
-------
- DataLakeSeries
+ DataSeries
Instance of `DataLakeSeries` that is created based on the given JSON string.
Review Comment:
same as above
It would be awesome if you could conduct a search for `DataLakeSeries` to catch all occurrences
##########
streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py:
##########
@@ -332,4 +333,4 @@ def get(self, identifier: str, **kwargs: Optional[Dict[str, Any]]) -> DataLakeSe
url += measurement_get_config.build_query_string()
response = self._make_request(request_method=self._parent_client.request_session.get, url=url)
- return self._resource_cls.from_json(json_string=response.text)
+ return self._resource_cls(**response.json())
Review Comment:
you could still use `from_json` here if you want to
##########
streampipes-client-python/streampipes/model/resource/exceptions.py:
##########
@@ -0,0 +1,33 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import annotations
+
+from typing import Optional
+
+
+class StreamPipesUnsupportedDataLakeSeries(Exception):
Review Comment:
This should probably be name `...supportedDataSeries`
##########
streampipes-client-python/streampipes/model/resource/exceptions.py:
##########
@@ -0,0 +1,33 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import annotations
Review Comment:
can/should be removed
##########
streampipes-client-python/streampipes/model/resource/query_result.py:
##########
@@ -0,0 +1,91 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import annotations
Review Comment:
can/should be removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@streampipes.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Sp 1367 Use QueryResult as return type for data lake measure API (streampipes)
Posted by "tenthe (via GitHub)" <gi...@apache.org>.
tenthe commented on PR #1492:
URL: https://github.com/apache/streampipes/pull/1492#issuecomment-1506424517
@bossenti thanks for the hint
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@streampipes.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Sp 1367 Use QueryResult as return type for data lake measure API (streampipes)
Posted by "tenthe (via GitHub)" <gi...@apache.org>.
tenthe merged PR #1492:
URL: https://github.com/apache/streampipes/pull/1492
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@streampipes.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Sp 1367 Use QueryResult as return type for data lake measure API (streampipes)
Posted by "bossenti (via GitHub)" <gi...@apache.org>.
bossenti commented on PR #1492:
URL: https://github.com/apache/streampipes/pull/1492#issuecomment-1505757361
@tenthe changes look good now
There seems to be one merge conflict that needs to be resolved
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@streampipes.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org