castor-extractor 0.23.3__py3-none-any.whl → 0.24.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of castor-extractor might be problematic. Click here for more details.

Files changed (51) hide show
  1. CHANGELOG.md +8 -0
  2. README.md +2 -0
  3. castor_extractor/commands/extract_looker_studio.py +30 -0
  4. castor_extractor/knowledge/confluence/client/client.py +0 -13
  5. castor_extractor/knowledge/confluence/client/endpoints.py +1 -1
  6. castor_extractor/visualization/looker_studio/__init__.py +1 -0
  7. castor_extractor/visualization/looker_studio/assets.py +1 -0
  8. castor_extractor/visualization/looker_studio/client/client.py +56 -6
  9. castor_extractor/visualization/looker_studio/client/credentials.py +5 -0
  10. castor_extractor/visualization/looker_studio/client/queries/query.sql +52 -0
  11. castor_extractor/visualization/looker_studio/extract.py +84 -0
  12. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.1.dist-info}/METADATA +11 -1
  13. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.1.dist-info}/RECORD +16 -48
  14. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.1.dist-info}/entry_points.txt +1 -0
  15. castor_extractor/visualization/tableau/__init__.py +0 -3
  16. castor_extractor/visualization/tableau/assets.py +0 -49
  17. castor_extractor/visualization/tableau/client/__init__.py +0 -2
  18. castor_extractor/visualization/tableau/client/client.py +0 -229
  19. castor_extractor/visualization/tableau/client/client_utils.py +0 -75
  20. castor_extractor/visualization/tableau/client/credentials.py +0 -104
  21. castor_extractor/visualization/tableau/client/project.py +0 -28
  22. castor_extractor/visualization/tableau/client/safe_mode.py +0 -70
  23. castor_extractor/visualization/tableau/constants.py +0 -9
  24. castor_extractor/visualization/tableau/errors.py +0 -5
  25. castor_extractor/visualization/tableau/extract.py +0 -121
  26. castor_extractor/visualization/tableau/gql_fields.py +0 -249
  27. castor_extractor/visualization/tableau/tests/__init__.py +0 -0
  28. castor_extractor/visualization/tableau/tests/unit/__init__.py +0 -0
  29. castor_extractor/visualization/tableau/tests/unit/assets/graphql/metadata/metadata_1_get.json +0 -15
  30. castor_extractor/visualization/tableau/tests/unit/assets/graphql/metadata/metadata_2_get.json +0 -15
  31. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/auth.xml +0 -7
  32. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/project_get.xml +0 -9
  33. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/user_get.xml +0 -8
  34. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/view_get_usage.xml +0 -24
  35. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/workbook_get.xml +0 -19
  36. castor_extractor/visualization/tableau/tests/unit/graphql/__init__.py +0 -0
  37. castor_extractor/visualization/tableau/tests/unit/graphql/paginated_object_test.py +0 -63
  38. castor_extractor/visualization/tableau/tests/unit/rest_api/__init__.py +0 -0
  39. castor_extractor/visualization/tableau/tests/unit/rest_api/auth_test.py +0 -39
  40. castor_extractor/visualization/tableau/tests/unit/rest_api/credentials_test.py +0 -13
  41. castor_extractor/visualization/tableau/tests/unit/rest_api/projects_test.py +0 -59
  42. castor_extractor/visualization/tableau/tests/unit/rest_api/usages_test.py +0 -49
  43. castor_extractor/visualization/tableau/tests/unit/rest_api/users_test.py +0 -52
  44. castor_extractor/visualization/tableau/tests/unit/rest_api/workbooks_test.py +0 -60
  45. castor_extractor/visualization/tableau/tests/unit/utils/__init__.py +0 -1
  46. castor_extractor/visualization/tableau/tests/unit/utils/env_key.py +0 -6
  47. castor_extractor/visualization/tableau/tsc_fields.py +0 -46
  48. castor_extractor/visualization/tableau/types.py +0 -11
  49. castor_extractor/visualization/tableau/usage.py +0 -14
  50. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.1.dist-info}/LICENCE +0 -0
  51. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.1.dist-info}/WHEEL +0 -0
