: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
feat(data-warehouse): add OwnerRez import source (#84433)
Tom Owerscf6034a9b2fb
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs/ownerrez.py b/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs/ownerrez.pyindex 9fefe1619593..d79e3acc0042 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs/ownerrez.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs/ownerrez.py@@ -6,4 +6,5 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common imp@config.configclass OwnerrezSourceConfig(config.Config):- pass+ email: str+ api_key: strdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/canonical_descriptions.pynew file mode 100644index 000000000000..48eb0290796a--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/canonical_descriptions.py@@ -0,0 +1,191 @@+"""Canonical, documentation-sourced descriptions for OwnerRez endpoints and columns.++Sourced from the official OwnerRez API v2 reference (https://api.ownerreservations.com/help/v2)+and its OpenAPI spec. Keyed by the resource names in `settings.py` `ENDPOINTS`, which match the+`ExternalDataSchema.name` of a synced OwnerRez table. Columns absent here fall back to LLM enrichment.+"""++from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (+ CanonicalDescriptions,+)++CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {+ "Bookings": {+ "description": "A guest reservation or blocked-off period against one of the account's properties.",+ "docs_url": "https://api.ownerreservations.com/help/v2/bookings/get-bookings.md",+ "columns": {+ "id": "Unique identifier for the booking.",+ "property_id": "Identifier of the property this booking is for.",+ "guest_id": "Identifier of the guest this booking is for.",+ "status": "Booking status: Active, Pending, or Canceled.",+ "type": "Type of booking (e.g. guest booking or a simple block).",+ "is_block": "Whether this is a simple blocked-off time booking (true) or a full guest booking (false).",+ "arrival": "Arrival date in the property's time zone.",+ "departure": "Departure date in the property's time zone.",+ "adults": "Number of adult guests on the booking.",+ "children": "Number of child guests on the booking.",+ "infants": "Number of infant guests on the booking.",+ "pets": "Number of pets on the booking.",+ "total_amount": "Total amount charged for the booking.",+ "total_paid": "Total amount paid toward the booking so far.",+ "total_owed": "Remaining amount owed on the booking.",+ "total_refunded": "Total amount refunded on the booking.",+ "total_host_fees": "Total host fees charged on the booking.",+ "currency_code": "Three-letter currency code the booking is billed in.",+ "listing_site": "The listing site (channel) the booking came from, if any.",+ "platform_reservation_number": "The OTA's own reservation number, if the booking came from a channel.",+ "quote_id": "Identifier of the quote this booking was created from, if any.",+ "created_utc": "Timestamp the booking was created in OwnerRez.",+ "updated_utc": "Timestamp the booking was last updated in OwnerRez.",+ "booked_utc": "Timestamp the booking was confirmed/booked.",+ "canceled_utc": "Timestamp the booking was canceled, if applicable.",+ },+ },+ "Payments": {+ "description": "A payment collected from a guest against a booking.",+ "docs_url": "https://api.ownerreservations.com/help/v2/payments/get-payments.md",+ "columns": {+ "id": "Unique identifier for the payment.",+ "booking_id": "Identifier of the booking this payment applies to.",+ "amount": "The payment amount.",+ "description": "The payment description.",+ "type": "Type of payment.",+ "collected_utc": "Timestamp the payment was collected.",+ "is_deposited": "Whether the payment has been deposited in full.",+ "total_fees": "The amount of processing fees on this payment.",+ },+ },+ "Guests": {+ "description": "A guest record — the person a booking or quote is made for.",+ "docs_url": "https://api.ownerreservations.com/help/v2/guests/get-guests.md",+ "columns": {+ "id": "Unique identifier for the guest.",+ "first_name": "Guest's first name.",+ "last_name": "Guest's last name.",+ "notes": "Free-text notes about the guest.",+ "is_banned": "Whether the guest is banned from booking.",+ "opt_out_marketing_email": "Whether the guest has opted out of marketing email.",+ "opt_out_marketing_sms": "Whether the guest has opted out of marketing SMS.",+ "opt_out_transactional_sms": "Whether the guest has opted out of transactional SMS.",+ },+ },+ "Properties": {+ "description": "A rental property (listing) managed in the account.",+ "docs_url": "https://api.ownerreservations.com/help/v2/properties/get-properties.md",+ "columns": {+ "id": "Unique identifier for the property.",+ "key": "A globally unique ID for this property.",+ "name": "The internal property display name.",+ "external_name": "The external (public-facing) property display name.",+ "active": "Whether the property is active.",+ "is_snoozed": "Whether the property is snoozed (temporarily hidden from booking).",+ "owner_id": "Identifier of the property's owner.",+ "internal_code": "The internal property identification code.",+ "bedrooms": "Number of bedrooms at the property.",+ "bathrooms": "Total number of full and half bathrooms at the property.",+ "bathrooms_full": "Number of full bathrooms at the property.",+ "bathrooms_half": "Number of half bathrooms at the property.",+ "max_guests": "Maximum number of guests allowed at the property.",+ "max_adults": "Maximum number of adults allowed, or null to use max_guests.",+ "max_children": "Maximum number of children allowed.",+ "max_pets": "Maximum number of pets allowed, or null for any number.",+ "currency_code": "Currency used for transactions at this property.",+ "time_zone": "The property's time zone, in IANA Time Zone format.",+ "check_in": "Check-in start time rule for the property (HH:mm).",+ "check_in_end": "Check-in end time rule for the property (HH:mm).",+ "check_out": "Check-out time rule for the property (HH:mm).",+ "latitude": "Property latitude.",+ "longitude": "Property longitude.",+ "public_url": "The public property website URL.",+ },+ },+ "Quotes": {+ "description": "A price quote generated for a prospective booking, before it's confirmed.",+ "docs_url": "https://api.ownerreservations.com/help/v2/quotes/get-quotes.md",+ "columns": {+ "id": "Unique identifier for the quote.",+ "key": "A globally unique ID for this quote.",+ "guest_id": "Identifier of the guest the quote was created for.",+ "property_id": "Identifier of the quoted property.",+ "arrival": "The quoted date of arrival.",+ "departure": "The quoted date of departure.",+ "adults": "The quoted number of adults.",+ "children": "The quoted number of children.",+ "infants": "The quoted number of infants.",+ "pets": "The quoted number of pets.",+ "notes": "Notes about the quote.",+ "listing_site": "The listing site this quote is attributed to.",+ "created_utc": "Timestamp the quote was created in OwnerRez.",+ "updated_utc": "Timestamp the quote was last updated in OwnerRez.",+ "quoted_utc": "Timestamp the quote was made.",+ "expires_utc": "Timestamp the quote expires.",+ },+ },+ "Deposits": {+ "description": "A batch deposit of payments, refunds, and fees into the host's bank account.",+ "docs_url": "https://api.ownerreservations.com/help/v2/deposits/get-deposits.md",+ "columns": {+ "id": "Unique identifier for the deposit.",+ "deposited_utc": "Timestamp this deposit occurred.",+ "processor": "Payment processor the deposit went through.",+ "processing_status": "Processing status of the deposit.",+ "external_status": "External (processor-reported) status of the deposit.",+ "external_deposit_number": "The third-party (processor) identifier for this deposit, if any.",+ "total_deposited": "Total deposited amount (the final net).",+ "total_fees": "Total processing fees deducted.",+ "total_adjustments": "Total adjustments amount.",+ "total_transactions": "Total amount across every payment, refund, and fee in this deposit.",+ },+ },+ "Fees": {+ "description": "A fee charged on a booking (e.g. a cleaning fee or processing fee).",+ "docs_url": "https://api.ownerreservations.com/help/v2/fees/get-fees.md",+ "columns": {+ "id": "Unique identifier for the fee.",+ "booking_id": "Identifier of the booking this fee applies to.",+ "amount": "The fee amount.",+ "description": "The fee description.",+ "payment_id": "Identifier of the payment this fee was charged against, if any.",+ "refund_id": "Identifier of the refund this fee was charged against, if any.",+ "security_deposit_id": "Identifier of the security deposit this fee was charged against, if any.",+ },+ },+ "Refunds": {+ "description": "A refund issued to a guest against a booking.",+ "docs_url": "https://api.ownerreservations.com/help/v2/refunds/get-refunds.md",+ "columns": {+ "id": "Unique identifier for the refund.",+ "booking_id": "Identifier of the booking this refund applies to.",+ "amount": "The refund amount.",+ "description": "The refund description.",+ "type": "Type of refund.",+ "linked_payment_id": "Identifier of the payment this refund is linked to, if any.",+ "paid_utc": "Timestamp the refund was paid.",+ "is_deposited": "Whether the refund has been deposited in full.",+ "total_fees": "The amount of processing fees on this refund.",+ },+ },+ "Reviews": {+ "description": "A guest or host review left for a stay.",+ "docs_url": "https://api.ownerreservations.com/help/v2/reviews/get-reviews.md",+ "columns": {+ "id": "The review id.",+ "booking_id": "Identifier of the booking this review is for.",+ "guest_id": "Identifier of the guest who left the review.",+ "property_id": "Identifier of the property being reviewed.",+ "title": "The title of the review.",+ "body": "The body of the review.",+ "response": "The host's response to the review, if any.",+ "stars": "The rating out of five stars.",+ "visible": "Whether the review is publicly visible.",+ "listing_site": "The name of the listing site the review was posted to.",+ "display_name": "The reviewer's display name.",+ "display_location": "The reviewer's display location.",+ "month_of_stay": "The month the guest stayed at the property.",+ "year_of_stay": "The year the guest stayed at the property.",+ "date": "The date the review was written.",+ "created_utc": "Timestamp the review was created.",+ "updated_utc": "Timestamp the review was last updated.",+ },+ },+}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/ownerrez.py b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/ownerrez.pynew file mode 100644index 000000000000..ae40b3bbe354--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/ownerrez.py@@ -0,0 +1,164 @@+import base64+from datetime import UTC, date, datetime+from typing import Any, Optional++from posthog.dataclasses import frozen++from products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_session+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source import (+ RESTAPIConfig,+ rest_api_resource,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import (+ JSONResponsePaginator,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager+from products.warehouse_sources.backend.temporal.data_imports.sources.common.source_helpers import validate_via_probe+from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse+from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.settings import (+ EPOCH,+ OWNERREZ_ENDPOINTS,+ PAGE_LIMIT,+ OwnerRezEndpointConfig,+)++BASE_URL = "https://api.ownerrez.com"+OWNERREZ_API_HOST = "api.ownerrez.com"+# Required per the vendor's auth guide: "Use a user-agent header to identify yourself on all calls."+USER_AGENT = "PostHog Data Warehouse (+https://posthog.com)"+++@frozen+class OwnerRezResumeConfig:+ next_url: str+++def _format_since_utc(value: Any) -> str:+ """Format an incremental cursor as the UTC ISO-8601 string OwnerRez's since filters expect."""+ if isinstance(value, datetime):+ aware = value if value.tzinfo is not None else value.replace(tzinfo=UTC)+ return aware.astimezone(UTC).strftime("%Y-%m-%dT%H:%M:%SZ")+ if isinstance(value, date):+ return datetime.combine(value, datetime.min.time(), tzinfo=UTC).strftime("%Y-%m-%dT%H:%M:%SZ")+ return str(value)+++def _basic_auth_header(email: str, api_key: str) -> str:+ encoded = base64.b64encode(f"{email}:{api_key}".encode()).decode("ascii")+ return f"Basic {encoded}"+++def _build_params(+ config: OwnerRezEndpointConfig,+ should_use_incremental_field: bool,+ db_incremental_field_last_value: Optional[Any],+) -> dict[str, Any]:+ params: dict[str, Any] = {"limit": PAGE_LIMIT}+ if not config.since_param:+ return params++ if config.incremental_fields and should_use_incremental_field and db_incremental_field_last_value is not None:+ params[config.since_param] = _format_since_utc(db_incremental_field_last_value)+ elif config.since_required:+ params[config.since_param] = EPOCH++ return params+++def ownerrez_source(+ email: str,+ api_key: str,+ endpoint: str,+ team_id: int,+ job_id: str,+ resumable_source_manager: ResumableSourceManager[OwnerRezResumeConfig],+ db_incremental_field_last_value: Optional[Any],+ should_use_incremental_field: bool = False,+) -> SourceResponse:+ endpoint_config = OWNERREZ_ENDPOINTS[endpoint]+ params = _build_params(endpoint_config, should_use_incremental_field, db_incremental_field_last_value)+ is_incremental = bool(endpoint_config.incremental_fields) and should_use_incremental_field++ config: RESTAPIConfig = {+ "client": {+ "base_url": BASE_URL,+ "headers": {"User-Agent": USER_AGENT},+ "auth": {+ "type": "http_basic",+ # OwnerRez's auth guide authenticates with the account email as the username and+ # the personal access token (pt_...) as the password — not the token-as-username+ # form its OpenAPI security scheme description suggests.+ "username": email,+ "password": api_key,+ },+ # The response's `next_page_url` is a self-contained cursor link; follow it verbatim+ # per the vendor's pagination guide rather than incrementing offset/limit by hand.+ "paginator": JSONResponsePaginator(next_url_path="next_page_url"),+ # Pagination follows a URL supplied by the response body, and every request is+ # Basic-authenticated; pin follow-up requests to the API host and refuse redirects so a+ # tampered or spoofed next-page link can't exfiltrate the credentials to another origin.+ "allowed_hosts": [OWNERREZ_API_HOST],+ "allow_redirects": False,+ },+ "resource_defaults": {+ "write_disposition": {+ "disposition": "merge",+ "strategy": "upsert",+ }+ if is_incremental+ else "replace",+ },+ "resources": [+ {+ "name": endpoint_config.name,+ "endpoint": {+ "data_selector": "items",+ "path": endpoint_config.path,+ "params": params,+ },+ "table_format": "delta",+ }+ ],+ }++ initial_paginator_state: Optional[dict[str, Any]] = None+ if resumable_source_manager.can_resume():+ resume_config = resumable_source_manager.load_state()+ if resume_config is not None:+ initial_paginator_state = {"next_url": resume_config.next_url}++ def save_checkpoint(state: Optional[dict[str, Any]]) -> None:+ # Only persist while a next page remains; save AFTER a page is yielded so a crash re-yields+ # the last page (merge dedupes on primary key) rather than skipping it.+ if state and state.get("next_url"):+ resumable_source_manager.save_state(OwnerRezResumeConfig(next_url=str(state["next_url"])))++ resource = rest_api_resource(+ config,+ team_id,+ job_id,+ db_incremental_field_last_value,+ resume_hook=save_checkpoint,+ initial_paginator_state=initial_paginator_state,+ )++ return SourceResponse(+ name=resource.name,+ items=lambda: resource,+ primary_keys=endpoint_config.primary_keys,+ partition_count=1,+ partition_size=1,+ partition_mode="datetime" if endpoint_config.partition_key else None,+ partition_format="month" if endpoint_config.partition_key else None,+ partition_keys=[endpoint_config.partition_key] if endpoint_config.partition_key else None,+ column_hints=resource.column_hints,+ )+++def validate_credentials(email: str, api_key: str) -> tuple[bool, int | None]:+ """Probe the cheap, filter-free /v2/properties list endpoint to confirm the credentials work."""+ return validate_via_probe(+ lambda: make_tracked_session(redact_values=(api_key,)),+ f"{BASE_URL}/v2/properties?limit=1",+ headers={"Authorization": _basic_auth_header(email, api_key), "User-Agent": USER_AGENT},+ )diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/settings.pynew file mode 100644index 000000000000..24735ab655bb--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/settings.py@@ -0,0 +1,117 @@+from dataclasses import field+from typing import Optional++from posthog.dataclasses import frozen++from products.warehouse_sources.backend.types import IncrementalField, IncrementalFieldType++# The pagination guide (api.ownerreservations.com/help/guides/api-pagination-etags) documents a+# default page size of 20 and a maximum of 100; always request the max to minimise round trips+# against the 300-requests-per-5-minutes rate limit.+PAGE_LIMIT = 100++# Sent as a "give me everything" value on endpoints that require a since-style filter but have+# no watermark yet (first sync, or an endpoint we never expose as incremental).+EPOCH = "1970-01-01T00:00:00Z"+++def _updated_utc_incremental_field() -> list[IncrementalField]:+ return [+ {+ "label": "updated_utc",+ "type": IncrementalFieldType.DateTime,+ "field": "updated_utc",+ "field_type": IncrementalFieldType.DateTime,+ },+ ]+++@frozen+class OwnerRezEndpointConfig:+ name: str+ path: str # under /v2+ # Query param OwnerRez accepts for a UTC "since" filter, if any (e.g. "since_utc",+ # "created_since_utc"). None means the endpoint has no time filter at all.+ since_param: Optional[str] = None+ # The endpoint's list action 400s unless since_param (or an alternate identifying filter we+ # don't use, e.g. property_ids) is present on every request — so EPOCH is sent even outside+ # incremental mode. Confirmed per-endpoint against the published OpenAPI spec descriptions.+ since_required: bool = False+ # Non-empty only when since_param maps onto a field OwnerRez actually returns on the row, so+ # the pipeline can compute the next watermark from synced data. Several endpoints document a+ # since_utc filter (query the OpenAPI spec's ViewModel schemas) but return no comparable+ # timestamp column, so incremental sync isn't verifiable for them and they stay full refresh.+ incremental_fields: list[IncrementalField] = field(default_factory=list)+ primary_keys: list[str] = field(default_factory=lambda: ["id"])+ partition_key: Optional[str] = None+++OWNERREZ_ENDPOINTS: dict[str, OwnerRezEndpointConfig] = {+ "Bookings": OwnerRezEndpointConfig(+ name="Bookings",+ path="/v2/bookings",+ since_param="since_utc",+ since_required=True, # docs: "Either property_ids or since_utc is required."+ incremental_fields=_updated_utc_incremental_field(),+ partition_key="created_utc",+ ),+ "Payments": OwnerRezEndpointConfig(+ name="Payments",+ path="/v2/payments",+ # since_utc exists but PaymentViewModel has no updated_utc-style column to checkpoint+ # against — full refresh only.+ partition_key="collected_utc",+ ),+ "Guests": OwnerRezEndpointConfig(+ name="Guests",+ path="/v2/guests",+ since_param="created_since_utc",+ since_required=True, # docs: "Either q or created_since_utc is required."+ # GuestModel returns no created/updated timestamp column, so this can never be+ # incremental — every sync sends created_since_utc=EPOCH to fetch the full list.+ partition_key=None,+ ),+ "Properties": OwnerRezEndpointConfig(+ name="Properties",+ path="/v2/properties",+ partition_key=None,+ ),+ "Quotes": OwnerRezEndpointConfig(+ name="Quotes",+ path="/v2/quotes",+ since_param="since_utc",+ incremental_fields=_updated_utc_incremental_field(),+ partition_key="created_utc",+ ),+ "Deposits": OwnerRezEndpointConfig(+ name="Deposits",+ path="/v2/deposits",+ # since_utc exists but DepositViewModel has no updated_utc-style column.+ partition_key="deposited_utc",+ ),+ "Fees": OwnerRezEndpointConfig(+ name="Fees",+ path="/v2/fees",+ # since_utc exists but FeeViewModel returns no date field at all.+ partition_key=None,+ ),+ "Refunds": OwnerRezEndpointConfig(+ name="Refunds",+ path="/v2/refunds",+ # since_utc exists but RefundViewModel has no updated_utc-style column.+ partition_key="paid_utc",+ ),+ "Reviews": OwnerRezEndpointConfig(+ name="Reviews",+ path="/v2/reviews",+ since_param="since_utc",+ incremental_fields=_updated_utc_incremental_field(),+ partition_key="created_utc",+ ),+}++ENDPOINTS = tuple(OWNERREZ_ENDPOINTS.keys())++INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {+ name: config.incremental_fields for name, config in OWNERREZ_ENDPOINTS.items()+}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/source.pyindex eacf422c58ba..1148588dd577 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/source.py@@ -1,21 +1,48 @@-from typing import cast+from typing import Optional, castfrom posthog.schema import (DataWarehouseSourceCategory,ExternalDataSourceType as SchemaExternalDataSourceType,+ ReleaseStatus,SourceConfig,+ SourceFieldInputConfig,+ SourceFieldInputConfigType,)-from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, SimpleSource+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, ResumableSource+from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (+ CanonicalDescriptions,+)from products.warehouse_sources.backend.temporal.data_imports.sources.common.registry import SourceRegistry+from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager+from products.warehouse_sources.backend.temporal.data_imports.sources.common.schema import (+ SourceSchema,+ build_endpoint_schemas,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceInputs, SourceResponsefrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.ownerrez import (OwnerrezSourceConfig,)+from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.ownerrez import (+ OwnerRezResumeConfig,+ ownerrez_source,+ validate_credentials as validate_ownerrez_credentials,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.settings import (+ ENDPOINTS,+ INCREMENTAL_FIELDS,+)from products.warehouse_sources.backend.types import ExternalDataSourceType@SourceRegistry.register-class OwnerrezSource(SimpleSource[OwnerrezSourceConfig]):+class OwnerrezSource(ResumableSource[OwnerrezSourceConfig, OwnerRezResumeConfig]):+ lists_tables_without_credentials = True # static endpoint catalog — safe for public docs++ # OwnerRez's API is unversioned in practice: paths are pinned under /v2 with no dated+ # version header, param, or named release to declare.+ api_docs_url = "https://api.ownerreservations.com/help/v2"+@propertydef source_type(self) -> ExternalDataSourceType:return ExternalDataSourceType.OWNERREZ@@ -26,7 +53,92 @@ class OwnerrezSource(SimpleSource[OwnerrezSourceConfig]):name=SchemaExternalDataSourceType.OWNERREZ,category=DataWarehouseSourceCategory.E_COMMERCE,label="OwnerRez",+ releaseStatus=ReleaseStatus.ALPHA,+ caption="""Enter your OwnerRez account email and personal access token to pull your bookings, guests, payments, and property data into the PostHog Data warehouse.++Create a personal access token under **Settings → Advanced Tools → Developer/API Settings** in your OwnerRez account. OwnerRez rate limits personal access tokens per IP address to two accounts every 24 hours, so this connection method suits a single OwnerRez account rather than many.""",iconPath="/static/services/ownerrez.png",- fields=cast(list[FieldType], []),- unreleasedSource=True,+ docsUrl="https://posthog.com/docs/cdp/sources/ownerrez",+ fields=cast(+ list[FieldType],+ [+ SourceFieldInputConfig(+ name="email",+ label="Account email",+ type=SourceFieldInputConfigType.EMAIL,+ required=True,+ placeholder="[email protected]",+ secret=False,+ ),+ SourceFieldInputConfig(+ name="api_key",+ label="Personal access token",+ type=SourceFieldInputConfigType.PASSWORD,+ required=True,+ placeholder="pt_...",+ secret=True,+ ),+ ],+ ),+ )++ def get_canonical_descriptions(self) -> CanonicalDescriptions:+ from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.canonical_descriptions import (+ CANONICAL_DESCRIPTIONS,+ )++ return CANONICAL_DESCRIPTIONS++ def get_non_retryable_errors(self) -> dict[str, str | None]:+ return {+ "401 Client Error: Unauthorized": "Your OwnerRez credentials are invalid. Check your account email and personal access token, then reconnect.",+ "403 Client Error: Forbidden": "Your OwnerRez account does not have permission to access this data. Check your account settings, then reconnect.",+ }++ def get_schemas(+ self,+ config: OwnerrezSourceConfig,+ team_id: int,+ with_counts: bool = False,+ names: list[str] | None = None,+ force_refresh: bool = False,+ api_version: str | None = None,+ ) -> list[SourceSchema]:+ return build_endpoint_schemas(ENDPOINTS, INCREMENTAL_FIELDS, names)++ def validate_credentials(+ self,+ config: OwnerrezSourceConfig,+ team_id: int,+ schema_name: Optional[str] = None,+ api_version: str | None = None,+ ) -> tuple[bool, str | None]:+ ok, status_code = validate_ownerrez_credentials(config.email, config.api_key)++ if ok:+ return True, None+ if status_code == 401:+ return False, "Invalid OwnerRez account email or personal access token"+ return False, "Could not connect to OwnerRez with the provided account email and personal access token"++ def get_resumable_source_manager(self, inputs: SourceInputs) -> ResumableSourceManager[OwnerRezResumeConfig]:+ return ResumableSourceManager[OwnerRezResumeConfig](inputs, OwnerRezResumeConfig)++ def source_for_pipeline(+ self,+ config: OwnerrezSourceConfig,+ resumable_source_manager: ResumableSourceManager[OwnerRezResumeConfig],+ inputs: SourceInputs,+ ) -> SourceResponse:+ return ownerrez_source(+ email=config.email,+ api_key=config.api_key,+ endpoint=inputs.schema_name,+ team_id=inputs.team_id,+ job_id=inputs.job_id,+ resumable_source_manager=resumable_source_manager,+ should_use_incremental_field=inputs.should_use_incremental_field,+ db_incremental_field_last_value=inputs.db_incremental_field_last_value+ if inputs.should_use_incremental_field+ else None,)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/tests/test_ownerrez.py b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/tests/test_ownerrez.pynew file mode 100644index 000000000000..9b2070abf257--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/tests/test_ownerrez.py@@ -0,0 +1,346 @@+import json+import base64+from datetime import UTC, date, datetime+from typing import Any, cast++from unittest import mock++from parameterized import parameterized+from requests import Response++from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.auth import HttpBasicAuth+from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.ownerrez import (+ OwnerRezResumeConfig,+ _basic_auth_header,+ _build_params,+ _format_since_utc,+ ownerrez_source,+ validate_credentials,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.settings import (+ EPOCH,+ OWNERREZ_ENDPOINTS,+ PAGE_LIMIT,+)++# RESTClient builds its session via make_tracked_session in the rest_client module.+CLIENT_SESSION_PATCH = "products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.rest_client.make_tracked_session"+# validate_credentials builds its own tracked session in the ownerrez module.+OWNERREZ_SESSION_PATCH = (+ "products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.ownerrez.make_tracked_session"+)+++class TestFormatSinceUtc:+ @parameterized.expand(+ [+ ("utc_datetime", datetime(2026, 3, 4, 2, 58, 14, tzinfo=UTC), "2026-03-04T02:58:14Z"),+ ("naive_datetime", datetime(2026, 3, 4, 2, 58, 14), "2026-03-04T02:58:14Z"),+ ("date_value", date(2026, 3, 4), "2026-03-04T00:00:00Z"),+ ("string_passthrough", "2026-03-04T02:58:14Z", "2026-03-04T02:58:14Z"),+ ]+ )+ def test_format(self, _name: str, value: Any, expected: str) -> None:+ result = _format_since_utc(value)+ assert result == expected+ assert "+00:00" not in result+++class TestBasicAuthHeader:+ def test_encodes_email_and_token(self) -> None:+ header = _basic_auth_header("[email protected]", "pt_key")+ assert header.startswith("Basic ")+ decoded = base64.b64decode(header.removeprefix("Basic ")).decode()+ assert decoded == "[email protected]:pt_key"+++class TestBuildParams:+ def test_required_since_endpoint_defaults_to_epoch_on_first_sync(self) -> None:+ params = _build_params(+ OWNERREZ_ENDPOINTS["Bookings"], should_use_incremental_field=True, db_incremental_field_last_value=None+ )+ assert params == {"limit": PAGE_LIMIT, "since_utc": EPOCH}++ def test_required_since_endpoint_uses_cursor_when_present(self) -> None:+ params = _build_params(+ OWNERREZ_ENDPOINTS["Bookings"],+ should_use_incremental_field=True,+ db_incremental_field_last_value=datetime(2026, 3, 4, 2, 58, 14, tzinfo=UTC),+ )+ assert params == {"limit": PAGE_LIMIT, "since_utc": "2026-03-04T02:58:14Z"}++ def test_required_since_endpoint_uses_epoch_when_not_incremental(self) -> None:+ params = _build_params(+ OWNERREZ_ENDPOINTS["Bookings"], should_use_incremental_field=False, db_incremental_field_last_value=None+ )+ assert params == {"limit": PAGE_LIMIT, "since_utc": EPOCH}++ def test_optional_since_endpoint_omits_filter_with_no_cursor(self) -> None:+ # Quotes' since_utc isn't required by the API, so a first sync with no watermark fetches everything.+ params = _build_params(+ OWNERREZ_ENDPOINTS["Quotes"], should_use_incremental_field=True, db_incremental_field_last_value=None+ )+ assert params == {"limit": PAGE_LIMIT}++ def test_optional_since_endpoint_filters_with_cursor(self) -> None:+ params = _build_params(+ OWNERREZ_ENDPOINTS["Quotes"],+ should_use_incremental_field=True,+ db_incremental_field_last_value=datetime(2026, 3, 4, tzinfo=UTC),+ )+ assert params == {"limit": PAGE_LIMIT, "since_utc": "2026-03-04T00:00:00Z"}++ def test_non_incremental_endpoint_never_filters(self) -> None:+ # Guests has no exposed timestamp column, so it never offers incremental sync — but the+ # API still requires created_since_utc on every request.+ params = _build_params(+ OWNERREZ_ENDPOINTS["Guests"], should_use_incremental_field=True, db_incremental_field_last_value=None+ )+ assert params == {"limit": PAGE_LIMIT, "created_since_utc": EPOCH}++ def test_endpoint_without_since_param_never_filters(self) -> None:+ params = _build_params(+ OWNERREZ_ENDPOINTS["Properties"],+ should_use_incremental_field=True,+ db_incremental_field_last_value=datetime(2026, 3, 4, tzinfo=UTC),+ )+ assert params == {"limit": PAGE_LIMIT}+++def _response(items: list[dict[str, Any]] | None, *, next_page_url: str | None = None) -> Response:+ body: dict[str, Any] = {"items": items or [], "limit": PAGE_LIMIT, "offset": 0, "next_page_url": next_page_url}+ resp = Response()+ resp.status_code = 200+ resp._content = json.dumps(body).encode()+ return resp+++def _make_manager(resume_state: OwnerRezResumeConfig | None = None) -> mock.MagicMock:+ manager = mock.MagicMock()+ manager.can_resume.return_value = resume_state is not None+ manager.load_state.return_value = resume_state+ return manager+++def _wire(session: mock.MagicMock, responses: list[Response]) -> list[dict[str, Any]]:+ """Wire a mock session and return a list that captures each request AT SEND TIME.++ ``request.params`` is a single dict mutated in place across pages, so inspecting it after the+ run shows only the final state — snapshot a copy when each request is prepared instead.+ """+ session.headers = {}+ snapshots: list[dict[str, Any]] = []++ def _prepare(request: Any) -> mock.MagicMock:+ snapshots.append(+ {+ "url": request.url,+ "params": dict(request.params or {}),+ "auth": request.auth,+ "headers": dict(request.headers or {}),+ }+ )+ # RESTClient checks the *prepared* request's URL against allowed_hosts before sending+ # (rest_client._check_allowed_host), so the stand-in prepared request needs a real URL+ # string here, not an auto-generated Mock attribute.+ prepared = mock.MagicMock()+ prepared.url = request.url+ return prepared++ session.prepare_request.side_effect = _prepare+ session.send.side_effect = responses+ return snapshots+++def _source(endpoint: str, manager: mock.MagicMock, **kwargs: Any):+ return ownerrez_source(+ email="[email protected]",+ api_key="pt_key",+ endpoint=endpoint,+ team_id=1,+ job_id="j",+ resumable_source_manager=manager,+ db_incremental_field_last_value=None,+ **kwargs,+ )+++def _rows(source_response) -> list[dict[str, Any]]:+ return [row for page in cast(Any, source_response.items()) for row in page]+++class TestOwnerrezSourceTransport:+ @mock.patch(CLIENT_SESSION_PATCH)+ def test_follows_next_page_url_until_null(self, MockSession) -> None:+ session = MockSession.return_value+ snapshots = _wire(+ session,+ [+ _response([{"id": 1}, {"id": 2}], next_page_url="https://api.ownerrez.com/v2/properties?offset=2"),+ _response([{"id": 3}], next_page_url=None),+ ],+ )++ rows = _rows(_source("Properties", _make_manager()))++ assert [r["id"] for r in rows] == [1, 2, 3]+ assert session.send.call_count == 2+ assert snapshots[0]["url"] == "https://api.ownerrez.com/v2/properties"+ assert snapshots[0]["params"] == {"limit": PAGE_LIMIT}+ # The second request follows the opaque next_page_url verbatim, with no re-appended params.+ assert snapshots[1]["url"] == "https://api.ownerrez.com/v2/properties?offset=2"+ assert snapshots[1]["params"] == {}++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_auth_is_framework_http_basic_with_email_as_username(self, MockSession) -> None:+ session = MockSession.return_value+ snapshots = _wire(session, [_response([{"id": 1}])])++ _rows(_source("Properties", _make_manager()))++ auth = snapshots[0]["auth"]+ assert isinstance(auth, HttpBasicAuth)+ assert auth.username == "[email protected]"+ assert auth.password == "pt_key"++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_sends_user_agent_header(self, MockSession) -> None:+ session = MockSession.return_value+ session.headers = {}+ _wire(session, [_response([{"id": 1}])])++ _rows(_source("Properties", _make_manager()))++ assert session.headers.get("User-Agent") == "PostHog Data Warehouse (+https://posthog.com)"++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_bookings_sends_epoch_since_utc_on_first_full_sync(self, MockSession) -> None:+ session = MockSession.return_value+ snapshots = _wire(session, [_response([{"id": 1}])])++ _rows(_source("Bookings", _make_manager()))++ assert snapshots[0]["params"]["since_utc"] == EPOCH++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_bookings_incremental_cursor_added_to_request(self, MockSession) -> None:+ session = MockSession.return_value+ snapshots = _wire(session, [_response([{"id": 1}])])++ _rows(+ ownerrez_source(+ email="[email protected]",+ api_key="pt_key",+ endpoint="Bookings",+ team_id=1,+ job_id="j",+ resumable_source_manager=_make_manager(),+ should_use_incremental_field=True,+ db_incremental_field_last_value=datetime(2026, 3, 4, 2, 58, 14, tzinfo=UTC),+ )+ )++ assert snapshots[0]["params"]["since_utc"] == "2026-03-04T02:58:14Z"++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_saves_resume_state_only_while_pages_remain(self, MockSession) -> None:+ session = MockSession.return_value+ _wire(+ session,+ [+ _response([{"id": 1}], next_page_url="https://api.ownerrez.com/v2/properties?offset=1"),+ _response([{"id": 2}], next_page_url=None),+ ],+ )++ manager = _make_manager()+ _rows(_source("Properties", manager))++ manager.save_state.assert_called_once()+ assert manager.save_state.call_args.args[0] == OwnerRezResumeConfig(+ next_url="https://api.ownerrez.com/v2/properties?offset=1"+ )++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_resumes_from_saved_next_url(self, MockSession) -> None:+ session = MockSession.return_value+ snapshots = _wire(session, [_response([{"id": 2}], next_page_url=None)])++ rows = _rows(+ _source(+ "Properties",+ _make_manager(OwnerRezResumeConfig(next_url="https://api.ownerrez.com/v2/properties?offset=1")),+ )+ )++ assert [r["id"] for r in rows] == [2]+ assert session.send.call_count == 1+ assert snapshots[0]["url"] == "https://api.ownerrez.com/v2/properties?offset=1"++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_stops_on_empty_items(self, MockSession) -> None:+ session = MockSession.return_value+ _wire(session, [_response([], next_page_url=None)])++ manager = _make_manager()+ rows = _rows(_source("Properties", manager))++ assert rows == []+ assert session.send.call_count == 1+ manager.save_state.assert_not_called()++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_write_disposition_is_merge_when_incremental(self, MockSession) -> None:+ session = MockSession.return_value+ _wire(session, [_response([{"id": 1}])])++ response = ownerrez_source(+ email="[email protected]",+ api_key="pt_key",+ endpoint="Bookings",+ team_id=1,+ job_id="j",+ resumable_source_manager=_make_manager(),+ should_use_incremental_field=True,+ db_incremental_field_last_value=None,+ )+ assert response.primary_keys == ["id"]+ assert response.partition_mode == "datetime"+ assert response.partition_keys == ["created_utc"]++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_full_refresh_endpoint_has_no_partitioning(self, MockSession) -> None:+ session = MockSession.return_value+ _wire(session, [_response([{"id": 1}])])++ response = _source("Guests", _make_manager())+ assert response.partition_mode is None+ assert response.partition_keys is None+++class TestValidateCredentials:+ @mock.patch(OWNERREZ_SESSION_PATCH)+ def test_ok(self, mock_session) -> None:+ mock_session.return_value.get.return_value = mock.MagicMock(status_code=200)+ assert validate_credentials("[email protected]", "pt_key") == (True, 200)++ @mock.patch(OWNERREZ_SESSION_PATCH)+ def test_unauthorized(self, mock_session) -> None:+ mock_session.return_value.get.return_value = mock.MagicMock(status_code=401)+ assert validate_credentials("[email protected]", "pt_key") == (False, 401)++ @mock.patch(OWNERREZ_SESSION_PATCH)+ def test_swallows_transport_errors(self, mock_session) -> None:+ mock_session.return_value.get.side_effect = Exception("boom")+ assert validate_credentials("[email protected]", "pt_key") == (False, None)++ @mock.patch(OWNERREZ_SESSION_PATCH)+ def test_probes_properties_endpoint_with_basic_auth_header(self, mock_session) -> None:+ mock_session.return_value.get.return_value = mock.MagicMock(status_code=200)+ validate_credentials("[email protected]", "pt_key")++ call = mock_session.return_value.get.call_args+ assert call.args[0] == "https://api.ownerrez.com/v2/properties?limit=1"+ decoded = base64.b64decode(call.kwargs["headers"]["Authorization"].removeprefix("Basic ")).decode()+ assert decoded == "[email protected]:pt_key"+ assert call.kwargs["headers"]["User-Agent"] == "PostHog Data Warehouse (+https://posthog.com)"diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/tests/test_ownerrez_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/tests/test_ownerrez_source.pynew file mode 100644index 000000000000..7d41e9e180f9--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/ownerrez/tests/test_ownerrez_source.py@@ -0,0 +1,169 @@+import pytest+from unittest import mock++from posthog.schema import ReleaseStatus, SourceFieldInputConfig, SourceFieldInputConfigType++from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.ownerrez import (+ OwnerrezSourceConfig,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.ownerrez import OwnerRezResumeConfig+from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.settings import ENDPOINTS+from products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.source import OwnerrezSource+from products.warehouse_sources.backend.types import ExternalDataSourceType++_INCREMENTAL_ENDPOINTS = {"Bookings", "Quotes", "Reviews"}+_FULL_REFRESH_ENDPOINTS = {"Payments", "Guests", "Properties", "Deposits", "Fees", "Refunds"}+++class TestOwnerrezSource:+ def setup_method(self):+ self.source = OwnerrezSource()+ self.team_id = 123+ self.config = OwnerrezSourceConfig(email="[email protected]", api_key="pt_key")++ def test_source_type(self):+ assert self.source.source_type == ExternalDataSourceType.OWNERREZ++ def test_get_source_config(self):+ config = self.source.get_source_config++ assert config.name.value == "Ownerrez"+ assert config.label == "OwnerRez"+ assert config.releaseStatus == ReleaseStatus.ALPHA+ assert config.unreleasedSource is None+ assert config.iconPath == "/static/services/ownerrez.png"+ assert config.docsUrl == "https://posthog.com/docs/cdp/sources/ownerrez"++ field_names = [f.name for f in config.fields if isinstance(f, SourceFieldInputConfig)]+ assert field_names == ["email", "api_key"]++ def test_api_key_field_is_secret_password(self):+ config = self.source.get_source_config+ api_key_field = next(f for f in config.fields if isinstance(f, SourceFieldInputConfig) and f.name == "api_key")+ assert api_key_field.type == SourceFieldInputConfigType.PASSWORD+ assert api_key_field.secret is True+ assert api_key_field.required is True++ def test_email_field_is_not_secret(self):+ config = self.source.get_source_config+ email_field = next(f for f in config.fields if isinstance(f, SourceFieldInputConfig) and f.name == "email")+ assert email_field.type == SourceFieldInputConfigType.EMAIL+ assert email_field.secret is False+ assert email_field.required is True++ @pytest.mark.parametrize(+ "observed_error",+ [+ "401 Client Error: Unauthorized for url: https://api.ownerrez.com/v2/bookings?limit=100",+ "403 Client Error: Forbidden for url: https://api.ownerrez.com/v2/guests?limit=100",+ ],+ )+ def test_non_retryable_errors_match_auth_failures(self, observed_error):+ non_retryable_errors = self.source.get_non_retryable_errors()+ assert any(key in observed_error for key in non_retryable_errors)++ @pytest.mark.parametrize(+ "other_error",+ [+ "429 Client Error: Too Many Requests for url: https://api.ownerrez.com/v2/bookings",+ "500 Server Error: Internal Server Error for url: https://api.ownerrez.com/v2/bookings",+ "HTTPSConnectionPool(host='api.ownerrez.com', port=443): Read timed out.",+ ],+ )+ def test_non_retryable_errors_do_not_match_transient(self, other_error):+ non_retryable_errors = self.source.get_non_retryable_errors()+ assert not any(key in other_error for key in non_retryable_errors)++ def test_get_schemas_match_endpoints_with_correct_sync_modes(self):+ schemas = {schema.name: schema for schema in self.source.get_schemas(self.config, self.team_id)}++ assert set(schemas) == set(ENDPOINTS)+ for name in _INCREMENTAL_ENDPOINTS:+ assert schemas[name].supports_incremental is True+ assert schemas[name].supports_append is True+ assert [f["field"] for f in schemas[name].incremental_fields] == ["updated_utc"]+ for name in _FULL_REFRESH_ENDPOINTS:+ assert schemas[name].supports_incremental is False+ assert schemas[name].supports_append is False+ assert schemas[name].incremental_fields == []++ def test_get_schemas_filtered_by_names(self):+ schemas = self.source.get_schemas(self.config, self.team_id, names=["Bookings"])+ assert len(schemas) == 1+ assert schemas[0].name == "Bookings"++ def test_get_schemas_filtered_unknown_name_returns_empty(self):+ assert self.source.get_schemas(self.config, self.team_id, names=["nope"]) == []++ def test_lists_tables_without_credentials_publishes_catalog(self):+ # Static endpoint catalog (no I/O) — the public docs table list should render.+ assert self.source.lists_tables_without_credentials is True+ documented = self.source.get_documented_tables()+ assert {table["name"] for table in documented} == set(ENDPOINTS)++ def test_canonical_descriptions_cover_every_endpoint(self):+ canonical = self.source.get_canonical_descriptions()+ assert set(canonical) == set(ENDPOINTS)++ @pytest.mark.parametrize(+ "mock_return, expected_valid, expected_message",+ [+ ((True, 200), True, None),+ ((False, 401), False, "Invalid OwnerRez account email or personal access token"),+ (+ (False, 403),+ False,+ "Could not connect to OwnerRez with the provided account email and personal access token",+ ),+ (+ (False, None),+ False,+ "Could not connect to OwnerRez with the provided account email and personal access token",+ ),+ ],+ )+ @mock.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.source.validate_ownerrez_credentials"+ )+ def test_validate_credentials(self, mock_validate, mock_return, expected_valid, expected_message):+ mock_validate.return_value = mock_return++ is_valid, error_message = self.source.validate_credentials(self.config, self.team_id)++ assert is_valid is expected_valid+ assert error_message == expected_message+ mock_validate.assert_called_once_with("[email protected]", "pt_key")++ def test_get_resumable_source_manager_bound_to_resume_config(self):+ inputs = mock.MagicMock()+ manager = self.source.get_resumable_source_manager(inputs)+ assert manager._data_class is OwnerRezResumeConfig++ @mock.patch("products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.source.ownerrez_source")+ def test_source_for_pipeline_plumbs_arguments(self, mock_ownerrez_source):+ inputs = mock.MagicMock()+ inputs.schema_name = "Bookings"+ inputs.should_use_incremental_field = True+ inputs.db_incremental_field_last_value = "2026-01-01T00:00:00Z"+ manager = mock.MagicMock()++ self.source.source_for_pipeline(self.config, manager, inputs)++ mock_ownerrez_source.assert_called_once()+ kwargs = mock_ownerrez_source.call_args.kwargs+ assert kwargs["email"] == "[email protected]"+ assert kwargs["api_key"] == "pt_key"+ assert kwargs["endpoint"] == "Bookings"+ assert kwargs["resumable_source_manager"] is manager+ assert kwargs["db_incremental_field_last_value"] == "2026-01-01T00:00:00Z"++ @mock.patch("products.warehouse_sources.backend.temporal.data_imports.sources.ownerrez.source.ownerrez_source")+ def test_source_for_pipeline_omits_cursor_when_not_incremental(self, mock_ownerrez_source):+ inputs = mock.MagicMock()+ inputs.schema_name = "Properties"+ inputs.should_use_incremental_field = False+ inputs.db_incremental_field_last_value = "2026-01-01T00:00:00Z"++ self.source.source_for_pipeline(self.config, mock.MagicMock(), inputs)++ assert mock_ownerrez_source.call_args.kwargs["db_incremental_field_last_value"] is None