Skip to content

: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.

2.2 KB
Raw Blame
import { LemonInput } from '@posthog/lemon-ui'

import { IntegrationChoice } from 'lib/components/CyclotronJob/integrations/IntegrationChoice'
import { LemonField } from 'lib/lemon-ui/LemonField'

import { PERSON_EVENT_FIELDS } from './common'
import type { DestinationDefinition } from './types'

// Credentials come from a linked `snowflake` Integration, never from this destination's config.
export const snowflakeDefinition: DestinationDefinition = {
    type: 'Snowflake',
    usesIntegration: true,
    defaults: () => ({}),
    requiredFields: () => ['integration_id', 'database', 'warehouse', 'schema', 'table_name'],
    configKeys: ['database', 'warehouse', 'schema', 'table_name', 'role'],
    eventTableOverrides: {
        setName: 'people_set',
        setOnceName: 'people_set_once',
    },
    eventTableExtraFields: {
        ...PERSON_EVENT_FIELDS,
        snowflake_ingested_timestamp: {
            name: 'snowflake_ingested_timestamp',
            hogql_value: 'NOW64()',
            type: 'datetime',
            schema_valid: true,
        },
    },
    Fields: function SnowflakeFields() {
        return (
            <>
                <LemonField name="integration_id" label="Connection">
                    {({ value, onChange }) => (
                        <IntegrationChoice integration="snowflake" value={value} onChange={onChange} />
                    )}
                </LemonField>

                <LemonField name="database" label="Database">
                    <LemonInput placeholder="my-database" />
                </LemonField>

                <LemonField name="schema" label="Schema">
                    <LemonInput placeholder="my-schema" />
                </LemonField>

                <LemonField name="table_name" label="Table name">
                    <LemonInput placeholder="events" />
                </LemonField>

                <LemonField name="warehouse" label="Warehouse">
                    <LemonInput placeholder="my-warehouse" />
                </LemonField>

                <LemonField name="role" label="Role" showOptional>
                    <LemonInput placeholder="my-role" />
                </LemonField>
            </>
        )
    },
}