: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
import { MakeLogicType, actions, kea, path } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
export interface Response {
query: string
trace_id: string
error?: string
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface fixSQLErrorsLogicValues {
response: Response | null
responseLoading: boolean
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface fixSQLErrorsLogicActions {
fixErrors: (
query: string,
error?: string,
connectionId?: string
) => {
connectionId: string | undefined
error: string | undefined
query: string
}
fixErrorsFailure: (
error: string,
errorObject?: any
) => {
error: string
errorObject?: any
}
fixErrorsSuccess: (
response: Response,
payload?: {
connectionId: string | undefined
error: string | undefined
query: string
}
) => {
response: Response
payload?: {
connectionId: string | undefined
error: string | undefined
query: string
}
}
}
export type fixSQLErrorsLogicType = MakeLogicType<fixSQLErrorsLogicValues, fixSQLErrorsLogicActions>
export const fixSQLErrorsLogic = kea<fixSQLErrorsLogicType>([
path(['scenes', 'data-warehouse', 'editor', 'fixSQLErrorsLogic']),
actions({
fixErrors: (query: string, error?: string, connectionId?: string) => ({ query, error, connectionId }),
}),
loaders({
response: [
null as Response | null,
{
fixErrors: async ({ query, error, connectionId }) => {
const response = await api.fixHogQLErrors.fix(query, error, connectionId)
return response as Response
},
},
],
}),
])