: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(batch-exports): export hogql timestamps in utc by default (#114452)
Ross817e4f8a7ba4
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex e1303fc2deb8..66b34e3d3521 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -9199,9 +9199,9 @@ snapshots:scenes-app-batchexports--existing-big-query-export--light:hash: v1.k794b7964.169c050ced77823af76847e5b432e37172733b51a52fa3e4046ab9ef586d40eb.QA_BL0dNaL6VSVaB5YMB03s3-F4U4WQjVKyOY_xGux4scenes-app-batchexports--existing-hog-ql-export--dark:- hash: v1.k794b7964.3028ec55dc1e12c741fcd70a26fc5c7de9ebdba0e25ce909d3d17b9d823896aa.KMHqAyH_LdiZxc6OBJ6bfU46OuxzGVrwR6rtpCwMb4g+ hash: v1.k794b7964.ae73ef2888f5c209b7e1789309a645a3b48e2411233aac2b8b4baaa2ee26ad7e.UMVhqMnhbqynOwjMErasjzgxUgAwrfFHEU_7kb4jU1Escenes-app-batchexports--existing-hog-ql-export--light:- hash: v1.k794b7964.4f1f050474ec4cf054d9e54877efb256cfeb204c9499231f7d0fde886cfac23a.s2E5rLFxdqHeoXrEIrMLGVICQM_7O8WKx-4qjyeEvsM+ hash: v1.k794b7964.2b4ff50f30637348e5f0f146eb583d58e1ecb75a2a56b10ad68f7803ecd3791e.SYr_Y2YmSoybLbU4lEnN_3Cf6BVzTuxFrVQ1tupHaiQscenes-app-batchexports--history-empty--dark:hash: v1.k794b7964.4876ed69bc9129528181a8a663b41e0fb1350b95e3f3a6077a9db2857b081cc4.N_l9zIvhsX-G07IjsNfoWtmuyYaV-o88xTxZz3_w4rMscenes-app-batchexports--history-empty--light:diff --git a/frontend/src/scenes/data-pipelines/batch-exports/BatchExportQueryTimezoneSelector.tsx b/frontend/src/scenes/data-pipelines/batch-exports/BatchExportQueryTimezoneSelector.tsxindex d2d59c724da6..c9c0d3b01366 100644--- a/frontend/src/scenes/data-pipelines/batch-exports/BatchExportQueryTimezoneSelector.tsx+++ b/frontend/src/scenes/data-pipelines/batch-exports/BatchExportQueryTimezoneSelector.tsx@@ -12,11 +12,18 @@ export function BatchExportQueryTimezoneSelector(): JSX.Element {const formLogic = useMountedLogic(batchExportConfigFormLogic)const { configurationErrors } = useValues(formLogic)const logic = batchExportHogQLQueryLogic(formLogic.props)- const { projectTimezone, defaultTimezone, teamConvertToProjectTimezone, queryTimezoneChoice } = useValues(logic)+ const { projectTimezone, followsProjectModifier, queryTimezoneChoice } = useValues(logic)const { setQueryTimezone } = useActions(logic)let help: React.ReactNode = null- if (queryTimezoneChoice === 'project_timezone') {+ if (followsProjectModifier) {+ help = (+ <>+ This export follows the project's <code>convertToProjectTimezone</code> modifier, which is set through+ the API. Choose an option to set the timezone for this export only.+ </>+ )+ } else if (queryTimezoneChoice === 'project_timezone') {help = (<>If the project timezone changes in{' '}@@ -26,18 +33,6 @@ export function BatchExportQueryTimezoneSelector(): JSX.Element {, this export uses the new timezone from its next run.</>)- } else if (queryTimezoneChoice === 'default' && teamConvertToProjectTimezone === null) {- help =- 'The default is the project timezone. If the default or the project timezone changes, this export uses the new one from its next run.'- } else if (queryTimezoneChoice === 'default') {- help = (- <>- This project's <code>convertToProjectTimezone</code> modifier was set to{' '}- <code>{String(teamConvertToProjectTimezone)}</code> through the API, so the default is{' '}- <span>{teamConvertToProjectTimezone ? 'the project timezone' : 'UTC'}</span>. If it changes, this export- uses the new default from its next run.- </>- )}return (@@ -55,11 +50,10 @@ export function BatchExportQueryTimezoneSelector(): JSX.Element {<LemonSelect<QueryTimezoneChoice>fullWidthvalue={queryTimezoneChoice}- onChange={setQueryTimezone}+ onSelect={setQueryTimezone}options={[- { value: 'default', label: `Use default (${defaultTimezone})` },- { value: 'utc', label: 'Always use UTC' },- { value: 'project_timezone', label: `Always use project timezone (${projectTimezone})` },+ { value: 'utc', label: 'UTC' },+ { value: 'project_timezone', label: `Project timezone (${projectTimezone})` },]}data-attr="batch-export-hogql-query-timezone"/>diff --git a/frontend/src/scenes/data-pipelines/batch-exports/batchExportHogQLQueryLogic.test.ts b/frontend/src/scenes/data-pipelines/batch-exports/batchExportHogQLQueryLogic.test.tsindex 72fe11abdfdb..93d6cb7cb037 100644--- a/frontend/src/scenes/data-pipelines/batch-exports/batchExportHogQLQueryLogic.test.ts+++ b/frontend/src/scenes/data-pipelines/batch-exports/batchExportHogQLQueryLogic.test.ts@@ -99,67 +99,71 @@ describe('batchExportHogQLQueryLogic', () => {initKeaTests()})- // The backend resolves `convertToProjectTimezone` from the export's modifiers, then `team.modifiers`, then- // `true`. The form label and the preview's placeholder timezone must follow the same order. If the logic skips- // `team.modifiers`, a team that turned the modifier off through the API sees its project timezone in the form- // while its exports run in UTC.+ // HogQL batch exports resolve `convertToProjectTimezone` from the export's modifiers, then `team.modifiers`, then+ // `false`. The selected option, the preview's placeholder timezone and the modifiers the preview runs with must+ // follow the same order. The preview runs through the query API, which falls back to `true`, so it needs the+ // resolved value, or it shows project-timezone rows for an export that writes UTC. Showing a saved export must not+ // write to its modifiers, or opening it would mark the form as changed.test.each<- [string, HogQLQueryModifiers | undefined, HogQLQueryModifiers | null, QueryTimezoneChoice, string, string]+ [string, HogQLQueryModifiers | undefined, HogQLQueryModifiers | null, QueryTimezoneChoice, string, boolean]>([- ['the team leaves it unset', undefined, null, 'default', PROJECT_TIMEZONE, PROJECT_TIMEZONE],- ['the team turns it off', { convertToProjectTimezone: false }, null, 'default', 'UTC', 'UTC'],+ ['nothing sets it', undefined, null, 'utc', 'UTC', false],+ ['the team turns it on', { convertToProjectTimezone: true }, null, 'project_timezone', PROJECT_TIMEZONE, true],+ ['the team turns it off', { convertToProjectTimezone: false }, null, 'utc', 'UTC', true],['the export turns it on over the team',{ convertToProjectTimezone: false },{ convertToProjectTimezone: true },'project_timezone',- 'UTC',PROJECT_TIMEZONE,+ false,],[- 'the export turns it off over the default',- undefined,+ 'the export turns it off over the team',+ { convertToProjectTimezone: true },{ convertToProjectTimezone: false },'utc',- PROJECT_TIMEZONE,'UTC',+ false,],])('resolves the query timezone when %s',- async (_, teamModifiers, exportModifiers, choice, defaultTimezone, queryTimezone) => {+ async (_, teamModifiers, exportModifiers, choice, queryTimezone, followsProjectModifier) => {await initLogic(teamModifiers, exportModifiers)await expectLogic(logic).toMatchValues({queryTimezoneChoice: choice,- defaultTimezone,queryTimezone,+ followsProjectModifier,})const { start, end } = logic.values.previewIntervalexpect(editorLogic().values.placeholders.map((placeholder) => placeholder.previewValue)).toEqual([start.tz(queryTimezone).format('YYYY-MM-DD HH:mm:ss'),end.tz(queryTimezone).format('YYYY-MM-DD HH:mm:ss'),])+ expect(editorLogic().values.queryModifiers?.convertToProjectTimezone).toBe(queryTimezone !== 'UTC')+ expect(formLogic.values.configuration.hogql_modifiers).toEqual(exportModifiers)})// The form controls only `convertToProjectTimezone`. Other keys can come from the API, and the backend replaces- // the whole `hogql_modifiers` object on save, so changing the choice must keep them. The editor must get the- // same modifiers, or the preview runs with different settings from the export.- test.each<[string, HogQLQueryModifiers | null, QueryTimezoneChoice, HogQLQueryModifiers | null]>([- [- 'keeps other modifiers when it unsets the key',- { personsOnEventsMode: 'person_id_override_properties_joined', convertToProjectTimezone: false },- 'default',- { personsOnEventsMode: 'person_id_override_properties_joined' },- ],- ['clears the modifiers once no key is left', { convertToProjectTimezone: false }, 'default', null],+ // the whole `hogql_modifiers` object on save, so changing the choice must keep them. Each choice saves an explicit+ // value, so the select always shows what the export does. The editor must get the same modifiers, or the preview+ // runs with different settings from the export.+ test.each<[string, HogQLQueryModifiers | null, QueryTimezoneChoice, HogQLQueryModifiers]>([['keeps other modifiers when it sets the key',{ personsOnEventsMode: 'person_id_override_properties_joined' },'project_timezone',{ personsOnEventsMode: 'person_id_override_properties_joined', convertToProjectTimezone: true },],- ['adds the key when there are no modifiers', null, 'utc', { convertToProjectTimezone: false }],+ [+ 'saves UTC as false rather than removing the key',+ { convertToProjectTimezone: true },+ 'utc',+ { convertToProjectTimezone: false },+ ],+ ['saves the option the export already resolves to', null, 'utc', { convertToProjectTimezone: false }],])('setQueryTimezone %s', async (_, exportModifiers, choice, expectedModifiers) => {await initLogic(undefined, exportModifiers)@@ -170,8 +174,6 @@ describe('batchExportHogQLQueryLogic', () => {expect(editorLogic().values.queryModifiers).toEqual(expectedModifiers)})- // The form saves `hogql_query`, so it must match what the editor shows. A form reset, such as "Clear changes",- // must also reach the editor, or the editor keeps text that the form no longer holds.it('copies editor changes into the form', async () => {await initLogic(undefined, null)@@ -204,12 +206,13 @@ describe('batchExportHogQLQueryLogic', () => {expect(editorLogic().values.placeholders).not.toEqual(hourlyPlaceholders)})- it('starts a new export with the default query in both the editor and the form', async () => {+ it('starts a new export with the default query and an explicit UTC timezone', async () => {const newExportProps: BatchExportConfigFormLogicProps = { id: null, service: 'AwsS3' }await initLogic(undefined, null, newExportProps)const queryInput = editorLogic(newExportProps).values.queryInputexpect(queryInput).toContain('{data_interval_start}')expect(formLogic.values.configuration.hogql_query).toEqual(queryInput)+ expect(formLogic.values.configuration.hogql_modifiers).toEqual({ convertToProjectTimezone: false })})})diff --git a/frontend/src/scenes/data-pipelines/batch-exports/batchExportHogQLQueryLogic.ts b/frontend/src/scenes/data-pipelines/batch-exports/batchExportHogQLQueryLogic.tsindex 07bd77bd59b7..0535a99bbb84 100644--- a/frontend/src/scenes/data-pipelines/batch-exports/batchExportHogQLQueryLogic.ts+++ b/frontend/src/scenes/data-pipelines/batch-exports/batchExportHogQLQueryLogic.ts@@ -45,8 +45,7 @@ WHERE timestamp >= {${DATA_INTERVAL_START_PLACEHOLDER}}// ClickHouse cannot parse a datetime string with a UTC offset.const PLACEHOLDER_VALUE_FORMAT = 'YYYY-MM-DD HH:mm:ss'-/** 'default' leaves `convertToProjectTimezone` unset, so the export follows the project's default. */-export type QueryTimezoneChoice = 'default' | 'project_timezone' | 'utc'+export type QueryTimezoneChoice = 'project_timezone' | 'utc'export function batchExportHogQLEditorTabId({ id, service }: BatchExportConfigFormLogicProps): string {return `batch-export-hogql-${id ?? `new-${service}`}`@@ -58,7 +57,9 @@ export interface batchExportHogQLQueryLogicValues {queryInput: string | null // sqlEditorLogiccurrentTeam: TeamPublicType | TeamType | null // teamLogicprojectTimezone: string // teamLogic- defaultTimezone: string+ convertsToProjectTimezone: boolean+ editorModifiers: HogQLQueryModifiers+ followsProjectModifier: booleanhogqlModifiers: HogQLQueryModifiers | nullplaceholders: SQLEditorPlaceholder[]previewEnd: string@@ -132,18 +133,21 @@ export interface batchExportHogQLQueryLogicMeta {}__keaTypeGenInternalSelectorTypes: {hogqlModifiers: (configuration: Record<string, any>) => HogQLQueryModifiers | null- queryTimezoneChoice: (hogqlModifiers: HogQLQueryModifiers | null) => QueryTimezoneChoiceteamConvertToProjectTimezone: (currentTeam: TeamPublicType | TeamType | null) => boolean | null- defaultTimezone: (- teamConvertToProjectTimezone: boolean | null,- currentTeam: TeamPublicType | TeamType | null,- projectTimezone: string- ) => string- queryTimezone: (- queryTimezoneChoice: QueryTimezoneChoice,- defaultTimezone: string,- projectTimezone: string- ) => string+ convertsToProjectTimezone: (+ hogqlModifiers: HogQLQueryModifiers | null,+ teamConvertToProjectTimezone: boolean | null+ ) => boolean+ followsProjectModifier: (+ hogqlModifiers: HogQLQueryModifiers | null,+ teamConvertToProjectTimezone: boolean | null+ ) => boolean+ queryTimezoneChoice: (convertsToProjectTimezone: boolean) => QueryTimezoneChoice+ queryTimezone: (convertsToProjectTimezone: boolean, projectTimezone: string) => string+ editorModifiers: (+ hogqlModifiers: HogQLQueryModifiers | null,+ convertsToProjectTimezone: boolean+ ) => HogQLQueryModifiersscheduleInterval: (configuration: Record<string, any>) => BatchExportIntervalscheduleTimezone: (configuration: Record<string, any>) => string | nullscheduleOffsetDay: (configuration: Record<string, any>) => number | null@@ -207,38 +211,46 @@ export const batchExportHogQLQueryLogic: LogicWrapper<batchExportHogQLQueryLogic(configuration: Record<string, any>): HogQLQueryModifiers | null =>configuration.hogql_modifiers ?? null,],- queryTimezoneChoice: [- (s) => [s.hogqlModifiers],- (hogqlModifiers: HogQLQueryModifiers | null): QueryTimezoneChoice => {- const convertToProjectTimezone = hogqlModifiers?.convertToProjectTimezone- if (convertToProjectTimezone === undefined || convertToProjectTimezone === null) {- return 'default'- }- return convertToProjectTimezone ? 'project_timezone' : 'utc'- },- ],// Only the API sets the team's modifier, so a value here means someone chose it on purposeteamConvertToProjectTimezone: [(s) => [s.currentTeam],(currentTeam: TeamType | TeamPublicType | null): boolean | null =>currentTeam?.modifiers?.convertToProjectTimezone ?? null,],- // The backend fills in `true` when neither the project nor its defaults set a value- defaultTimezone: [- (s) => [s.teamConvertToProjectTimezone, s.currentTeam, s.projectTimezone],- (- teamConvertToProjectTimezone: boolean | null,- currentTeam: TeamType | TeamPublicType | null,- projectTimezone: string- ): string =>- (teamConvertToProjectTimezone ?? currentTeam?.default_modifiers?.convertToProjectTimezone ?? true)- ? projectTimezone- : 'UTC',+ // An export without its own value follows the project modifier, and HogQL batch exports fall back to+ // UTC, unlike other queries, which fall back to the project timezone+ convertsToProjectTimezone: [+ (s) => [s.hogqlModifiers, s.teamConvertToProjectTimezone],+ (hogqlModifiers: HogQLQueryModifiers | null, teamConvertToProjectTimezone: boolean | null): boolean =>+ hogqlModifiers?.convertToProjectTimezone ?? teamConvertToProjectTimezone ?? false,+ ],+ followsProjectModifier: [+ (s) => [s.hogqlModifiers, s.teamConvertToProjectTimezone],+ (hogqlModifiers: HogQLQueryModifiers | null, teamConvertToProjectTimezone: boolean | null): boolean =>+ (hogqlModifiers?.convertToProjectTimezone ?? null) === null &&+ teamConvertToProjectTimezone !== null,+ ],+ queryTimezoneChoice: [+ (s) => [s.convertsToProjectTimezone],+ (convertsToProjectTimezone: boolean): QueryTimezoneChoice =>+ convertsToProjectTimezone ? 'project_timezone' : 'utc',],queryTimezone: [- (s) => [s.queryTimezoneChoice, s.defaultTimezone, s.projectTimezone],- (choice: QueryTimezoneChoice, defaultTimezone: string, projectTimezone: string): string =>- choice === 'default' ? defaultTimezone : choice === 'project_timezone' ? projectTimezone : 'UTC',+ (s) => [s.convertsToProjectTimezone, s.projectTimezone],+ (convertsToProjectTimezone: boolean, projectTimezone: string): string =>+ convertsToProjectTimezone ? projectTimezone : 'UTC',+ ],+ // The preview runs through the query API, which falls back to the project timezone, so it gets the+ // resolved value+ editorModifiers: [+ (s) => [s.hogqlModifiers, s.convertsToProjectTimezone],+ (+ hogqlModifiers: HogQLQueryModifiers | null,+ convertsToProjectTimezone: boolean+ ): HogQLQueryModifiers => ({+ ...hogqlModifiers,+ convertToProjectTimezone: convertsToProjectTimezone,+ }),],scheduleInterval: [(s) => [s.configuration],@@ -327,13 +339,10 @@ export const batchExportHogQLQueryLogic: LogicWrapper<batchExportHogQLQueryLogiclisteners(({ actions, values, sharedListeners }) => ({setQueryTimezone: ({ choice }) => {// Only this key changes, so modifiers set through the API survive a save from the form- const next: HogQLQueryModifiers = { ...values.hogqlModifiers }- if (choice === 'default') {- delete next.convertToProjectTimezone- } else {- next.convertToProjectTimezone = choice === 'project_timezone'- }- actions.setConfigurationValue('hogql_modifiers', Object.keys(next).length > 0 ? next : null)+ actions.setConfigurationValue('hogql_modifiers', {+ ...values.hogqlModifiers,+ convertToProjectTimezone: choice === 'project_timezone',+ })},setQueryInput: ({ queryInput }) => {if (queryInput !== null && queryInput !== values.configuration.hogql_query) {@@ -348,9 +357,16 @@ export const batchExportHogQLQueryLogic: LogicWrapper<batchExportHogQLQueryLogic})),subscriptions(({ actions }) => ({placeholders: (placeholders: SQLEditorPlaceholder[]) => actions.setPlaceholders(placeholders),- hogqlModifiers: (hogqlModifiers: HogQLQueryModifiers | null) => actions.setQueryModifiers(hogqlModifiers),+ editorModifiers: (editorModifiers: HogQLQueryModifiers) => actions.setQueryModifiers(editorModifiers),})),- afterMount(({ actions, values }) => {+ afterMount(({ actions, values, props }) => {+ // A new export saves its timezone, so the select always shows what the export does+ if (!props.id && (values.hogqlModifiers?.convertToProjectTimezone ?? null) === null) {+ actions.setConfigurationValue('hogql_modifiers', {+ ...values.hogqlModifiers,+ convertToProjectTimezone: false,+ })+ }if (values.queryInput !== null) {return}diff --git a/products/batch_exports/backend/hogql_source.py b/products/batch_exports/backend/hogql_source.pyindex bd891b703859..97dc4f4ba9c1 100644--- a/products/batch_exports/backend/hogql_source.py+++ b/products/batch_exports/backend/hogql_source.py@@ -137,6 +137,22 @@ def validate_hogql_batch_export_user(team: "Team", user: "User | None") -> None:)+def apply_hogql_batch_export_modifier_defaults(+ team: "Team", modifiers: HogQLQueryModifiers | None+) -> HogQLQueryModifiers:+ """Return the export's modifiers with the defaults that apply to the `hogql` model only.++ `convertToProjectTimezone` falls back to `False`, so timestamps come out in UTC unless the export+ or the project sets the modifier. Other models keep the project default, so their output does+ not change.+ """+ resolved = modifiers.model_copy() if modifiers is not None else HogQLQueryModifiers()+ team_value = team.modifiers.get("convertToProjectTimezone") if isinstance(team.modifiers, dict) else None+ if resolved.convertToProjectTimezone is None and team_value is None:+ resolved.convertToProjectTimezone = False+ return resolved++def create_hogql_context_for_batch_export(team: "Team",values: dict[str, typing.Any] | None = None,@@ -211,7 +227,9 @@ def validate_hogql_query_for_batch_export(parsed = replace_interval_placeholders(parsed, _VALIDATION_DATA_INTERVAL_START, _VALIDATION_DATA_INTERVAL_END)- context = create_hogql_context_for_batch_export(team, user=user, modifiers=modifiers)+ context = create_hogql_context_for_batch_export(+ team, user=user, modifiers=apply_hogql_batch_export_modifier_defaults(team, modifiers)+ )try:prepared = prepare_ast_for_printing(parsed, context=context, dialect="clickhouse", stack=[])assert prepared is not Nonediff --git a/products/batch_exports/backend/presentation/views/file_download.py b/products/batch_exports/backend/presentation/views/file_download.pyindex dfe9b59a71c9..6c586838f31d 100644--- a/products/batch_exports/backend/presentation/views/file_download.py+++ b/products/batch_exports/backend/presentation/views/file_download.py@@ -36,6 +36,7 @@ from posthog.temporal.common.client import sync_connectfrom products.batch_exports.backend.hogql_source import (UnsupportedHogQLQueryError,+ apply_hogql_batch_export_modifier_defaults,find_interval_placeholders,load_hogql_modifiers,parse_hogql_select_for_batch_export,@@ -282,7 +283,7 @@ def count_rows_for_hogql_batch_export(user=user,query_type="HogQLBatchExportCountRowsQuery",settings=query_settings,- modifiers=modifiers,+ modifiers=apply_hogql_batch_export_modifier_defaults(team, modifiers),)return query_response.results[0][0] if query_response.results else 0diff --git a/products/batch_exports/backend/presentation/views/utils.py b/products/batch_exports/backend/presentation/views/utils.pyindex 5149236d675f..f046c71ff4e1 100644--- a/products/batch_exports/backend/presentation/views/utils.py+++ b/products/batch_exports/backend/presentation/views/utils.py@@ -11,10 +11,12 @@ from posthog.schema import HogQLQueryModifiersfrom posthog.models import TeamHOGQL_MODIFIERS_HELP_TEXT = (- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. "- "Each modifier set here overrides the project modifier with the same name, and the project "- "modifiers apply to all others. For example, set convertToProjectTimezone to false to export "- "timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example "+ "{\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here "+ "overrides the project modifier with the same name, and the project modifiers apply to all others. If neither "+ "sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to "+ "export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object "+ "replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all.")diff --git a/products/batch_exports/backend/temporal/record_batch_model.py b/products/batch_exports/backend/temporal/record_batch_model.pyindex a67938b0723a..5e7093c5f169 100644--- a/products/batch_exports/backend/temporal/record_batch_model.py+++ b/products/batch_exports/backend/temporal/record_batch_model.py@@ -25,6 +25,7 @@ from posthog.temporal.common.logger import get_write_only_loggerfrom products.batch_exports.backend.hogql_source import (DATA_INTERVAL_END_PLACEHOLDER,UnsupportedHogQLQueryError,+ apply_hogql_batch_export_modifier_defaults,create_hogql_context_for_batch_export,find_interval_placeholders,load_hogql_modifiers,@@ -395,7 +396,10 @@ class HogQLQueryRecordBatchModel(RecordBatchModel):user = await User.objects.filter(pk=self.user_id).afirst()await database_sync_to_async(validate_hogql_batch_export_user)(team, user)context = await database_sync_to_async(create_hogql_context_for_batch_export)(- team, user=user, values={"log_comment": self.get_log_comment()}, modifiers=self.hogql_modifiers+ team,+ user=user,+ values={"log_comment": self.get_log_comment()},+ modifiers=apply_hogql_batch_export_modifier_defaults(team, self.hogql_modifiers),)# Pinned here rather than resolved in `get_clickhouse_request_settings`, which is sync and runs on# the event loop where a database read is not allowed.diff --git a/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_api.py b/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_api.pyindex 5f43262412c1..f890369d8ec2 100644--- a/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_api.py+++ b/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_api.py@@ -1045,6 +1045,43 @@ class TestFileDownloadHogQL:assert response.status_code == status.HTTP_200_OK, response.json()assert response.json() == {"count": expected_count}+ @pytest.mark.parametrize(+ "hogql_modifiers,expected_count",+ [(None, 10), ({"convertToProjectTimezone": True}, 0)],+ ids=["utc-by-default", "project-timezone-from-modifier"],+ )+ @pytest.mark.usefixtures("enable_hogql_flag", "hogql_export_test_events")+ @pytest.mark.django_db(transaction=True)+ async def test_count_rows_uses_the_export_timezone(+ self, async_client: AsyncClient, team, user, hogql_modifiers, expected_count+ ):+ """Count rows in the timezone the export runs in, which can differ from the project timezone.++ The project is in Asia/Tokyo, and the query keeps rows whose timestamp formats with a `+0000` offset.+ HogQL passes the query timezone to `formatDateTime` as its last argument, so `%z` gives the offset of+ the timezone the count ran in: `+0000` in UTC and `+0900` in Tokyo.++ With no modifier, the count runs in UTC like the export, so it keeps all 10 rows. With+ `convertToProjectTimezone` set to true, it runs in Tokyo and keeps none. If the count ignored the+ export default, the first case would count 0 rows while the download exports 10.+ """+ team.timezone = "Asia/Tokyo"+ await team.asave()+ await async_client.aforce_login(user)++ response = await async_client.post(+ f"/api/projects/{team.pk}/file_download_batch_exports/count_rows",+ {+ "model": "hogql",+ "hogql_query": "SELECT event AS event FROM events WHERE formatDateTime(timestamp, '%z') = '+0000'",+ **({"hogql_modifiers": hogql_modifiers} if hogql_modifiers is not None else {}),+ },+ content_type="application/json",+ )++ assert response.status_code == status.HTTP_200_OK, response.json()+ assert response.json() == {"count": expected_count}+@pytest.mark.usefixtures("enable_hogql_flag")@pytest.mark.django_db(transaction=True)async def test_count_rows_masks_properties_in_where(diff --git a/products/batch_exports/backend/tests/temporal/test_record_batch_model.py b/products/batch_exports/backend/tests/temporal/test_record_batch_model.pyindex 095361b44017..8e2d9a3cdd9a 100644--- a/products/batch_exports/backend/tests/temporal/test_record_batch_model.py+++ b/products/batch_exports/backend/tests/temporal/test_record_batch_model.py@@ -548,13 +548,20 @@ class TestHogQLQueryRecordBatchModel:assert record_batch_model.wait_for_data_interval_end is True@pytest.mark.parametrize(- "hogql_modifiers,converts_timezone",- [(None, True), ({"convertToProjectTimezone": False}, False)],- ids=["team-modifiers", "export-modifiers"],+ "team_modifiers,hogql_modifiers,converts_timezone",+ [+ (None, None, False),+ ({"convertToProjectTimezone": True}, None, True),+ (None, {"convertToProjectTimezone": True}, True),+ ({"convertToProjectTimezone": True}, {"convertToProjectTimezone": False}, False),+ ],+ ids=["utc-by-default", "team-modifier", "export-modifier", "export-overrides-team"],)async def test_resolved_model_prints_query_with_stored_modifiers(- self, ateam, auser, data_interval_start, data_interval_end, hogql_modifiers, converts_timezone+ self, ateam, auser, data_interval_start, data_interval_end, team_modifiers, hogql_modifiers, converts_timezone):+ ateam.modifiers = team_modifiers+ await ateam.asave()batch_export_model = BatchExportModel(name="hogql",schema=None,diff --git a/products/batch_exports/backend/tests/test_hogql_source.py b/products/batch_exports/backend/tests/test_hogql_source.pyindex 92812d30d258..6620ce63e029 100644--- a/products/batch_exports/backend/tests/test_hogql_source.py+++ b/products/batch_exports/backend/tests/test_hogql_source.py@@ -152,6 +152,12 @@ def test_create_hogql_context_for_batch_exports()+def test_context_without_hogql_defaults_keeps_the_project_timezone(team) -> None:+ context = create_hogql_context_for_batch_export(team)++ assert context.modifiers.convertToProjectTimezone is True++def test_load_hogql_modifiers_rejects_invalid_values() -> None:with pytest.raises(UnsupportedHogQLQueryError, match="Invalid HogQL modifiers"):load_hogql_modifiers({"personsOnEventsMode": "not_a_mode"})diff --git a/products/batch_exports/frontend/generated/api.schemas.ts b/products/batch_exports/frontend/generated/api.schemas.tsindex c4e970e31ff7..cc488b17dd13 100644--- a/products/batch_exports/frontend/generated/api.schemas.ts+++ b/products/batch_exports/frontend/generated/api.schemas.ts@@ -921,7 +921,7 @@ export interface BatchExportApi {* @nullable*/hogql_query?: string | null- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiersApi | null/** A schema of custom fields to select when exporting data. */readonly schema: unknown@@ -1730,7 +1730,7 @@ export interface BatchExportRequestApi {* @nullable*/hogql_query?: string | null- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiersApi | null/** Optional list of property filters to restrict which events are exported. Each filter is a serialized HogQL property filter object with a 'type' of one of: 'event', 'hogql', 'person' (e.g. {"key": "$browser", "operator": "exact", "type": "event", "value": ["Firefox"]}). */filters?: unknown@@ -1896,7 +1896,7 @@ export interface PatchedBatchExportRequestApi {* @nullable*/hogql_query?: string | null- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiersApi | null/** Optional list of property filters to restrict which events are exported. Each filter is a serialized HogQL property filter object with a 'type' of one of: 'event', 'hogql', 'person' (e.g. {"key": "$browser", "operator": "exact", "type": "event", "value": ["Firefox"]}). */filters?: unknown@@ -2049,7 +2049,7 @@ export interface FileDownloadHogQLRequestApi {model: FileDownloadHogQLRequestApiModel/** HogQL SELECT query whose results are exported. This model is in closed beta and is enabled per team; when it is not enabled, the request fails with a permission error that names HogQL batch exports. Contact PostHog support to request access. The query may reference the {data_interval_start} and {data_interval_end} placeholders. Provide a value for each placeholder the query references; missing referenced bounds are rejected, not inferred. When both bounds are supplied, they must span at most seven days. Neither supplied bound may be in the future. Without placeholders, the query runs unchanged, even if bounds are supplied. Every column in the SELECT clause must be a field or have an alias. It is recommended to limit the query with a WHERE clause, for example bounding timestamp on the events table, both to avoid exporting more rows than expected and because user queries run under stricter resource limits than the other models. */hogql_query: string- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiersApi/** Start of the export interval. Required for the events, persons, and sessions models. For HogQL, required only when the query references {data_interval_start}. A supplied start must not be in the future. When both bounds are supplied, the interval must span at most seven days. */data_interval_start?: string@@ -2150,7 +2150,7 @@ export interface FileDownloadCountRowsRequestApi {model: FileDownloadHogQLModelEnumApi/** HogQL SELECT query whose results are exported. This model is in closed beta and is enabled per team; when it is not enabled, the request fails with a permission error that names HogQL batch exports. Contact PostHog support to request access. The query may reference the {data_interval_start} and {data_interval_end} placeholders. Provide a value for each placeholder the query references; missing referenced bounds are rejected, not inferred. When both bounds are supplied, they must span at most seven days. Neither supplied bound may be in the future. Without placeholders, the query runs unchanged, even if bounds are supplied. Every column in the SELECT clause must be a field or have an alias. It is recommended to limit the query with a WHERE clause, for example bounding timestamp on the events table, both to avoid exporting more rows than expected and because user queries run under stricter resource limits than the other models. */hogql_query: string- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiersApi/** Start of the export interval. Required for the events, persons, and sessions models. For HogQL, required only when the query references {data_interval_start}. A supplied start must not be in the future. When both bounds are supplied, the interval must span at most seven days. */data_interval_start?: stringdiff --git a/products/batch_exports/frontend/generated/api.zod.ts b/products/batch_exports/frontend/generated/api.zod.tsindex aae8faab59e9..0f0c3c0c68f0 100644--- a/products/batch_exports/frontend/generated/api.zod.ts+++ b/products/batch_exports/frontend/generated/api.zod.ts@@ -682,7 +682,7 @@ export const BatchExportsCreateBody = /* @__PURE__ */ zod]).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),filters: zod.unknown()@@ -1633,7 +1633,7 @@ export const BatchExportsUpdateBody = /* @__PURE__ */ zod]).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),filters: zod.unknown()@@ -2343,7 +2343,7 @@ export const BatchExportsPartialUpdateBody = /* @__PURE__ */ zod]).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),filters: zod.unknown()@@ -3038,7 +3038,7 @@ export const BatchExportsRunTestStepCreateBody = /* @__PURE__ */ zod]).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),filters: zod.unknown().optional(),timezone: zod@@ -3752,7 +3752,7 @@ export const BatchExportsRunTestStepNewCreateBody = /* @__PURE__ */ zod]).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),filters: zod.unknown().optional(),timezone: zod@@ -4181,7 +4181,7 @@ export const FileDownloadBatchExportsCreateBody = /* @__PURE__ */ zod.union([}).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),data_interval_start: zod.iso.datetime({ offset: true })@@ -4433,7 +4433,7 @@ export const FileDownloadBatchExportsCountRowsCreateBody = /* @__PURE__ */ zod}).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),data_interval_start: zod.iso.datetime({ offset: true })diff --git a/products/batch_exports/mcp/tools.yaml b/products/batch_exports/mcp/tools.yamlindex 5cd5ea5882aa..194c04ee7dbc 100644--- a/products/batch_exports/mcp/tools.yaml+++ b/products/batch_exports/mcp/tools.yaml@@ -23,8 +23,9 @@ tools:credentials. Use integrations-list to find one and pass its ID as destination.integration_id. Always specifythe model field (events, persons, sessions, or hogql). Omitting it defaults to events. For the hogql model,provide hogql_query. Optionally provide hogql_modifiers, which override the project HogQL modifiers with the- same names for this export only, for example {"convertToProjectTimezone": false} to export timestamps in- UTC.+ same names for this export only. Timestamps are exported in UTC unless the export or the project sets+ convertToProjectTimezone, for example {"convertToProjectTimezone": true} to export them in the project+ timezone.exclude_params:- id- team_id@@ -75,9 +76,12 @@ tools:description: >Partially update a batch export. Top-level fields (name, paused, interval, timezone, offset_day,offset_hour) work for any destination type. For the hogql model, hogql_query and hogql_modifiers can also- change; send hogql_modifiers as null to remove them. Typed destination config updates are available for- Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. The destination- type cannot be changed. Do not change the model field on an existing batch export.+ change. hogql_modifiers replaces the stored object rather than merging into it, so read the current value+ with batch-export-get and send every modifier to keep, or send null to remove them all. Timestamps are+ exported in UTC unless the export or the project sets convertToProjectTimezone to true. Typed destination+ config updates are available for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake,+ and Redshift. The destination type cannot be changed. Do not change the model field on an existing batch+ export.exclude_params:- id- team_id@@ -165,14 +169,15 @@ tools:exclude filter event names. The hogql model is in closed beta and is enabled per team: it takes ahogql_query, which can reference the {data_interval_start} and {data_interval_end} placeholders filled fromdata_interval_start and data_interval_end, and optional hogql_modifiers, which override the project HogQL- modifiers with the same names. It returns a permission error naming HogQL batch exports when the team does- not have it enabled, in which case tell the user they can contact PostHog support to request access. Limit- hogql_query with a WHERE clause to export only the data the user asked for, because user queries run under- stricter resource limits than the other models. The export splits into files of about 1024 MiB by default,- and a file can go a little over; set file.max_size_mb to change that size, or to null to write a single file- of any size. Use file-download-batch-exports-retrieve with the returned id to poll until status is- Completed, then follow the downloading-batch-export-files skill to download the files through the existing- REST download endpoint.+ modifiers with the same names. Timestamps are exported in UTC unless the export or the project sets+ convertToProjectTimezone, for example {"convertToProjectTimezone": true} to export them in the project+ timezone. It returns a permission error naming HogQL batch exports when the team does not have it enabled,+ in which case tell the user they can contact PostHog support to request access. Limit hogql_query with a+ WHERE clause to export only the data the user asked for, because user queries run under stricter resource+ limits than the other models. The export splits into files of about 1024 MiB by default, and a file can go a+ little over; set file.max_size_mb to change that size, or to null to write a single file of any size. Use+ file-download-batch-exports-retrieve with the returned id to poll until status is Completed, then follow the+ downloading-batch-export-files skill to download the files through the existing REST download endpoint.file-download-batch-exports-retrieve:operation: file_download_batch_exports_retrieveenabled: truediff --git a/products/batch_exports/skills/downloading-batch-export-files/SKILL.md b/products/batch_exports/skills/downloading-batch-export-files/SKILL.mdindex 80c05d1d3546..f435c9373ef3 100644--- a/products/batch_exports/skills/downloading-batch-export-files/SKILL.md+++ b/products/batch_exports/skills/downloading-batch-export-files/SKILL.md@@ -155,7 +155,7 @@ posthog-persons-<run_id>-<part>.parquet- The maximum export interval is one week. Split longer user requests into separate export runs or ask which week to export.- The `hogql` model is in closed beta and is enabled per team. A permission error that says HogQL batch exports are not enabled means the team does not have the beta. Report that instead of retrying with a different query, and tell the user they can contact PostHog support to request access.- The `hogql` model runs under stricter resource limits than the other models, because user queries are less predictable. If an export fails on memory, execution time, or bytes read, suggest narrowing the query with a WHERE clause instead of retrying it unchanged.-- The `hogql` model accepts an optional `hogql_modifiers` object. Each modifier in it overrides the project HogQL modifier with the same name for this export only, and the project modifiers apply to all others. By default, `timestamp` columns come out in the project timezone, so pass `{"convertToProjectTimezone": false}` when the user wants UTC timestamps. Pass the same `hogql_modifiers` to `posthog:file-download-batch-exports-count-rows-create`, so that the count matches the export.+- The `hogql` model accepts an optional `hogql_modifiers` object. Each modifier in it overrides the project HogQL modifier with the same name for this export only, and the project modifiers apply to all others. Unless the project sets the `convertToProjectTimezone` modifier, `timestamp` columns come out in UTC, so pass `{"convertToProjectTimezone": true}` when the user wants them in the project timezone. Pass the same `hogql_modifiers` to `posthog:file-download-batch-exports-count-rows-create`, so that the count matches the export.- A run can briefly report `Running` after completion while file records are being created. Poll again instead of failing immediately.- Download URLs are temporary. If a URL expires, call the REST download endpoint again for a fresh redirect.- Do not send the signed URL to unrelated services unless the user explicitly asks; it grants temporary access to the exported file.diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex cebad59992f4..3ba657a7b78e 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -1435,7 +1435,7 @@"feature_flag": "autoresearch"},"batch-export-create": {- "description": "Create a new batch export. This tool supports typed destination configs for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. All require a team-scoped integration for credentials. Use integrations-list to find one and pass its ID as destination.integration_id. Always specify the model field (events, persons, sessions, or hogql). Omitting it defaults to events. For the hogql model, provide hogql_query. Optionally provide hogql_modifiers, which override the project HogQL modifiers with the same names for this export only, for example {\"convertToProjectTimezone\": false} to export timestamps in UTC.",+ "description": "Create a new batch export. This tool supports typed destination configs for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. All require a team-scoped integration for credentials. Use integrations-list to find one and pass its ID as destination.integration_id. Always specify the model field (events, persons, sessions, or hogql). Omitting it defaults to events. For the hogql model, provide hogql_query. Optionally provide hogql_modifiers, which override the project HogQL modifiers with the same names for this export only. Timestamps are exported in UTC unless the export or the project sets convertToProjectTimezone, for example {\"convertToProjectTimezone\": true} to export them in the project timezone.","category": "Data pipelines","feature": "batch_exports","summary": "Create batch export",@@ -1477,7 +1477,7 @@}},"batch-export-update": {- "description": "Partially update a batch export. Top-level fields (name, paused, interval, timezone, offset_day, offset_hour) work for any destination type. For the hogql model, hogql_query and hogql_modifiers can also change; send hogql_modifiers as null to remove them. Typed destination config updates are available for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. The destination type cannot be changed. Do not change the model field on an existing batch export.",+ "description": "Partially update a batch export. Top-level fields (name, paused, interval, timezone, offset_day, offset_hour) work for any destination type. For the hogql model, hogql_query and hogql_modifiers can also change. hogql_modifiers replaces the stored object rather than merging into it, so read the current value with batch-export-get and send every modifier to keep, or send null to remove them all. Timestamps are exported in UTC unless the export or the project sets convertToProjectTimezone to true. Typed destination config updates are available for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. The destination type cannot be changed. Do not change the model field on an existing batch export.","category": "Data pipelines","feature": "batch_exports","summary": "Update batch export",@@ -6524,7 +6524,7 @@}},"file-download-batch-exports-create": {- "description": "Start an on-demand batch export that prepares downloadable files for events, persons, sessions, or the results of a HogQL query. For events, persons and sessions, provide data_interval_start and data_interval_end as ISO 8601 datetimes; the interval must be at most one week, and for events, include and exclude filter event names. The hogql model is in closed beta and is enabled per team: it takes a hogql_query, which can reference the {data_interval_start} and {data_interval_end} placeholders filled from data_interval_start and data_interval_end, and optional hogql_modifiers, which override the project HogQL modifiers with the same names. It returns a permission error naming HogQL batch exports when the team does not have it enabled, in which case tell the user they can contact PostHog support to request access. Limit hogql_query with a WHERE clause to export only the data the user asked for, because user queries run under stricter resource limits than the other models. The export splits into files of about 1024 MiB by default, and a file can go a little over; set file.max_size_mb to change that size, or to null to write a single file of any size. Use file-download-batch-exports-retrieve with the returned id to poll until status is Completed, then follow the downloading-batch-export-files skill to download the files through the existing REST download endpoint.",+ "description": "Start an on-demand batch export that prepares downloadable files for events, persons, sessions, or the results of a HogQL query. For events, persons and sessions, provide data_interval_start and data_interval_end as ISO 8601 datetimes; the interval must be at most one week, and for events, include and exclude filter event names. The hogql model is in closed beta and is enabled per team: it takes a hogql_query, which can reference the {data_interval_start} and {data_interval_end} placeholders filled from data_interval_start and data_interval_end, and optional hogql_modifiers, which override the project HogQL modifiers with the same names. Timestamps are exported in UTC unless the export or the project sets convertToProjectTimezone, for example {\"convertToProjectTimezone\": true} to export them in the project timezone. It returns a permission error naming HogQL batch exports when the team does not have it enabled, in which case tell the user they can contact PostHog support to request access. Limit hogql_query with a WHERE clause to export only the data the user asked for, because user queries run under stricter resource limits than the other models. The export splits into files of about 1024 MiB by default, and a file can go a little over; set file.max_size_mb to change that size, or to null to write a single file of any size. Use file-download-batch-exports-retrieve with the returned id to poll until status is Completed, then follow the downloading-batch-export-files skill to download the files through the existing REST download endpoint.","category": "Data pipelines","feature": "batch_exports","summary": "Start file download export",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 9c691fa4deb7..1f4bf8321b48 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -1450,7 +1450,7 @@"feature_flag": "autoresearch"},"batch-export-create": {- "description": "Create a new batch export. This tool supports typed destination configs for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. All require a team-scoped integration for credentials. Use integrations-list to find one and pass its ID as destination.integration_id. Always specify the model field (events, persons, sessions, or hogql). Omitting it defaults to events. For the hogql model, provide hogql_query. Optionally provide hogql_modifiers, which override the project HogQL modifiers with the same names for this export only, for example {\"convertToProjectTimezone\": false} to export timestamps in UTC.",+ "description": "Create a new batch export. This tool supports typed destination configs for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. All require a team-scoped integration for credentials. Use integrations-list to find one and pass its ID as destination.integration_id. Always specify the model field (events, persons, sessions, or hogql). Omitting it defaults to events. For the hogql model, provide hogql_query. Optionally provide hogql_modifiers, which override the project HogQL modifiers with the same names for this export only. Timestamps are exported in UTC unless the export or the project sets convertToProjectTimezone, for example {\"convertToProjectTimezone\": true} to export them in the project timezone.","category": "Data pipelines","feature": "batch_exports","summary": "Create batch export",@@ -1492,7 +1492,7 @@}},"batch-export-update": {- "description": "Partially update a batch export. Top-level fields (name, paused, interval, timezone, offset_day, offset_hour) work for any destination type. For the hogql model, hogql_query and hogql_modifiers can also change; send hogql_modifiers as null to remove them. Typed destination config updates are available for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. The destination type cannot be changed. Do not change the model field on an existing batch export.",+ "description": "Partially update a batch export. Top-level fields (name, paused, interval, timezone, offset_day, offset_hour) work for any destination type. For the hogql model, hogql_query and hogql_modifiers can also change. hogql_modifiers replaces the stored object rather than merging into it, so read the current value with batch-export-get and send every modifier to keep, or send null to remove them all. Timestamps are exported in UTC unless the export or the project sets convertToProjectTimezone to true. Typed destination config updates are available for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. The destination type cannot be changed. Do not change the model field on an existing batch export.","category": "Data pipelines","feature": "batch_exports","summary": "Update batch export",@@ -6693,7 +6693,7 @@}},"file-download-batch-exports-create": {- "description": "Start an on-demand batch export that prepares downloadable files for events, persons, sessions, or the results of a HogQL query. For events, persons and sessions, provide data_interval_start and data_interval_end as ISO 8601 datetimes; the interval must be at most one week, and for events, include and exclude filter event names. The hogql model is in closed beta and is enabled per team: it takes a hogql_query, which can reference the {data_interval_start} and {data_interval_end} placeholders filled from data_interval_start and data_interval_end, and optional hogql_modifiers, which override the project HogQL modifiers with the same names. It returns a permission error naming HogQL batch exports when the team does not have it enabled, in which case tell the user they can contact PostHog support to request access. Limit hogql_query with a WHERE clause to export only the data the user asked for, because user queries run under stricter resource limits than the other models. The export splits into files of about 1024 MiB by default, and a file can go a little over; set file.max_size_mb to change that size, or to null to write a single file of any size. Use file-download-batch-exports-retrieve with the returned id to poll until status is Completed, then follow the downloading-batch-export-files skill to download the files through the existing REST download endpoint.",+ "description": "Start an on-demand batch export that prepares downloadable files for events, persons, sessions, or the results of a HogQL query. For events, persons and sessions, provide data_interval_start and data_interval_end as ISO 8601 datetimes; the interval must be at most one week, and for events, include and exclude filter event names. The hogql model is in closed beta and is enabled per team: it takes a hogql_query, which can reference the {data_interval_start} and {data_interval_end} placeholders filled from data_interval_start and data_interval_end, and optional hogql_modifiers, which override the project HogQL modifiers with the same names. Timestamps are exported in UTC unless the export or the project sets convertToProjectTimezone, for example {\"convertToProjectTimezone\": true} to export them in the project timezone. It returns a permission error naming HogQL batch exports when the team does not have it enabled, in which case tell the user they can contact PostHog support to request access. Limit hogql_query with a WHERE clause to export only the data the user asked for, because user queries run under stricter resource limits than the other models. The export splits into files of about 1024 MiB by default, and a file can go a little over; set file.max_size_mb to change that size, or to null to write a single file of any size. Use file-download-batch-exports-retrieve with the returned id to poll until status is Completed, then follow the downloading-batch-export-files skill to download the files through the existing REST download endpoint.","category": "Data pipelines","feature": "batch_exports","summary": "Start file download export",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 14af6f5c6c88..c63a4596139c 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -16033,7 +16033,7 @@ export namespace Schemas {* @nullable*/hogql_query?: string | null;- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiers | null;/** A schema of custom fields to select when exporting data. */readonly schema: unknown;@@ -16882,7 +16882,7 @@ export namespace Schemas {* @nullable*/hogql_query?: string | null;- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiers | null;/** Optional list of property filters to restrict which events are exported. Each filter is a serialized HogQL property filter object with a 'type' of one of: 'event', 'hogql', 'person' (e.g. {"key": "$browser", "operator": "exact", "type": "event", "value": ["Firefox"]}). */filters?: unknown;@@ -26134,7 +26134,7 @@ export namespace Schemas {model: FileDownloadHogQLRequestModel;/** HogQL SELECT query whose results are exported. This model is in closed beta and is enabled per team; when it is not enabled, the request fails with a permission error that names HogQL batch exports. Contact PostHog support to request access. The query may reference the {data_interval_start} and {data_interval_end} placeholders. Provide a value for each placeholder the query references; missing referenced bounds are rejected, not inferred. When both bounds are supplied, they must span at most seven days. Neither supplied bound may be in the future. Without placeholders, the query runs unchanged, even if bounds are supplied. Every column in the SELECT clause must be a field or have an alias. It is recommended to limit the query with a WHERE clause, for example bounding timestamp on the events table, both to avoid exporting more rows than expected and because user queries run under stricter resource limits than the other models. */hogql_query: string;- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiers;/** Start of the export interval. Required for the events, persons, and sessions models. For HogQL, required only when the query references {data_interval_start}. A supplied start must not be in the future. When both bounds are supplied, the interval must span at most seven days. */data_interval_start?: string;@@ -51914,7 +51914,7 @@ export namespace Schemas {model: FileDownloadHogQLModelEnum;/** HogQL SELECT query whose results are exported. This model is in closed beta and is enabled per team; when it is not enabled, the request fails with a permission error that names HogQL batch exports. Contact PostHog support to request access. The query may reference the {data_interval_start} and {data_interval_end} placeholders. Provide a value for each placeholder the query references; missing referenced bounds are rejected, not inferred. When both bounds are supplied, they must span at most seven days. Neither supplied bound may be in the future. Without placeholders, the query runs unchanged, even if bounds are supplied. Every column in the SELECT clause must be a field or have an alias. It is recommended to limit the query with a WHERE clause, for example bounding timestamp on the events table, both to avoid exporting more rows than expected and because user queries run under stricter resource limits than the other models. */hogql_query: string;- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiers;/** Start of the export interval. Required for the events, persons, and sessions models. For HogQL, required only when the query references {data_interval_start}. A supplied start must not be in the future. When both bounds are supplied, the interval must span at most seven days. */data_interval_start?: string;@@ -77277,7 +77277,7 @@ export namespace Schemas {* @nullable*/hogql_query?: string | null;- /** HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone. */+ /** HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {"convertToProjectTimezone": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all. */hogql_modifiers?: HogQLQueryModifiers | null;/** Optional list of property filters to restrict which events are exported. Each filter is a serialized HogQL property filter object with a 'type' of one of: 'event', 'hogql', 'person' (e.g. {"key": "$browser", "operator": "exact", "type": "event", "value": ["Firefox"]}). */filters?: unknown;diff --git a/services/mcp/src/generated/batch_exports/api.ts b/services/mcp/src/generated/batch_exports/api.tsindex d0e74fbd1cd8..a7ad300e0e3c 100644--- a/services/mcp/src/generated/batch_exports/api.ts+++ b/services/mcp/src/generated/batch_exports/api.ts@@ -694,7 +694,7 @@ export const BatchExportsCreateBody = () => zod]).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),timezone: zod.string()@@ -1408,7 +1408,7 @@ export const BatchExportsPartialUpdateBody = () => zod]).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),timezone: zod.string()@@ -1851,7 +1851,7 @@ export const FileDownloadBatchExportsCreateBody = () => zod.union([}).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),data_interval_start: zod.iso.datetime({ offset: true })@@ -2139,7 +2139,7 @@ export const FileDownloadBatchExportsCountRowsCreateBody = () => zod}).optional().describe(- "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."),data_interval_start: zod.iso.datetime({ offset: true })diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-create.jsonindex 788284738869..68bfb2b4d651 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-create.json@@ -1114,7 +1114,7 @@"type": "null"}],- "description": "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "description": "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."},"hogql_query": {"anyOf": [diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-update.jsonindex a9d7cfd92061..58f3f855dea2 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/batch-export-update.json@@ -1113,7 +1113,7 @@"type": "null"}],- "description": "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone."+ "description": "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all."},"hogql_query": {"anyOf": [diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/file-download-batch-exports-count-rows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/file-download-batch-exports-count-rows-create.jsonindex 4bcd2e3965ea..9ce6fb43bae6 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/file-download-batch-exports-count-rows-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/file-download-batch-exports-count-rows-create.json@@ -15,7 +15,7 @@"type": "string"},"hogql_modifiers": {- "description": "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone.",+ "description": "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all.","properties": {"bounceRateDurationSeconds": {"anyOf": [diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/file-download-batch-exports-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/file-download-batch-exports-create.jsonindex 1aad18a83562..b35f3e82ada1 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/file-download-batch-exports-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/file-download-batch-exports-create.json@@ -244,7 +244,7 @@"type": "object"},"hogql_modifiers": {- "description": "HogQL modifiers to use when the query runs. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. For example, set convertToProjectTimezone to false to export timestamps in UTC instead of the project timezone.",+ "description": "HogQL modifiers to use when the query runs, as an object keyed by modifier name, for example {\"convertToProjectTimezone\": true}. Only supported when 'model' is 'hogql'. Each modifier set here overrides the project modifier with the same name, and the project modifiers apply to all others. If neither sets convertToProjectTimezone, it defaults to false, so timestamps are exported in UTC. Set it to true to export timestamps in the project timezone instead. Unknown modifier names are rejected. On update, the object replaces the modifiers stored on the export, so include every modifier to keep, or send null to remove them all.","properties": {"bounceRateDurationSeconds": {"anyOf": [