dagster-census 0.14.21rc0__py3-none-any.whl → 0.28.10__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.
- dagster_census/__init__.py +8 -8
- dagster_census/components/__init__.py +0 -0
- dagster_census/components/census_component.py +219 -0
- dagster_census/components/census_scaffolder.py +26 -0
- dagster_census/ops.py +26 -19
- dagster_census/py.typed +0 -0
- dagster_census/resources.py +130 -105
- dagster_census/translator.py +57 -0
- dagster_census/types.py +10 -10
- dagster_census/utils.py +7 -6
- dagster_census/version.py +1 -1
- dagster_census-0.28.10.dist-info/METADATA +27 -0
- dagster_census-0.28.10.dist-info/RECORD +16 -0
- {dagster_census-0.14.21rc0.dist-info → dagster_census-0.28.10.dist-info}/WHEEL +1 -1
- dagster_census-0.28.10.dist-info/licenses/LICENSE +201 -0
- dagster_census-0.14.21rc0.dist-info/METADATA +0 -19
- dagster_census-0.14.21rc0.dist-info/RECORD +0 -10
- {dagster_census-0.14.21rc0.dist-info → dagster_census-0.28.10.dist-info}/top_level.txt +0 -0
dagster_census/__init__.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
from
|
|
1
|
+
from dagster_shared.libraries import DagsterLibraryRegistry
|
|
2
2
|
|
|
3
|
-
from .
|
|
4
|
-
from .
|
|
5
|
-
from .
|
|
6
|
-
from .
|
|
3
|
+
from dagster_census.components.census_component import CensusComponent as CensusComponent
|
|
4
|
+
from dagster_census.ops import census_trigger_sync_op
|
|
5
|
+
from dagster_census.resources import CensusResource
|
|
6
|
+
from dagster_census.types import CensusOutput
|
|
7
|
+
from dagster_census.version import __version__
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
DagsterLibraryRegistry.register("dagster-census", __version__)
|
|
9
10
|
|
|
10
11
|
__all__ = [
|
|
11
|
-
"CensusResource",
|
|
12
12
|
"CensusOutput",
|
|
13
|
-
"
|
|
13
|
+
"CensusResource",
|
|
14
14
|
"census_trigger_sync_op",
|
|
15
15
|
]
|
|
File without changes
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
from collections.abc import Callable, Iterable, Sequence
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Annotated, Optional, Union
|
|
5
|
+
|
|
6
|
+
import dagster as dg
|
|
7
|
+
import pydantic
|
|
8
|
+
from dagster._annotations import public
|
|
9
|
+
from dagster._core.definitions.metadata import TableMetadataSet
|
|
10
|
+
from dagster._utils.names import clean_name
|
|
11
|
+
from dagster.components.component.state_backed_component import StateBackedComponent
|
|
12
|
+
from dagster.components.resolved.base import resolve_fields
|
|
13
|
+
from dagster.components.utils.defs_state import (
|
|
14
|
+
DefsStateConfig,
|
|
15
|
+
DefsStateConfigArgs,
|
|
16
|
+
ResolvedDefsStateConfig,
|
|
17
|
+
)
|
|
18
|
+
from dagster_shared import check
|
|
19
|
+
from dagster_shared.serdes.serdes import deserialize_value
|
|
20
|
+
|
|
21
|
+
from dagster_census.components.census_scaffolder import CensusComponentScaffolder
|
|
22
|
+
from dagster_census.resources import CensusResource
|
|
23
|
+
from dagster_census.translator import (
|
|
24
|
+
CensusMetadataSet,
|
|
25
|
+
CensusSync,
|
|
26
|
+
CensusWorkspaceData,
|
|
27
|
+
generate_table_schema,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class CensusSyncSelectorByName(dg.Resolvable, dg.Model):
|
|
32
|
+
by_name: Annotated[
|
|
33
|
+
Sequence[str],
|
|
34
|
+
pydantic.Field(..., description="A list of sync names to include in the collection."),
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class CensusSyncSelectorById(dg.Resolvable, dg.Model):
|
|
39
|
+
by_id: Annotated[
|
|
40
|
+
Sequence[Union[int, str]], # Allow strings for use-cases like '{{ env.ENV_VAR }}'
|
|
41
|
+
pydantic.Field(..., description="A list of sync IDs to include in the collection."),
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def resolve_sync_selector(
|
|
46
|
+
context: dg.ResolutionContext, model
|
|
47
|
+
) -> Optional[Callable[[CensusSync], bool]]:
|
|
48
|
+
if isinstance(model, str):
|
|
49
|
+
resolved = context.resolve_value(model)
|
|
50
|
+
resolved = check.callable_param(resolved, "unknown") # pyright: ignore[reportArgumentType]
|
|
51
|
+
return resolved
|
|
52
|
+
if isinstance(model, CensusSyncSelectorByName.model()):
|
|
53
|
+
resolved = resolve_fields(model, CensusSyncSelectorByName.model(), context)
|
|
54
|
+
return lambda sync: sync.name in resolved["by_name"]
|
|
55
|
+
elif isinstance(model, CensusSyncSelectorById.model()):
|
|
56
|
+
resolved = resolve_fields(model, CensusSyncSelectorById.model(), context)
|
|
57
|
+
return lambda sync: sync.id in resolved["by_id"]
|
|
58
|
+
else:
|
|
59
|
+
check.failed(f"Unknown sync target type: {type(model)}")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass
|
|
63
|
+
class CensusResourceArgs(dg.Resolvable, dg.Model):
|
|
64
|
+
"""The fields are analogous to the fields at `CensusResource`."""
|
|
65
|
+
|
|
66
|
+
api_key: Annotated[str, pydantic.Field(...)]
|
|
67
|
+
request_max_retries: Annotated[int, pydantic.Field(None)]
|
|
68
|
+
request_retry_delay: Annotated[float, pydantic.Field(None)]
|
|
69
|
+
request_timeout: Annotated[int, pydantic.Field(None)]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def resolve_census_workspace(
|
|
73
|
+
context: dg.ResolutionContext, model: CensusResourceArgs
|
|
74
|
+
) -> CensusResource:
|
|
75
|
+
return CensusResource(**resolve_fields(model, CensusResourceArgs, context))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@public
|
|
79
|
+
@dataclass
|
|
80
|
+
@dg.scaffold_with(CensusComponentScaffolder)
|
|
81
|
+
class CensusComponent(StateBackedComponent, dg.Resolvable):
|
|
82
|
+
"""Loads Census syncs from a Census workspace as Dagster assets.
|
|
83
|
+
Materializing these assets will trigger the Census sync, enabling
|
|
84
|
+
you to schedule Census syncs using Dagster.
|
|
85
|
+
|
|
86
|
+
Example:
|
|
87
|
+
|
|
88
|
+
.. code-block:: yaml
|
|
89
|
+
|
|
90
|
+
# defs.yaml
|
|
91
|
+
|
|
92
|
+
type: dagster_census.CensusComponent
|
|
93
|
+
attributes:
|
|
94
|
+
workspace:
|
|
95
|
+
api_key: "{{ env.CENSUS_API_KEY }}"
|
|
96
|
+
sync_selector:
|
|
97
|
+
by_name:
|
|
98
|
+
- my_first_sync
|
|
99
|
+
- my_second_sync
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
workspace: Annotated[
|
|
103
|
+
CensusResource,
|
|
104
|
+
dg.Resolver(resolve_census_workspace, model_field_type=CensusResourceArgs),
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
sync_selector: Annotated[
|
|
108
|
+
Optional[Callable[[CensusSync], bool]],
|
|
109
|
+
dg.Resolver(
|
|
110
|
+
resolve_sync_selector,
|
|
111
|
+
model_field_type=Union[
|
|
112
|
+
str, CensusSyncSelectorByName.model(), CensusSyncSelectorById.model()
|
|
113
|
+
],
|
|
114
|
+
description="Function used to select Census syncs to pull into Dagster.",
|
|
115
|
+
),
|
|
116
|
+
] = None
|
|
117
|
+
|
|
118
|
+
defs_state: ResolvedDefsStateConfig = field(
|
|
119
|
+
default_factory=DefsStateConfigArgs.local_filesystem
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def defs_state_config(self) -> DefsStateConfig:
|
|
124
|
+
default_key = f"{self.__class__.__name__}"
|
|
125
|
+
return DefsStateConfig.from_args(self.defs_state, default_key=default_key)
|
|
126
|
+
|
|
127
|
+
def write_state_to_path(self, state_path: Path) -> None:
|
|
128
|
+
state = self.workspace.fetch_census_workspace_data()
|
|
129
|
+
state_path.write_text(dg.serialize_value(state))
|
|
130
|
+
|
|
131
|
+
@public
|
|
132
|
+
def get_asset_spec(self, sync: CensusSync) -> dg.AssetSpec:
|
|
133
|
+
metadata = {
|
|
134
|
+
**TableMetadataSet(
|
|
135
|
+
column_schema=generate_table_schema(sync.mappings),
|
|
136
|
+
table_name=sync.name,
|
|
137
|
+
),
|
|
138
|
+
**CensusMetadataSet(
|
|
139
|
+
sync_id=sync.id,
|
|
140
|
+
sync_name=sync.name,
|
|
141
|
+
source_id=sync.source_id,
|
|
142
|
+
destination_id=sync.destination_id,
|
|
143
|
+
),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return dg.AssetSpec(
|
|
147
|
+
key=dg.AssetKey(clean_name(sync.name)),
|
|
148
|
+
metadata=metadata,
|
|
149
|
+
description=f"Asset generated from Census sync {sync.id}",
|
|
150
|
+
kinds={"census"},
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
@public
|
|
154
|
+
def execute(
|
|
155
|
+
self, context: dg.AssetExecutionContext, census: CensusResource
|
|
156
|
+
) -> Iterable[Union[dg.AssetMaterialization, dg.MaterializeResult]]:
|
|
157
|
+
"""Executes a Census sync for the selected sync.
|
|
158
|
+
|
|
159
|
+
This method can be overridden in a subclass to customize the sync execution behavior,
|
|
160
|
+
such as adding custom logging or handling sync results differently.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
context: The asset execution context provided by Dagster
|
|
164
|
+
census: The CensusResource used to trigger and monitor syncs
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
MaterializeResult event from the Census sync
|
|
168
|
+
|
|
169
|
+
Example:
|
|
170
|
+
Override this method to add custom logging during sync execution:
|
|
171
|
+
|
|
172
|
+
.. code-block:: python
|
|
173
|
+
|
|
174
|
+
from dagster_census import CensusComponent
|
|
175
|
+
import dagster as dg
|
|
176
|
+
|
|
177
|
+
class CustomCensusComponent(CensusComponent):
|
|
178
|
+
def execute(self, context, census):
|
|
179
|
+
context.log.info(f"Starting Census sync for {context.asset_key}")
|
|
180
|
+
result = super().execute(context, census)
|
|
181
|
+
context.log.info("Census sync completed successfully")
|
|
182
|
+
return result
|
|
183
|
+
"""
|
|
184
|
+
# Select the first asset-spec (since there is only one)
|
|
185
|
+
spec = next(iter(context.assets_def.specs))
|
|
186
|
+
|
|
187
|
+
census_metadataset = CensusMetadataSet.extract(spec.metadata)
|
|
188
|
+
census.trigger_sync_and_poll(sync_id=census_metadataset.sync_id)
|
|
189
|
+
yield dg.AssetMaterialization(asset_key=clean_name(census_metadataset.sync_name))
|
|
190
|
+
|
|
191
|
+
def _load_asset_specs(self, state: CensusWorkspaceData) -> Sequence[dg.AssetSpec]:
|
|
192
|
+
connection_selector_fn = self.sync_selector or (lambda sync: True)
|
|
193
|
+
return [self.get_asset_spec(sync) for sync in state.syncs if connection_selector_fn(sync)]
|
|
194
|
+
|
|
195
|
+
def _get_census_assets_def(self, sync_name: str, spec: dg.AssetSpec) -> dg.AssetsDefinition:
|
|
196
|
+
@dg.multi_asset(
|
|
197
|
+
name=f"census_{clean_name(sync_name)}",
|
|
198
|
+
can_subset=True,
|
|
199
|
+
specs=[spec],
|
|
200
|
+
)
|
|
201
|
+
def _asset(context: dg.AssetExecutionContext):
|
|
202
|
+
yield from self.execute(context, self.workspace)
|
|
203
|
+
|
|
204
|
+
return _asset
|
|
205
|
+
|
|
206
|
+
def build_defs_from_state(
|
|
207
|
+
self, context: dg.ComponentLoadContext, state_path: Optional[Path]
|
|
208
|
+
) -> dg.Definitions:
|
|
209
|
+
if state_path is None:
|
|
210
|
+
return dg.Definitions()
|
|
211
|
+
|
|
212
|
+
state = deserialize_value(state_path.read_text(), CensusWorkspaceData)
|
|
213
|
+
|
|
214
|
+
assets = [
|
|
215
|
+
self._get_census_assets_def(CensusMetadataSet.extract(spec.metadata).sync_name, spec)
|
|
216
|
+
for spec in self._load_asset_specs(state)
|
|
217
|
+
]
|
|
218
|
+
|
|
219
|
+
return dg.Definitions(assets=assets)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from dagster.components.component.component_scaffolder import Scaffolder
|
|
4
|
+
from dagster.components.component_scaffolding import scaffold_component
|
|
5
|
+
from dagster.components.scaffold.scaffold import ScaffoldRequest
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CensusScaffolderParams(BaseModel):
|
|
10
|
+
api_key: Optional[str] = None
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CensusComponentScaffolder(Scaffolder[CensusScaffolderParams]):
|
|
14
|
+
@classmethod
|
|
15
|
+
def get_scaffold_params(cls) -> type[CensusScaffolderParams]:
|
|
16
|
+
return CensusScaffolderParams
|
|
17
|
+
|
|
18
|
+
def scaffold(self, request: ScaffoldRequest[CensusScaffolderParams]) -> None:
|
|
19
|
+
scaffold_component(
|
|
20
|
+
request,
|
|
21
|
+
{
|
|
22
|
+
"workspace": {
|
|
23
|
+
"api_key": "{{ env.CENSUS_API_KEY }}",
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
)
|
dagster_census/ops.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
from dagster import Array, Bool, Field, In, Noneable, Nothing, Out, Output, op
|
|
2
|
+
from dagster._core.storage.tags import COMPUTE_KIND_TAG
|
|
2
3
|
|
|
3
|
-
from .resources import DEFAULT_POLL_INTERVAL
|
|
4
|
-
from .types import CensusOutput
|
|
5
|
-
from .utils import generate_materialization
|
|
4
|
+
from dagster_census.resources import DEFAULT_POLL_INTERVAL
|
|
5
|
+
from dagster_census.types import CensusOutput
|
|
6
|
+
from dagster_census.utils import generate_materialization
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
@op(
|
|
@@ -10,31 +11,37 @@ from .utils import generate_materialization
|
|
|
10
11
|
ins={"start_after": In(Nothing)},
|
|
11
12
|
out=Out(
|
|
12
13
|
CensusOutput,
|
|
13
|
-
description=
|
|
14
|
-
|
|
14
|
+
description=(
|
|
15
|
+
"Parsed json dictionary representing the details of the Census sync after "
|
|
16
|
+
"the sync successfully completes."
|
|
17
|
+
),
|
|
15
18
|
),
|
|
16
19
|
config_schema={
|
|
17
20
|
"sync_id": Field(
|
|
18
21
|
int,
|
|
19
22
|
is_required=True,
|
|
20
|
-
description="
|
|
23
|
+
description="Id of the parent sync.",
|
|
21
24
|
),
|
|
22
25
|
"force_full_sync": Field(
|
|
23
26
|
config=Bool,
|
|
24
27
|
default_value=False,
|
|
25
|
-
description=
|
|
26
|
-
|
|
28
|
+
description=(
|
|
29
|
+
"If this trigger request should be a Full Sync. "
|
|
30
|
+
"Note that some sync configurations such as Append do not support full syncs."
|
|
31
|
+
),
|
|
27
32
|
),
|
|
28
33
|
"poll_interval": Field(
|
|
29
34
|
float,
|
|
30
35
|
default_value=DEFAULT_POLL_INTERVAL,
|
|
31
|
-
description="The time (in seconds)
|
|
36
|
+
description="The time (in seconds) to wait between successive polls.",
|
|
32
37
|
),
|
|
33
38
|
"poll_timeout": Field(
|
|
34
39
|
Noneable(float),
|
|
35
40
|
default_value=None,
|
|
36
|
-
description=
|
|
37
|
-
|
|
41
|
+
description=(
|
|
42
|
+
"The maximum time to wait before this operation is timed out. By "
|
|
43
|
+
"default, this will never time out."
|
|
44
|
+
),
|
|
38
45
|
),
|
|
39
46
|
"yield_materializations": Field(
|
|
40
47
|
config=Bool,
|
|
@@ -53,19 +60,19 @@ from .utils import generate_materialization
|
|
|
53
60
|
),
|
|
54
61
|
),
|
|
55
62
|
},
|
|
56
|
-
tags={
|
|
63
|
+
tags={COMPUTE_KIND_TAG: "census"},
|
|
57
64
|
)
|
|
58
65
|
def census_trigger_sync_op(context):
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
"""Executes a Census sync for a given ``sync_id`` and polls until that sync completes, raising
|
|
67
|
+
an error if it is unsuccessful.
|
|
68
|
+
|
|
69
|
+
It outputs a :py:class:`~dagster_census.CensusOutput` which contains the details of the Census
|
|
70
|
+
sync after it successfully completes.
|
|
64
71
|
|
|
65
72
|
It requires the use of the :py:class:`~dagster_census.census_resource`, which allows it to
|
|
66
|
-
communicate with the
|
|
73
|
+
communicate with the Census API.
|
|
67
74
|
|
|
68
|
-
Examples
|
|
75
|
+
**Examples:**
|
|
69
76
|
|
|
70
77
|
.. code-block:: python
|
|
71
78
|
|
dagster_census/py.typed
ADDED
|
File without changes
|
dagster_census/resources.py
CHANGED
|
@@ -2,54 +2,91 @@ import datetime
|
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
4
|
import time
|
|
5
|
-
from
|
|
5
|
+
from collections.abc import Mapping
|
|
6
|
+
from typing import Any, Optional
|
|
6
7
|
|
|
8
|
+
import pydantic
|
|
7
9
|
import requests
|
|
10
|
+
from dagster import ConfigurableResource, Failure, __version__, get_dagster_logger
|
|
11
|
+
from dagster_shared.utils.cached_method import cached_method
|
|
8
12
|
from requests.auth import HTTPBasicAuth
|
|
9
13
|
from requests.exceptions import RequestException
|
|
10
14
|
|
|
11
|
-
from
|
|
12
|
-
|
|
13
|
-
from .types import CensusOutput
|
|
15
|
+
from dagster_census.translator import CensusSync, CensusWorkspaceData
|
|
16
|
+
from dagster_census.types import CensusOutput
|
|
14
17
|
|
|
15
18
|
CENSUS_API_BASE = "app.getcensus.com/api"
|
|
16
19
|
CENSUS_VERSION = "v1"
|
|
17
20
|
|
|
18
21
|
DEFAULT_POLL_INTERVAL = 10
|
|
19
22
|
|
|
23
|
+
SYNC_RUN_STATUSES = {"completed", "failed", "queued", "skipped", "working"}
|
|
20
24
|
|
|
21
|
-
class CensusResource:
|
|
22
|
-
"""
|
|
23
|
-
This class exposes methods on top of the Census REST API.
|
|
24
|
-
"""
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
):
|
|
33
|
-
self.api_key = api_key
|
|
26
|
+
class CensusResource(ConfigurableResource):
|
|
27
|
+
"""This resource allows users to programatically interface with the Census REST API to launch
|
|
28
|
+
syncs and monitor their progress. This currently implements only a subset of the functionality
|
|
29
|
+
exposed by the API.
|
|
30
|
+
|
|
31
|
+
**Examples:**
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
self._request_retry_delay = request_retry_delay
|
|
33
|
+
.. code-block:: python
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
import dagster as dg
|
|
36
|
+
from dagster_census import CensusResource
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
census_resource = CensusResource(
|
|
39
|
+
api_key=dg.EnvVar("CENSUS_API_KEY")
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
@dg.asset
|
|
43
|
+
def census_sync_asset(census: CensusResource):
|
|
44
|
+
census.trigger_sync_and_poll(sync_id=123456)
|
|
45
|
+
|
|
46
|
+
defs = dg.Definitions(
|
|
47
|
+
assets=[census_sync_asset],
|
|
48
|
+
resources={"census": census_resource}
|
|
49
|
+
)
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
api_key: str = pydantic.Field(..., description="The Census API key")
|
|
53
|
+
request_max_retries: int = pydantic.Field(
|
|
54
|
+
default=3,
|
|
55
|
+
description=(
|
|
56
|
+
"The maximum number of times requests to the Census API should be retried "
|
|
57
|
+
"before failing."
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
request_retry_delay: float = pydantic.Field(
|
|
61
|
+
default=0.25,
|
|
62
|
+
description="Time (in seconds) to wait between each request retry.",
|
|
63
|
+
)
|
|
64
|
+
request_timeout: int = pydantic.Field(
|
|
65
|
+
default=15,
|
|
66
|
+
description="Time (in seconds) after which the requests to Census are declared timed out.",
|
|
67
|
+
)
|
|
45
68
|
|
|
46
69
|
@property
|
|
47
70
|
def api_base_url(self) -> str:
|
|
48
71
|
return f"https://{CENSUS_API_BASE}/{CENSUS_VERSION}"
|
|
49
72
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
73
|
+
@classmethod
|
|
74
|
+
def _is_dagster_maintained(cls) -> bool:
|
|
75
|
+
return True
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
@cached_method
|
|
79
|
+
def _log(self) -> logging.Logger:
|
|
80
|
+
return get_dagster_logger()
|
|
81
|
+
|
|
82
|
+
def make_request(
|
|
83
|
+
self,
|
|
84
|
+
method: str,
|
|
85
|
+
endpoint: str,
|
|
86
|
+
data: Optional[str] = None,
|
|
87
|
+
page_number: Optional[int] = None,
|
|
88
|
+
) -> Mapping[str, Any]:
|
|
89
|
+
"""Creates and sends a request to the desired Census API endpoint.
|
|
53
90
|
|
|
54
91
|
Args:
|
|
55
92
|
method (str): The http method to use for this request (e.g. "POST", "GET", "PATCH").
|
|
@@ -59,35 +96,41 @@ class CensusResource:
|
|
|
59
96
|
Returns:
|
|
60
97
|
Dict[str, Any]: JSON data from the response to this request
|
|
61
98
|
"""
|
|
99
|
+
url = f"{self.api_base_url}/{endpoint}"
|
|
62
100
|
headers = {
|
|
63
101
|
"User-Agent": f"dagster-census/{__version__}",
|
|
64
102
|
"Content-Type": "application/json;version=2",
|
|
65
103
|
}
|
|
66
104
|
|
|
105
|
+
if page_number is not None:
|
|
106
|
+
params = {"page": page_number}
|
|
107
|
+
else:
|
|
108
|
+
params = {}
|
|
109
|
+
|
|
67
110
|
num_retries = 0
|
|
68
111
|
while True:
|
|
69
112
|
try:
|
|
70
113
|
response = requests.request(
|
|
71
114
|
method=method,
|
|
72
|
-
url=
|
|
115
|
+
url=url,
|
|
73
116
|
headers=headers,
|
|
74
|
-
auth=HTTPBasicAuth("bearer", self.
|
|
117
|
+
auth=HTTPBasicAuth("bearer", self.api_key),
|
|
75
118
|
data=data,
|
|
119
|
+
params=params,
|
|
76
120
|
)
|
|
77
121
|
response.raise_for_status()
|
|
78
122
|
return response.json()
|
|
79
123
|
except RequestException as e:
|
|
80
124
|
self._log.error("Request to Census API failed: %s", e)
|
|
81
|
-
if num_retries == self.
|
|
125
|
+
if num_retries == self.request_max_retries:
|
|
82
126
|
break
|
|
83
127
|
num_retries += 1
|
|
84
|
-
time.sleep(self.
|
|
128
|
+
time.sleep(self.request_retry_delay)
|
|
85
129
|
|
|
86
|
-
raise Failure("
|
|
130
|
+
raise Failure(f"Max retries ({self.request_max_retries}) exceeded with url: {url}.")
|
|
87
131
|
|
|
88
|
-
def get_sync(self, sync_id: int) ->
|
|
89
|
-
"""
|
|
90
|
-
Gets details about a given sync from the Census API.
|
|
132
|
+
def get_sync(self, sync_id: int) -> Mapping[str, Any]:
|
|
133
|
+
"""Gets details about a given sync from the Census API.
|
|
91
134
|
|
|
92
135
|
Args:
|
|
93
136
|
sync_id (int): The Census Sync ID.
|
|
@@ -97,9 +140,8 @@ class CensusResource:
|
|
|
97
140
|
"""
|
|
98
141
|
return self.make_request(method="GET", endpoint=f"syncs/{sync_id}")
|
|
99
142
|
|
|
100
|
-
def get_source(self, source_id: int) ->
|
|
101
|
-
"""
|
|
102
|
-
Gets details about a given source from the Census API.
|
|
143
|
+
def get_source(self, source_id: int) -> Mapping[str, Any]:
|
|
144
|
+
"""Gets details about a given source from the Census API.
|
|
103
145
|
|
|
104
146
|
Args:
|
|
105
147
|
source_id (int): The Census Source ID.
|
|
@@ -109,9 +151,8 @@ class CensusResource:
|
|
|
109
151
|
"""
|
|
110
152
|
return self.make_request(method="GET", endpoint=f"sources/{source_id}")
|
|
111
153
|
|
|
112
|
-
def get_destination(self, destination_id: int) ->
|
|
113
|
-
"""
|
|
114
|
-
Gets details about a given destination from the Census API.
|
|
154
|
+
def get_destination(self, destination_id: int) -> Mapping[str, Any]:
|
|
155
|
+
"""Gets details about a given destination from the Census API.
|
|
115
156
|
|
|
116
157
|
Args:
|
|
117
158
|
destination_id (int): The Census Destination ID.
|
|
@@ -121,9 +162,8 @@ class CensusResource:
|
|
|
121
162
|
"""
|
|
122
163
|
return self.make_request(method="GET", endpoint=f"destinations/{destination_id}")
|
|
123
164
|
|
|
124
|
-
def get_sync_run(self, sync_run_id: int) ->
|
|
125
|
-
"""
|
|
126
|
-
Gets details about a specific sync run from the Census API.
|
|
165
|
+
def get_sync_run(self, sync_run_id: int) -> Mapping[str, Any]:
|
|
166
|
+
"""Gets details about a specific sync run from the Census API.
|
|
127
167
|
|
|
128
168
|
Args:
|
|
129
169
|
sync_run_id (int): The Census Sync Run ID.
|
|
@@ -138,9 +178,8 @@ class CensusResource:
|
|
|
138
178
|
sync_run_id: int,
|
|
139
179
|
poll_interval: float = DEFAULT_POLL_INTERVAL,
|
|
140
180
|
poll_timeout: Optional[float] = None,
|
|
141
|
-
) ->
|
|
142
|
-
"""
|
|
143
|
-
Given a Census sync run, poll until the run is complete
|
|
181
|
+
) -> Mapping[str, Any]:
|
|
182
|
+
"""Given a Census sync run, poll until the run is complete.
|
|
144
183
|
|
|
145
184
|
Args:
|
|
146
185
|
sync_id (int): The Census Sync Run ID.
|
|
@@ -159,12 +198,22 @@ class CensusResource:
|
|
|
159
198
|
response_dict = self.get_sync_run(sync_run_id)
|
|
160
199
|
if "data" not in response_dict.keys():
|
|
161
200
|
raise ValueError(
|
|
162
|
-
f"Getting status of sync failed, please visit Census Logs at {log_url} to see
|
|
201
|
+
f"Getting status of sync failed, please visit Census Logs at {log_url} to see"
|
|
202
|
+
" more."
|
|
163
203
|
)
|
|
164
204
|
|
|
205
|
+
sync_status = response_dict["data"]["status"]
|
|
165
206
|
sync_id = response_dict["data"]["sync_id"]
|
|
166
207
|
|
|
167
|
-
if
|
|
208
|
+
if sync_status not in SYNC_RUN_STATUSES:
|
|
209
|
+
raise ValueError(
|
|
210
|
+
f"Unexpected response status '{sync_status}'; "
|
|
211
|
+
f"must be one of {','.join(sorted(SYNC_RUN_STATUSES))}. "
|
|
212
|
+
"See Management API docs for more information: "
|
|
213
|
+
"https://docs.getcensus.com/basics/developers/api/sync-runs"
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
if sync_status in {"queued", "working"}:
|
|
168
217
|
self._log.debug(
|
|
169
218
|
f"Sync {sync_id} still running after {datetime.datetime.now() - poll_start}."
|
|
170
219
|
)
|
|
@@ -174,7 +223,8 @@ class CensusResource:
|
|
|
174
223
|
seconds=poll_timeout
|
|
175
224
|
):
|
|
176
225
|
raise Failure(
|
|
177
|
-
f"Sync for sync '{sync_id}' timed out after
|
|
226
|
+
f"Sync for sync '{sync_id}' timed out after"
|
|
227
|
+
f" {datetime.datetime.now() - poll_start}."
|
|
178
228
|
)
|
|
179
229
|
|
|
180
230
|
break
|
|
@@ -186,9 +236,8 @@ class CensusResource:
|
|
|
186
236
|
|
|
187
237
|
return response_dict
|
|
188
238
|
|
|
189
|
-
def trigger_sync(self, sync_id: int, force_full_sync: bool = False) ->
|
|
190
|
-
"""
|
|
191
|
-
Trigger an asynchronous run for a specific sync.
|
|
239
|
+
def trigger_sync(self, sync_id: int, force_full_sync: bool = False) -> Mapping[str, Any]:
|
|
240
|
+
"""Trigger an asynchronous run for a specific sync.
|
|
192
241
|
|
|
193
242
|
Args:
|
|
194
243
|
sync_id (int): The Census Sync Run ID.
|
|
@@ -209,8 +258,7 @@ class CensusResource:
|
|
|
209
258
|
poll_interval: float = DEFAULT_POLL_INTERVAL,
|
|
210
259
|
poll_timeout: Optional[float] = None,
|
|
211
260
|
) -> CensusOutput:
|
|
212
|
-
"""
|
|
213
|
-
Trigger a run for a specific sync and poll until it has completed
|
|
261
|
+
"""Trigger a run for a specific sync and poll until it has completed.
|
|
214
262
|
|
|
215
263
|
Args:
|
|
216
264
|
sync_id (int): The Census Sync Run ID.
|
|
@@ -243,55 +291,32 @@ class CensusResource:
|
|
|
243
291
|
destination=destination_details,
|
|
244
292
|
)
|
|
245
293
|
|
|
294
|
+
@cached_method
|
|
295
|
+
def fetch_census_workspace_data(self) -> CensusWorkspaceData:
|
|
296
|
+
"""Retrieves all Census syncs from the workspace and returns it as a CensusWorkspaceData object.
|
|
246
297
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
"
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
"
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
syncs and monitor their progress. This currently implements only a subset of the functionality
|
|
272
|
-
exposed by the API.
|
|
273
|
-
|
|
274
|
-
**Examples:**
|
|
275
|
-
|
|
276
|
-
.. code-block:: python
|
|
277
|
-
|
|
278
|
-
from dagster import job
|
|
279
|
-
from dagster_census import census_resource
|
|
280
|
-
|
|
281
|
-
my_census_resource = census_resource.configured(
|
|
282
|
-
{
|
|
283
|
-
"api_key": {"env": "CENSUS_API_KEY"},
|
|
284
|
-
}
|
|
298
|
+
Returns:
|
|
299
|
+
CensusWorkspaceData: A snapshot of the Census workspace's syncs.
|
|
300
|
+
"""
|
|
301
|
+
all_syncs = []
|
|
302
|
+
page = self.make_request(method="GET", endpoint="syncs")
|
|
303
|
+
|
|
304
|
+
last_page_number = page["pagination"]["last_page"]
|
|
305
|
+
for sync in page["data"]:
|
|
306
|
+
all_syncs.append(self._census_sync_struct_from_json(sync))
|
|
307
|
+
|
|
308
|
+
for i in range(2, last_page_number + 1):
|
|
309
|
+
page = self.make_request(method="GET", endpoint="syncs", page_number=i)
|
|
310
|
+
for sync in page["data"]:
|
|
311
|
+
all_syncs.append(self._census_sync_struct_from_json(sync))
|
|
312
|
+
|
|
313
|
+
return CensusWorkspaceData(syncs=all_syncs)
|
|
314
|
+
|
|
315
|
+
def _census_sync_struct_from_json(self, sync: dict[str, Any]) -> CensusSync:
|
|
316
|
+
return CensusSync(
|
|
317
|
+
id=sync["id"],
|
|
318
|
+
name=sync["label"] or sync["resource_identifier"],
|
|
319
|
+
source_id=sync["source_attributes"]["connection_id"],
|
|
320
|
+
destination_id=sync["destination_attributes"]["connection_id"],
|
|
321
|
+
mappings=sync["mappings"],
|
|
285
322
|
)
|
|
286
|
-
|
|
287
|
-
@job(resource_defs={"census":my_census_resource})
|
|
288
|
-
def my_census_job():
|
|
289
|
-
...
|
|
290
|
-
|
|
291
|
-
"""
|
|
292
|
-
return CensusResource(
|
|
293
|
-
api_key=context.resource_config["api_key"],
|
|
294
|
-
request_max_retries=context.resource_config["request_max_retries"],
|
|
295
|
-
request_retry_delay=context.resource_config["request_retry_delay"],
|
|
296
|
-
log=context.log,
|
|
297
|
-
)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import dagster as dg
|
|
5
|
+
from dagster._core.definitions.metadata.metadata_set import NamespacedMetadataSet
|
|
6
|
+
from dagster._record import record
|
|
7
|
+
from dagster_shared.serdes import whitelist_for_serdes
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@whitelist_for_serdes
|
|
11
|
+
@record
|
|
12
|
+
class CensusSync:
|
|
13
|
+
"""Represents a Census sync, based on data as returned from the API."""
|
|
14
|
+
|
|
15
|
+
id: int
|
|
16
|
+
name: str
|
|
17
|
+
source_id: int
|
|
18
|
+
destination_id: int
|
|
19
|
+
mappings: list[dict[str, Any]]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@whitelist_for_serdes
|
|
23
|
+
@record
|
|
24
|
+
class CensusWorkspaceData:
|
|
25
|
+
"""A record representing all content in a Census workspace.
|
|
26
|
+
Provided as context for the translator so that it can resolve dependencies between content.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
syncs: list[CensusSync]
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def syncs_by_id(self) -> Mapping[int, CensusSync]:
|
|
33
|
+
"""Returns a mapping of sync IDs to CensusSync objects."""
|
|
34
|
+
return {sync.id: sync for sync in self.syncs}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def generate_table_schema(sync_mappings_props: list[dict[str, Any]]) -> dg.TableSchema:
|
|
38
|
+
return dg.TableSchema(
|
|
39
|
+
columns=sorted(
|
|
40
|
+
[
|
|
41
|
+
dg.TableColumn(name=mapping["to"], type=mapping.get("field_type", "unknown"))
|
|
42
|
+
for mapping in sync_mappings_props
|
|
43
|
+
],
|
|
44
|
+
key=lambda col: col.name,
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class CensusMetadataSet(NamespacedMetadataSet):
|
|
50
|
+
sync_id: int
|
|
51
|
+
sync_name: str
|
|
52
|
+
source_id: int
|
|
53
|
+
destination_id: int
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def namespace(cls) -> str:
|
|
57
|
+
return "dagster-census"
|
dagster_census/types.py
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, NamedTuple
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
class CensusOutput(
|
|
5
6
|
NamedTuple(
|
|
6
7
|
"_CensusOutput",
|
|
7
8
|
[
|
|
8
|
-
("sync_run",
|
|
9
|
-
("source",
|
|
10
|
-
("destination",
|
|
9
|
+
("sync_run", Mapping[str, Any]),
|
|
10
|
+
("source", Mapping[str, Any]),
|
|
11
|
+
("destination", Mapping[str, Any]),
|
|
11
12
|
],
|
|
12
13
|
)
|
|
13
14
|
):
|
|
14
|
-
"""
|
|
15
|
-
Contains recorded information about the state of a Census sync after a sync completes.
|
|
15
|
+
"""Contains recorded information about the state of a Census sync after a sync completes.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Args:
|
|
18
18
|
sync_run (Dict[str, Any]):
|
|
19
|
-
The details of the specific sync run
|
|
19
|
+
The details of the specific sync run.
|
|
20
20
|
source (Dict[str, Any]):
|
|
21
|
-
Information about the source for the Census sync
|
|
21
|
+
Information about the source for the Census sync.
|
|
22
22
|
destination (Dict[str, Any]):
|
|
23
|
-
Information about the destination for the Census sync
|
|
23
|
+
Information about the destination for the Census sync.
|
|
24
24
|
"""
|
dagster_census/utils.py
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections.abc import Sequence
|
|
2
2
|
|
|
3
3
|
from dagster import AssetMaterialization
|
|
4
4
|
|
|
5
|
-
from .types import CensusOutput
|
|
5
|
+
from dagster_census.types import CensusOutput
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def generate_materialization(
|
|
9
|
-
census_output: CensusOutput, asset_key_prefix:
|
|
9
|
+
census_output: CensusOutput, asset_key_prefix: Sequence[str]
|
|
10
10
|
) -> AssetMaterialization:
|
|
11
|
-
|
|
12
11
|
sync_id = census_output.sync_run["sync_id"]
|
|
13
12
|
source_name = census_output.source["name"]
|
|
14
13
|
destination_name = census_output.destination["name"]
|
|
@@ -27,10 +26,12 @@ def generate_materialization(
|
|
|
27
26
|
"full_sync": census_output.sync_run["full_sync"],
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
asset_key_name = asset_key_prefix
|
|
29
|
+
asset_key_name = [*asset_key_prefix, f"sync_{sync_id}"]
|
|
31
30
|
|
|
32
31
|
return AssetMaterialization(
|
|
33
32
|
asset_key=asset_key_name,
|
|
34
|
-
description=
|
|
33
|
+
description=(
|
|
34
|
+
f"Sync generated for Census sync {sync_id}: {source_name} to {destination_name}"
|
|
35
|
+
),
|
|
35
36
|
metadata=metadata,
|
|
36
37
|
)
|
dagster_census/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.28.10"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dagster-census
|
|
3
|
+
Version: 0.28.10
|
|
4
|
+
Summary: Package for integrating Census with Dagster.
|
|
5
|
+
Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-census
|
|
6
|
+
Author: Dagster Labs
|
|
7
|
+
Author-email: hello@dagsterlabs.com
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Requires-Python: >=3.10,<3.15
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: dagster==1.12.10
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: home-page
|
|
23
|
+
Dynamic: license
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
dagster_census/__init__.py,sha256=eIDWjz13trVGLVMDjAdq0LeUkbEiWex1ho2NX8cDFOY,501
|
|
2
|
+
dagster_census/ops.py,sha256=4N53-w0u3PG5kn-q1tW-7Ac-i5SCDFq9ku--g7gDig4,3659
|
|
3
|
+
dagster_census/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
dagster_census/resources.py,sha256=R-McSQLQTOImDVAQ3Tr-ZbvbUMQnbKpW7hkvtuwtS7I,11661
|
|
5
|
+
dagster_census/translator.py,sha256=caSshQ3ZfSsl_ASNlN6p24t-15WDRN29Z1xBg7Utbp4,1510
|
|
6
|
+
dagster_census/types.py,sha256=on1CIKWZMsSuw5h-HkzQPVctMQzQu2L9HgkX5gc9X54,698
|
|
7
|
+
dagster_census/utils.py,sha256=fFsKjn6xlLEel1-nvAwfAaemjSTg2gYxJHY8sK2e1no,1348
|
|
8
|
+
dagster_census/version.py,sha256=110BPTEyn13PDWnHpj0D7VMBpjnNxJ6-MM3ZHvQwyQ0,24
|
|
9
|
+
dagster_census/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
dagster_census/components/census_component.py,sha256=vgaVfT0pFVoC8ddhJJQEGJwjfZGsjLiTlXDOeNYW4q0,7970
|
|
11
|
+
dagster_census/components/census_scaffolder.py,sha256=n0YT0Rov6yJsPHAVpbtUrkxxF59z0WLCnRhYEpYtF4A,818
|
|
12
|
+
dagster_census-0.28.10.dist-info/licenses/LICENSE,sha256=4lsMW-RCvfVD4_F57wrmpe3vX1xwUk_OAKKmV_XT7Z0,11348
|
|
13
|
+
dagster_census-0.28.10.dist-info/METADATA,sha256=c2aYCvD4kTlMACHTjkTvgz9klKUJ0mIcPAQ80JGpAho,922
|
|
14
|
+
dagster_census-0.28.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
dagster_census-0.28.10.dist-info/top_level.txt,sha256=Lz6T6gBn89ilLGOLr8YIrBTRcWPCjeOtdNk8sdqmUnA,15
|
|
16
|
+
dagster_census-0.28.10.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Dagster Labs, Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: dagster-census
|
|
3
|
-
Version: 0.14.21rc0
|
|
4
|
-
Summary: Package for integrating Census with Dagster.
|
|
5
|
-
Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-census
|
|
6
|
-
Author: Elementl
|
|
7
|
-
Author-email: hello@elementl.com
|
|
8
|
-
License: Apache-2.0
|
|
9
|
-
Platform: UNKNOWN
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Requires-Dist: dagster (==0.14.21rc0)
|
|
17
|
-
|
|
18
|
-
UNKNOWN
|
|
19
|
-
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
dagster_census/__init__.py,sha256=10sSerK0e8Fu0Qyj_h4NgNKLuBtfl4GRF9jfNJ19X20,394
|
|
2
|
-
dagster_census/ops.py,sha256=qhstHKuMOC4McS1R8lWXZEUbBojbb29ZDHOqiLSTf1o,3507
|
|
3
|
-
dagster_census/resources.py,sha256=BFoKEGuvFyDSqzp37uIh-ITOPDIRkqvwUxlVUxNIGYs,10046
|
|
4
|
-
dagster_census/types.py,sha256=OrhzeBYHLv8K7zvXb_LgeD46UYEjNizWZxWvUV2dh_I,667
|
|
5
|
-
dagster_census/utils.py,sha256=cG7mA4JspbNbsOw681WnexZmcRkvo56vwXF1_MJfUIM,1294
|
|
6
|
-
dagster_census/version.py,sha256=ysovRfcGlcNUPhgQ2ub-CVWFIVbCbkN8tZMyhUkCct0,27
|
|
7
|
-
dagster_census-0.14.21rc0.dist-info/METADATA,sha256=skhOGZ2WdhQF27lB1TbqJXpNhc-sKrXwd-RbYMbJYiQ,664
|
|
8
|
-
dagster_census-0.14.21rc0.dist-info/WHEEL,sha256=p46_5Uhzqz6AzeSosiOnxK-zmFja1i22CrQCjmYe8ec,92
|
|
9
|
-
dagster_census-0.14.21rc0.dist-info/top_level.txt,sha256=Lz6T6gBn89ilLGOLr8YIrBTRcWPCjeOtdNk8sdqmUnA,15
|
|
10
|
-
dagster_census-0.14.21rc0.dist-info/RECORD,,
|
|
File without changes
|