:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
from typing import cast
from products.warehouse_sources.sources.getdx._config import GetdxSourceConfig
from products.warehouse_sources.sources.getdx.canonical_descriptions import CANONICAL_DESCRIPTIONS
from products.warehouse_sources.sources.getdx.getdx import (
API_ERROR,
AUTH_ERROR,
PERMISSION_ERROR,
GetdxResumeConfig,
getdx_source,
validate_credentials,
)
from products.warehouse_sources.sources.getdx.settings import ENDPOINTS
from products.warehouse_sources.sources.sdk import (
CanonicalDescriptions,
DataWarehouseSourceCategory,
ExternalDataSourceType,
FieldType,
ReleaseStatus,
ResumableSource,
ResumableSourceManager,
SourceConfig,
SourceFieldInputConfig,
SourceFieldInputConfigType,
SourceInputs,
SourceRegistry,
SourceResponse,
SourceSchema,
detect,
)
@SourceRegistry.register
class GetdxSource(ResumableSource[GetdxSourceConfig, GetdxResumeConfig]):
codebase_detection = detect(env=("^GETDX_",))
lists_tables_without_credentials = True
api_docs_url = "https://docs.getdx.com/webapi/overview/"
@property
def source_type(self) -> ExternalDataSourceType:
return ExternalDataSourceType.GETDX
@property
def get_source_config(self) -> SourceConfig:
return SourceConfig(
name=ExternalDataSourceType.GETDX,
category=DataWarehouseSourceCategory.ENGINEERING___MONITORING,
label="DX (getdx.com)",
iconPath="/static/services/getdx.png",
caption="Create a token in DX under Admin > Organization tokens. "
"Enable snapshots:read and users:read for their tables. "
"Scorecards need scorecards:read and DX Fabric.",
fields=cast(
list[FieldType],
[
SourceFieldInputConfig(
name="api_key",
label="Organization token",
type=SourceFieldInputConfigType.PASSWORD,
placeholder="",
required=True,
secret=True,
)
],
),
releaseStatus=ReleaseStatus.BETA,
)
def get_non_retryable_errors(self) -> dict[str, str | None]:
return {
AUTH_ERROR: AUTH_ERROR,
PERMISSION_ERROR: PERMISSION_ERROR,
API_ERROR: API_ERROR,
"401 Client Error": AUTH_ERROR,
"403 Client Error": PERMISSION_ERROR,
}
def get_canonical_descriptions(self) -> CanonicalDescriptions:
return CANONICAL_DESCRIPTIONS
def get_schemas(
self,
config: GetdxSourceConfig,
team_id: int,
with_counts: bool = False,
names: list[str] | None = None,
force_refresh: bool = False,
api_version: str | None = None,
) -> list[SourceSchema]:
return [
SourceSchema(name=name, supports_incremental=False, supports_append=False)
for name in ENDPOINTS
if names is None or name in names
]
def validate_credentials(
self,
config: GetdxSourceConfig,
team_id: int,
schema_name: str | None = None,
api_version: str | None = None,
) -> tuple[bool, str | None]:
return validate_credentials(config.api_key, team_id)
def get_resumable_source_manager(self, inputs: SourceInputs) -> ResumableSourceManager[GetdxResumeConfig]:
return ResumableSourceManager(inputs, GetdxResumeConfig)
def source_for_pipeline(
self,
config: GetdxSourceConfig,
resumable_source_manager: ResumableSourceManager[GetdxResumeConfig],
inputs: SourceInputs,
) -> SourceResponse:
return getdx_source(config, inputs, resumable_source_manager)