castor-extractor 0.23.3__py3-none-any.whl → 0.24.0__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 (43) hide show
  1. CHANGELOG.md +4 -0
  2. castor_extractor/knowledge/confluence/client/client.py +0 -13
  3. castor_extractor/knowledge/confluence/client/endpoints.py +1 -1
  4. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.0.dist-info}/METADATA +5 -1
  5. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.0.dist-info}/RECORD +8 -43
  6. castor_extractor/visualization/tableau/__init__.py +0 -3
  7. castor_extractor/visualization/tableau/assets.py +0 -49
  8. castor_extractor/visualization/tableau/client/__init__.py +0 -2
  9. castor_extractor/visualization/tableau/client/client.py +0 -229
  10. castor_extractor/visualization/tableau/client/client_utils.py +0 -75
  11. castor_extractor/visualization/tableau/client/credentials.py +0 -104
  12. castor_extractor/visualization/tableau/client/project.py +0 -28
  13. castor_extractor/visualization/tableau/client/safe_mode.py +0 -70
  14. castor_extractor/visualization/tableau/constants.py +0 -9
  15. castor_extractor/visualization/tableau/errors.py +0 -5
  16. castor_extractor/visualization/tableau/extract.py +0 -121
  17. castor_extractor/visualization/tableau/gql_fields.py +0 -249
  18. castor_extractor/visualization/tableau/tests/__init__.py +0 -0
  19. castor_extractor/visualization/tableau/tests/unit/__init__.py +0 -0
  20. castor_extractor/visualization/tableau/tests/unit/assets/graphql/metadata/metadata_1_get.json +0 -15
  21. castor_extractor/visualization/tableau/tests/unit/assets/graphql/metadata/metadata_2_get.json +0 -15
  22. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/auth.xml +0 -7
  23. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/project_get.xml +0 -9
  24. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/user_get.xml +0 -8
  25. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/view_get_usage.xml +0 -24
  26. castor_extractor/visualization/tableau/tests/unit/assets/rest_api/workbook_get.xml +0 -19
  27. castor_extractor/visualization/tableau/tests/unit/graphql/__init__.py +0 -0
  28. castor_extractor/visualization/tableau/tests/unit/graphql/paginated_object_test.py +0 -63
  29. castor_extractor/visualization/tableau/tests/unit/rest_api/__init__.py +0 -0
  30. castor_extractor/visualization/tableau/tests/unit/rest_api/auth_test.py +0 -39
  31. castor_extractor/visualization/tableau/tests/unit/rest_api/credentials_test.py +0 -13
  32. castor_extractor/visualization/tableau/tests/unit/rest_api/projects_test.py +0 -59
  33. castor_extractor/visualization/tableau/tests/unit/rest_api/usages_test.py +0 -49
  34. castor_extractor/visualization/tableau/tests/unit/rest_api/users_test.py +0 -52
  35. castor_extractor/visualization/tableau/tests/unit/rest_api/workbooks_test.py +0 -60
  36. castor_extractor/visualization/tableau/tests/unit/utils/__init__.py +0 -1
  37. castor_extractor/visualization/tableau/tests/unit/utils/env_key.py +0 -6
  38. castor_extractor/visualization/tableau/tsc_fields.py +0 -46
  39. castor_extractor/visualization/tableau/types.py +0 -11
  40. castor_extractor/visualization/tableau/usage.py +0 -14
  41. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.0.dist-info}/LICENCE +0 -0
  42. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.0.dist-info}/WHEEL +0 -0
  43. {castor_extractor-0.23.3.dist-info → castor_extractor-0.24.0.dist-info}/entry_points.txt +0 -0