@@ -1,60 +0,0 @@
1
- import os
2
- import unittest
3
- from unittest import mock
4
-
5
- import requests_mock # type: ignore
6
- import tableauserverclient as TSC # type: ignore
7
-
8
- from ....client import ApiClient
9
- from ..utils import KEYS
10
-
11
- TEST_ASSET_DIR = os.path.join(os.path.dirname(__file__), "../assets/rest_api/")
12
-
13
- GET_XML = os.path.join(TEST_ASSET_DIR, "workbook_get.xml")
14
-
15
- EXPECTED = [
16
- {
17
- "id": "6d13b0ca-043d-4d42-8c9d-3f3313ea3a00",
18
- "name": "Superstore",
19
- "description": "description for Superstore",
20
- "tags": set(),
21
- "project_id": "ee8c6e70-43b6-11e6-af4f-f7b0d8e20760",
22
- "created_at": None,
23
- "updated_at": None,
24
- "owner_id": "5de011f8-5aa9-4d5b-b991-f462c8dd6bb7",
25
- "webpage_url": "http://tableauserver/#/workbooks/1/views",
26
- },
27
- {
28
- "id": "3cc6cd06-89ce-4fdc-b935-5294135d6d42",
29
- "name": "SafariSample",
30
- "description": "description for SafariSample",
31
- "tags": {"Sample", "Safari"},
32
- "project_id": "ee8c6e70-43b6-11e6-af4f-f7b0d8e20760",
33
- "created_at": None,
34
- "updated_at": None,
35
- "owner_id": "5de011f8-5aa9-4d5b-b991-f462c8dd6bb7",
36
- "webpage_url": "http://tableauserver/#/workbooks/2/views",
37
- },
38
- ]
39
-
40
-
41
- class WorkbookTests(unittest.TestCase):
42
- @mock.patch.dict(os.environ, KEYS)
43
- def setUp(self):
44
- self._client = ApiClient(test=True)
45
- self._client._server = TSC.Server("http://test")
46
-
47
- # Fake signin
48
- self._client._server._site_id = "dad65087-b08b-4603-af4e-2887b8aafc67"
49
- self._client._server._auth_token = "j80k54ll2lfMZ0tv97mlPvvSCRyD0DOM"
50
-
51
- self.baseurl = self._client._server.workbooks.baseurl
52
-
53
- def test_fetch_workbooks(self):
54
- with open(GET_XML, "rb") as f:
55
- response_xml = f.read().decode("utf-8")
56
- with requests_mock.mock() as m:
57
- m.get(self.baseurl, text=response_xml)
58
- results = self._client._fetch_workbooks()
59
-
60
- self.assertEqual(results, EXPECTED)
@@ -1 +0,0 @@
1
- from .env_key import KEYS
@@ -1,6 +0,0 @@
1
- KEYS = {
2
- "CASTOR_TABLEAU_USER": "Test",
3
- "CASTOR_TABLEAU_SERVER_URL": "http://test",
4
- "CASTOR_TABLEAU_PASSWORD": "Test",
5
- "CASTOR_TABLEAU_SITE_ID": "dad65087-b08b-4603-af4e-2887b8aafc67",
6
- }
@@ -1,46 +0,0 @@
1
- # TSC for TableauServerClient: basic REST API to extracting core objects
2
-
3
- from .assets import TableauAsset
4
-
5
- # TSC fields extracted per assets
6
- TSC_FIELDS: dict[TableauAsset, set[str]] = {
7
- TableauAsset.PROJECT: {
8
- "id",
9
- "name",
10
- "description",
11
- "parent_id",
12
- },
13
- TableauAsset.PUBLISHED_DATASOURCE: {
14
- "id",
15
- "name",
16
- "description",
17
- "tags",
18
- "project_id",
19
- "created_at",
20
- "updated_at",
21
- "owner_id",
22
- "webpage_url",
23
- },
24
- TableauAsset.USAGE: {
25
- "workbook_id",
26
- "total_views",
27
- },
28
- TableauAsset.USER: {
29
- "id",
30
- "name",
31
- "email",
32
- "fullname",
33
- "site_role",
34
- },
35
- TableauAsset.WORKBOOK: {
36
- "id",
37
- "name",
38
- "description",
39
- "tags",
40
- "project_id",
41
- "created_at",
42
- "updated_at",
43
- "owner_id",
44
- "webpage_url",
45
- },
46
- }
@@ -1,11 +0,0 @@
1
- from typing import Union
2
-
3
- from tableauserverclient import ServerResponseError # type: ignore
4
- from typing_extensions import Literal
5
-
6
- from .errors import TableauErrorCode
7
-
8
- PageReturn = Union[
9
- tuple[list[dict], Literal[None]],
10
- tuple[Literal[None], Union[TableauErrorCode, ServerResponseError]],
11
- ]
@@ -1,14 +0,0 @@
1
- from ...utils import SerializedAsset, group_by
2
-
3
-
4
- def compute_usage_views(usages: SerializedAsset) -> SerializedAsset:
5
- """Compute usages views with group by workbook_id"""
6
- grouped = group_by("workbook_id", usages)
7
- aggregated = [
8
- {
9
- "workbook_id": key,
10
- "view_counts": sum(x["total_views"] for x in value),
11
- }
12
- for key, value in grouped.items()
13
- ]
14
- return aggregated