import { useParams } from 'common' import { ExternalLink } from 'lucide-react' import { parseAsBoolean, useQueryState } from 'nuqs' import { Button, cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui' import { subscriptionHasHipaaAddon } from '../Billing/Subscription/Subscription.utils' import { Results } from '../SQLEditor/UtilityPanel/Results' import { getSqlErrorLines } from '../SQLEditor/UtilityPanel/UtilityTabResults.utils' import { type QueryResult } from './types' import { AiAssistantDropdown } from '@/components/ui/AiAssistantDropdown' import CopyButton from '@/components/ui/CopyButton' import { InlineLink, InlineLinkClassName } from '@/components/ui/InlineLink' import { useProjectSettingsV2Query } from '@/data/config/project-settings-v2-query' import { useOrgSubscriptionQuery } from '@/data/subscriptions/org-subscription-query' import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization' import { DOCS_URL } from '@/lib/constants' interface QueryResultTableProps { result?: QueryResult } // [Joshen] This is essentially a duplicate of UtilityTabResults from the SQL Editor // I'll eventually migrate the Results component over - just trying to avoid bloating // changes wherever possible // [Joshen] Should be shifted into QueryCell folder export const QueryResultTable = ({ result }: QueryResultTableProps) => { const { rows, error, autoLimit } = result ?? {} if (!result) { return
Run the query to see results
} if (error) { returnSuccess. No rows returned
} if (rows && rows.length > 0) { returnError: SQL query ran into an upstream timeout
You can either{' '}
{x}
))
) : (
Error: {error.message}
)} {!isTimeout && !isNetWorkError && autoLimit && (Note: A limit of {autoLimit} was applied to your query. If this was the cause of a syntax error, try selecting "No limit" instead and re-run the query.
)} {readReplicaError && (Note: Read replicas are for read only queries. Run write queries on the primary database instead.
)} {payloadTooLargeError && (Run this query by{' '} .
)}