@@ -1,13 +0,0 @@
1
- from ....client.credentials import CredentialsApi
2
-
3
-
4
- def test_default_site_id():
5
- creds = CredentialsApi( # noqa: S106
6
- server_url="url",
7
- user="test_user",
8
- password="test_pwd",
9
- token="token",
10
- token_name="token_name",
11
- site_id=None,
12
- )
13
- assert creds.to_dict()["site_id"] == ""
@@ -1,59 +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, "project_get.xml")
14
-
15
- EXPECTED = [
16
- {
17
- "id": "ee8c6e70-43b6-11e6-af4f-f7b0d8e20760",
18
- "name": "default",
19
- "description": "The default project that was automatically created by Tableau.",
20
- "parent_id": None,
21
- "folder_path": "/default",
22
- },
23
- {
24
- "id": "1d0304cd-3796-429f-b815-7258370b9b74",
25
- "name": "Tableau",
26
- "description": None,
27
- "parent_id": None,
28
- "folder_path": "/Tableau",
29
- },
30
- {
31
- "id": "4cc52973-5e3a-4d1f-a4fb-5b5f73796edf",
32
- "name": "Tableau/Child_1",
33
- "description": None,
34
- "parent_id": "1d0304cd-3796-429f-b815-7258370b9b74",
35
- "folder_path": "/Tableau/Tableau/Child_1",
36
- },
37
- ]
38
-
39
-
40
- class ProjectTests(unittest.TestCase):
41
- @mock.patch.dict(os.environ, KEYS)
42
- def setUp(self):
43
- self._client = ApiClient()
44
- self._client._server = TSC.Server("http://test")
45
-
46
- # Fake signin
47
- self._client._server._site_id = "dad65087-b08b-4603-af4e-2887b8aafc67"
48
- self._client._server._auth_token = "j80k54ll2lfMZ0tv97mlPvvSCRyD0DOM"
49
-
50
- self.baseurl = self._client._server.projects.baseurl
51
-
52
- def test_fetch_projects(self):
53
- with open(GET_XML, "rb") as f:
54
- response_xml = f.read().decode("utf-8")
55
- with requests_mock.mock() as m:
56
- m.get(self.baseurl, text=response_xml)
57
- results = self._client._fetch_projects()
58
-
59
- self.assertEqual(results, EXPECTED)
@@ -1,49 +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, "view_get_usage.xml")
14
-
15
- EXPECTED = [
16
- {
17
- "workbook_id": "3cc6cd06-89ce-4fdc-b935-5294135d6d42",
18
- "view_counts": 11,
19
- },
20
- {
21
- "workbook_id": "6d13b0ca-043d-4d42-8c9d-3f3313ea3a00",
22
- "view_counts": 13,
23
- },
24
- ]
25
-
26
-
27
- class UsageTests(unittest.TestCase):
28
- @mock.patch.dict(os.environ, KEYS)
29
- def setUp(self):
30
- self._client = ApiClient()
31
- self._client._server = TSC.Server("http://test_usage")
32
-
33
- # Fake signin
34
- self._client._server._site_id = "dad65087-b08b-4603-af4e-2887b8aafc67"
35
- self._client._server._auth_token = "j80k54ll2lfMZ0tv97mlPvvSCRyD0DOM"
36
-
37
- self.baseurl = self._client._server.views.baseurl
38
-
39
- def test_fetch_usages(self):
40
- with open(GET_XML, "rb") as f:
41
- response_xml = f.read().decode("utf-8")
42
- with requests_mock.mock() as m:
43
- m.get(
44
- self.baseurl + "?includeUsageStatistics=true",
45
- text=response_xml,
46
- )
47
- results = self._client._fetch_usages(False)
48
-
49
- self.assertEqual(results, EXPECTED)
@@ -1,52 +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, "user_get.xml")
14
-
15
- EXPECTED = [
16
- {
17
- "id": "dd2239f6-ddf1-4107-981a-4cf94e415794",
18
- "name": "alice",
19
- "email": "alicecook@test.com",
20
- "fullname": "alice cook",
21
- "site_role": "Publisher",
22
- },
23
- {
24
- "id": "2a47bbf8-8900-4ebb-b0a4-2723bd7c46c3",
25
- "name": "Bob",
26
- "email": "bob@test.com",
27
- "fullname": "Bob Smith",
28
- "site_role": "Interactor",
29
- },
30
- ]
31
-
32
-
33
- class UserTests(unittest.TestCase):
34
- @mock.patch.dict(os.environ, KEYS)
35
- def setUp(self):
36
- self._client = ApiClient()
37
- self._client._server = TSC.Server("http://test")
38
-
39
- # Fake signin
40
- self._client._server._site_id = "dad65087-b08b-4603-af4e-2887b8aafc67"
41
- self._client._server._auth_token = "j80k54ll2lfMZ0tv97mlPvvSCRyD0DOM"
42
-
43
- self.baseurl = self._client._server.users.baseurl
44
-
45
- def test_fetch_users(self):
46
- with open(GET_XML, "rb") as f:
47
- response_xml = f.read().decode("utf-8")
48
- with requests_mock.mock() as m:
49
- m.get(self.baseurl + "?fields=_all_", text=response_xml)
50
- results = self._client._fetch_users()
51
-
52
- self.assertEqual(results, EXPECTED)
@@ -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