Every Sample customer gets access to a dedicated, secure PostgreSQL database instance that automatically scales based on your needs. Our database infrastructure is built on AWS’s reliable cloud infrastructure, ensuring high availability and performance.
When creating a table, Sample automatically generates the SQL for you. You can review this SQL before creating the table to ensure it matches your requirements:
Use the SampleHC client’s sql_execute method to execute SQL
from a workflow step. Queries use PostgreSQL-style placeholders
($1, $2, …) with values passed separately via params:
from client_manager import SampleHealthcareClientdef update_order_status(ctx): client = SampleHealthcareClient() result = client.v1.sql_execute( query="UPDATE orders SET status = $1 WHERE order_id = $2 RETURNING *", params=["processed", ctx.get_start_data()["order_id"]], ) return {"updated_rows": result.rows}
The response’s rows field contains the result rows as a list of objects keyed
by column name. Pass params=[] for queries with no parameters. If the query
fails, the response contains an error field with the failure message instead
of rows.For large result sets, pass array_mode=True to return each row as an array
of values instead of an object, which avoids repeating column names in every
row.
Always pass user-provided values through params instead of formatting them
into the query string — this prevents SQL injection and quoting issues.
Your database includes a read-only sample schema for querying workflow data
managed by Sample. Task feedback is available in sample.task_feedback and can
be joined to sample.tasks and sample.users for workflow and user context:
SELECT feedback.created_at, feedback.feedback, task.workflow_name, task.step_id, user.name AS user_name, user.email AS user_emailFROM sample.task_feedback AS feedbackJOIN sample.tasks AS task ON task.id = feedback.task_idLEFT JOIN sample.users AS user ON user.id = feedback.user_idORDER BY feedback.created_at DESC;
All tables in the sample schema are scoped to your organization and are
read-only.
Autoscaling: Your database automatically scales compute and storage resources based on usage.
Secure: Your data is encrypted at rest and in transit with VPC isolation.
High availability: The system is built on AWS RDS for enterprise-grade reliability.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Sample Healthcare","colors":{"primary":"#2563EB","light":"#07C983","dark":"#15803D"},"logo":{"light":"https://mintcdn.com/sample-d81c0ba9/csgkF777pfuPaXpq/static/logo-black.svg?fit=max\u0026auto=format\u0026n=csgkF777pfuPaXpq\u0026q=85\u0026s=9d907122fe392f5881798abde5370576","dark":"https://mintcdn.com/sample-d81c0ba9/csgkF777pfuPaXpq/static/logo-white.svg?fit=max\u0026auto=format\u0026n=csgkF777pfuPaXpq\u0026q=85\u0026s=dad5c20de67f108b65136b55908c5f12"},"favicon":"https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/static/favicon.png?fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=db79fbcd66d0f87b3b29d9eef8ebeb0d","navbar":{"links":[{"href":"mailto:support@samplehc.com","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.samplehc.com"}},"footer":{"socials":{"linkedin":"https://linkedin.com/company/samplehc"}},"icons":{"library":"lucide"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"sample-d81c0ba9","hasAudioNarration":false,"actualSubdomain":"sample-d81c0ba9","customDomains":["docs.samplehc.com"],"gitSource":{"type":"github","owner":"samplehc","repo":"sample","deployBranch":"main","contentDirectory":"apps/docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a8cb6467b5cdd48b2696f21","collectionId":"384d01f0-a2dd-4f12-84ed-1bbcbd6644ff","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6a8cb6467b5cdd48b2696f21"},"entitlements":{},"buildId":"6a8cb6467b5cdd48b2696f21","clientVersion":"0.0.3926","searchFilterCounts":[{"language":"default","tag":"SampleHC API","count":116},{"language":"default","tag":"Docs","count":27},{"language":"default","tag":"Document","count":21},{"language":"default","tag":"Workflows","count":12},{"language":"default","tag":"Screens","count":11},{"language":"default","tag":"Clearinghouse","count":10},{"language":"default","tag":"Integration - Glidian","count":9},{"language":"default","tag":"Integration - WellSky","count":9},{"language":"default","tag":"Task","count":9},{"language":"default","tag":"Candid Health","count":8}]},"assistantConfig":{},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"guides/database","slug":"/guides/database","pageMetadata":{"title":"Database","description":"Sample provides a fully managed, autoscaling PostgreSQL database powered by AWS for storing data between and across workflows.","icon":"database","href":"/guides/database"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Sample provides a fully managed, autoscaling PostgreSQL database powered by AWS for storing data between and across workflows.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`overview`,children:`Overview`}),`\n`,_jsx(_components.p,{children:`Every Sample customer gets access to a dedicated, secure PostgreSQL database instance that automatically scales based on your needs. Our database infrastructure is built on AWS’s reliable cloud infrastructure, ensuring high availability and performance.`}),`\n`,_jsx(Heading,{level:`2`,id:`creating-database-objects`,children:`Creating database objects`}),`\n`,_jsx(_components.p,{children:`You can create various database objects through our editor interface.`}),`\n`,_jsx(Heading,{level:`3`,id:`creating-tables`,children:`Creating tables`}),`\n`,_jsxs(_components.p,{children:[`To create a new table in your database: `,_jsx(OptimizedImage,{src:`https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/create.png?fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=fa2dec15170779458d993d3655fb4268`,alt:`Create Table Interface`,\"data-og-width\":`3120`,width:`3120`,\"data-og-height\":`1822`,height:`1822`,\"data-path\":`guides/images/create.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/create.png?w=280\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=d85f51e539484974257b74493f220cbf 280w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/create.png?w=560\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=11d9a40999193dbe5be9a53dfc84bd05 560w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/create.png?w=840\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=66560a3e52c50c248f2934a8d9ea25a1 840w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/create.png?w=1100\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=41bf4889d3e0b4a7488ad1d1b92a0aad 1100w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/create.png?w=1650\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=083035e4b965e9818c1e16049b3da0d3 1650w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/create.png?w=2500\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=22496f4bb1bc9bcd55a4c40302f85674 2500w`})]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Click the ”+” button or select “Create Table” from the menu`}),`\n`,_jsx(_components.li,{children:`Enter your table name`}),`\n`,_jsxs(_components.li,{children:[`Define columns with:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Column name`}),`\n`,_jsx(_components.li,{children:`Data type`}),`\n`,_jsx(_components.li,{children:`Constraints (PRIMARY KEY, NOT NULL, etc.)`}),`\n`,_jsx(_components.li,{children:`Default values`}),`\n`]}),`\n`]}),`\n`,_jsx(_components.li,{children:`Add additional constraints or indexes as needed`}),`\n`,_jsx(_components.li,{children:`Click “Review and create” to create your table`}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`reviewing-generated-sql`,children:`Reviewing generated SQL`}),`\n`,_jsxs(_components.p,{children:[`When creating a table, Sample automatically generates the SQL for you. You can review this SQL before creating the table to ensure it matches your requirements: `,_jsx(OptimizedImage,{src:`https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/review.png?fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=1e83654f7d68ea946bf00e4097ee9923`,alt:`SQL Review Interface`,\"data-og-width\":`3120`,width:`3120`,\"data-og-height\":`1822`,height:`1822`,\"data-path\":`guides/images/review.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/review.png?w=280\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=07c08aebcfe1fa91a5b13987a33b07e1 280w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/review.png?w=560\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=f11a3a3b01f9e6cfd7fda8479f1626b8 560w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/review.png?w=840\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=2a27863ab7bb3228c52d3ca84081435d 840w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/review.png?w=1100\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=e163d9564b1a5a88cf37bc8cfc96bad9 1100w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/review.png?w=1650\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=b3e63ce81b3ea839d32744e1c93dc068 1650w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/review.png?w=2500\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=2e1618d9d800357e9a5163663f2a6247 2500w`})]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` \"`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\".`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"patient\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` integer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` PRIMARY KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` GENERATED`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` ALWAYS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` AS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` IDENTITY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` text`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`This gives you visibility into the exact SQL that will be executed and allows you to:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Verify column definitions and constraints`}),`\n`,_jsx(_components.li,{children:`Understand the underlying SQL syntax`}),`\n`,_jsx(_components.li,{children:`Learn how to write similar SQL statements manually`}),`\n`,_jsx(_components.li,{children:`Make any necessary adjustments before table creation`}),`\n`]}),`\n`,_jsx(_components.p,{children:`You can also create other database objects:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Schemas for organizing your tables`}),`\n`,_jsx(_components.li,{children:`Views for saved queries`}),`\n`,_jsx(_components.li,{children:`Enums for custom data types`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`writing-sql-queries`,children:`Writing SQL queries`}),`\n`,_jsx(_components.p,{children:`You can interact with your database in two main ways.`}),`\n`,_jsx(Heading,{level:`3`,id:`direct-sql-execution`,children:`Direct SQL execution`}),`\n`,_jsxs(_components.p,{children:[`Write and execute SQL queries directly using the SQL runner: `,_jsx(OptimizedImage,{src:`https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/run_sql.png?fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=edc4e28b1dd1884872c265084a888b18`,alt:`SQL Runner Interface`,\"data-og-width\":`3120`,width:`3120`,\"data-og-height\":`1822`,height:`1822`,\"data-path\":`guides/images/run_sql.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/run_sql.png?w=280\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=3f02fe0bd3a247373a020906eaadd288 280w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/run_sql.png?w=560\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=dae72f3d75e28617a238752bfd42da65 560w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/run_sql.png?w=840\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=8c159b8e0b683e65ef6d0bb95df47301 840w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/run_sql.png?w=1100\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=c37430cba1c617e502074b59a24d8cc2 1100w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/run_sql.png?w=1650\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=82c11892015317a815a8b27002e4f980 1650w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/run_sql.png?w=2500\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=9b3cabbc127020655ad0fab7af65f054 2500w`})]}),`\n`,_jsx(_components.p,{children:`The SQL runner provides an interactive environment where you can:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Write and execute SQL queries`}),`\n`,_jsx(_components.li,{children:`See query results in a tabular format`}),`\n`,_jsx(_components.li,{children:`View execution time and row count`}),`\n`,_jsx(_components.li,{children:`Run multiple queries in the same session`}),`\n`,_jsx(_components.li,{children:`Navigate query history`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Example query:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` users `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` created_at `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` NOW`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` INTERVAL `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'7 days'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`querying-the-database-from-workflows`,children:`Querying the database from workflows`}),`\n`,_jsxs(_components.p,{children:[`Use the SampleHC client’s `,_jsx(_components.a,{href:`/api-reference`,children:_jsx(_components.code,{children:`sql_execute`})}),` method to execute SQL\nfrom a `,_jsx(_components.a,{href:`/workflows`,children:`workflow`}),` step. Queries use PostgreSQL-style placeholders\n(`,_jsx(_components.code,{children:`$1`}),`, `,_jsx(_components.code,{children:`$2`}),`, …) with values passed separately via `,_jsx(_components.code,{children:`params`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client_manager `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SampleHealthcareClient`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` update_order_status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SampleHealthcareClient()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.v1.sql_execute(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` query`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"UPDATE orders SET status = $1 WHERE order_id = $2 RETURNING *\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` params`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"processed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, ctx.get_start_data()[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"order_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"updated_rows\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: result.rows}`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The response’s `,_jsx(_components.code,{children:`rows`}),` field contains the result rows as a list of objects keyed\nby column name. Pass `,_jsx(_components.code,{children:`params=[]`}),` for queries with no parameters. If the query\nfails, the response contains an `,_jsx(_components.code,{children:`error`}),` field with the failure message instead\nof `,_jsx(_components.code,{children:`rows`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For large result sets, pass `,_jsx(_components.code,{children:`array_mode=True`}),` to return each row as an array\nof values instead of an object, which avoids repeating column names in every\nrow.`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Always pass user-provided values through `,_jsx(_components.code,{children:`params`}),` instead of formatting them\ninto the query string — this prevents SQL injection and quoting issues.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`querying-sample-managed-workflow-data`,children:`Querying Sample-managed workflow data`}),`\n`,_jsxs(_components.p,{children:[`Your database includes a read-only `,_jsx(_components.code,{children:`sample`}),` schema for querying workflow data\nmanaged by Sample. Task feedback is available in `,_jsx(_components.code,{children:`sample.task_feedback`}),` and can\nbe joined to `,_jsx(_components.code,{children:`sample.tasks`}),` and `,_jsx(_components.code,{children:`sample.users`}),` for workflow and user context:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` feedback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`created_at`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` feedback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`feedback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` task`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`workflow_name`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` task`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`step_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` user_name,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`email`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` user_email`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` sample`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`task_feedback`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` feedback`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`JOIN`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` sample`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`tasks`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` task `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ON`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` task`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` feedback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`task_id`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LEFT JOIN`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` sample`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`users`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` user `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ON`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` feedback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`user_id`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ORDER BY`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` feedback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`created_at`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` DESC`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`All tables in the `,_jsx(_components.code,{children:`sample`}),` schema are scoped to your organization and are\nread-only.`]}),`\n`,_jsx(Heading,{level:`2`,id:`viewing-table-data`,children:`Viewing table data`}),`\n`,_jsxs(_components.p,{children:[`Sample provides an interface for viewing and managing your table data: `,_jsx(OptimizedImage,{src:`https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/view_data.png?fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=acc747812893c96e992d17bcf76be06f`,alt:`Table Data View Interface`,\"data-og-width\":`3120`,width:`3120`,\"data-og-height\":`1822`,height:`1822`,\"data-path\":`guides/images/view_data.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/view_data.png?w=280\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=ca8043cdbabcd670ea4c8b2077f1e4de 280w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/view_data.png?w=560\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=a17e73df4d404f82a8fc8243f09dec90 560w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/view_data.png?w=840\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=54bcf817c5f935ef6fb3c64270818ec6 840w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/view_data.png?w=1100\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=e266886ced55285def5580c2c52e01f6 1100w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/view_data.png?w=1650\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=38dbee8eafc81f3f8eefda1471be84bc 1650w, https://mintcdn.com/sample-d81c0ba9/wakilrt7leTVRJLZ/guides/images/view_data.png?w=2500\u0026fit=max\u0026auto=format\u0026n=wakilrt7leTVRJLZ\u0026q=85\u0026s=4e5c5df64f8dd08a9f00e5f6fcc4bb1a 2500w`})]}),`\n`,_jsx(_components.p,{children:`The table view interface offers several features:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`View and edit data in a spreadsheet-like grid`}),`\n`,_jsx(_components.li,{children:`Sort columns by clicking column headers`}),`\n`,_jsx(_components.li,{children:`Filter data using the Filters button`}),`\n`,_jsx(_components.li,{children:`Customize visible columns`}),`\n`,_jsx(_components.li,{children:`Add new records with the “Add record” button`}),`\n`,_jsx(_components.li,{children:`Navigate through pages of data`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`key-features`,children:`Key features`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Autoscaling`}),`: Your database automatically scales compute and storage resources based on usage.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Secure`}),`: Your data is encrypted at rest and in transit with VPC isolation.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`High availability`}),`: The system is built on AWS RDS for enterprise-grade reliability.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Database","description":"Sample provides a fully managed, autoscaling PostgreSQL database powered by AWS for storing data between and across workflows.","icon":"database","href":"/guides/database"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Overview","slug":"overview","depth":2,"children":[]},{"title":"Creating database objects","slug":"creating-database-objects","depth":2,"children":[{"title":"Creating tables","slug":"creating-tables","depth":3,"children":[]},{"title":"Reviewing generated SQL","slug":"reviewing-generated-sql","depth":3,"children":[]}]},{"title":"Writing SQL queries","slug":"writing-sql-queries","depth":2,"children":[{"title":"Direct SQL execution","slug":"direct-sql-execution","depth":3,"children":[]},{"title":"Querying the database from workflows","slug":"querying-the-database-from-workflows","depth":3,"children":[]}]},{"title":"Querying Sample-managed workflow data","slug":"querying-sample-managed-workflow-data","depth":2,"children":[]},{"title":"Viewing table data","slug":"viewing-table-data","depth":2,"children":[]},{"title":"Key features","slug":"key-features","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"sample-d81c0ba9","siteName":"Sample Healthcare","title":"Database - Sample Healthcare","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-30T23:25:11.536Z","originalFileLocation":"guides/database.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Sample provides a fully managed, autoscaling PostgreSQL database powered by AWS for storing data between and across workflows.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Sample Healthcare\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Database - Sample Healthcare\">\u003cmeta data-mint-head property=\"og:description\" content=\"Sample provides a fully managed, autoscaling PostgreSQL database powered by AWS for storing data between and across workflows.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Sample Healthcare\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.samplehc.com/guides/database\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://sample-d81c0ba9.mintlify.app/_mintlify/api/og/v2?division=Other+guides\u0026amp;title=Database\u0026amp;description=Sample+provides+a+fully+managed%2C+autoscaling+PostgreSQL+database+powered+by+AWS+for+storing+data+between+and+across+workflows.\u0026amp;theme=3f389ff79a87988fb1879916\u0026amp;signature=1cf0e7645a63f6248a5fd6fb6442d0e476efd04293dabaa4fbc1b424a0e658de\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Database - Sample Healthcare\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Sample provides a fully managed, autoscaling PostgreSQL database powered by AWS for storing data between and across workflows.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://sample-d81c0ba9.mintlify.app/_mintlify/api/og/v2?division=Other+guides\u0026amp;title=Database\u0026amp;description=Sample+provides+a+fully+managed%2C+autoscaling+PostgreSQL+database+powered+by+AWS+for+storing+data+between+and+across+workflows.\u0026amp;theme=3f389ff79a87988fb1879916\u0026amp;signature=1cf0e7645a63f6248a5fd6fb6442d0e476efd04293dabaa4fbc1b424a0e658de\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/sample-d81c0ba9/qhbkLOE8HtyeJP8q/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Sample Healthcare\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2563EB\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.samplehc.com/guides/database\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/database.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.samplehc.com/#organization\",\"name\":\"Sample Healthcare\",\"url\":\"https://docs.samplehc.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/sample-d81c0ba9/csgkF777pfuPaXpq/static/logo-black.svg?fit=max\u0026auto=format\u0026n=csgkF777pfuPaXpq\u0026q=85\u0026s=9d907122fe392f5881798abde5370576\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.samplehc.com#website\",\"name\":\"Sample Healthcare\",\"url\":\"https://docs.samplehc.com\",\"publisher\":{\"@id\":\"https://docs.samplehc.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.samplehc.com/guides/database#webpage\",\"url\":\"https://docs.samplehc.com/guides/database\",\"name\":\"Database\",\"description\":\"Sample provides a fully managed, autoscaling PostgreSQL database powered by AWS for storing data between and across workflows.\",\"dateModified\":\"2026-07-30T23:25:11.536Z\",\"isPartOf\":{\"@id\":\"https://docs.samplehc.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.samplehc.com/guides/database#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.samplehc.com/guides/database#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Other guides\",\"item\":\"https://docs.samplehc.com/guides/authentication\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Database\",\"item\":\"https://docs.samplehc.com/guides/database\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.samplehc.com/guides/database#article\",\"headline\":\"Database\",\"name\":\"Database\",\"description\":\"Sample provides a fully managed, autoscaling PostgreSQL database powered by AWS for storing data between and across workflows.\",\"url\":\"https://docs.samplehc.com/guides/database\",\"mainEntityOfPage\":{\"@id\":\"https://docs.samplehc.com/guides/database#webpage\"},\"dateModified\":\"2026-07-30T23:25:11.536Z\",\"publisher\":{\"@id\":\"https://docs.samplehc.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.samplehc.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Sample Healthcare\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Sample Healthcare","nav":{"global":null,"tabs":[{"tab":"Docs","groups":[{"group":"Workflows","pages":[{"title":"Introduction","icon":"book-open","href":"/workflows"},{"title":"Quickstart","icon":"rocket","href":"/workflows/quickstart"},{"title":"Workflows and Steps","icon":"workflow","href":"/workflows/workflows-and-steps"},{"title":"Control Flow","icon":"split","href":"/workflows/control-flow"},{"title":"Designing Workflows","icon":"drafting-compass","href":"/workflows/designing-workflows"},{"title":"Workflow Context","icon":"code","href":"/workflows/context"},{"title":"Column Values","icon":"columns-3","href":"/workflows/column-values"},{"title":"Async Results","icon":"pause","href":"/workflows/suspend-resume"},{"title":"Events","icon":"bell","href":"/workflows/events"},{"title":"Calling the Sample API","icon":"arrow-left-right","href":"/workflows/samplehc-api"},{"title":"Starting Workflows","icon":"play","href":"/workflows/start-workflow"},{"title":"Environment Variables","icon":"container","href":"/workflows/environment-variables"}]},{"group":"Screens","pages":[{"title":"Intro to Screens","icon":"tv-minimal","href":"/screens/index"},{"group":"Templates","icon":"layout-template","pages":[{"title":"Document Upload","icon":"upload","href":"/screens/templates/document-upload"},{"title":"Document Splitting","icon":"scissors","href":"/screens/templates/document-splitting"},{"title":"Document Classification","icon":"shapes","href":"/screens/templates/document-classification"},{"title":"Document Reasoning","icon":"brain","href":"/screens/templates/legacy-document-reasoning"}]},{"group":"UI Library","icon":"library","pages":[{"title":"Introduction","icon":"hammer","href":"/screens/ui-components/index"},{"group":"Components","icon":"list","pages":[{"title":"Form Component","icon":"clipboard-list","href":"/screens/ui-components/form"},{"title":"Rich Text Editor","icon":"letter-text","href":"/screens/ui-components/rich-text-editor"},{"title":"Payer Search Combobox","icon":"search","href":"/screens/ui-components/payer-search"},{"title":"PDF Viewer","icon":"file-text","href":"/screens/ui-components/pdf-viewer"},{"title":"Document Viewer","icon":"file","href":"/screens/ui-components/document-viewer"}]}]}]},{"group":"Integrations","pages":[{"title":"Salesforce","icon":"cloud","href":"/integrations/salesforce"}]},{"group":"Other guides","pages":[{"title":"Authentication","description":"How to authenticate with the SampleHC API","icon":"key","href":"/guides/authentication"},{"title":"Database","icon":"database","href":"/guides/database"},{"title":"Troubleshooting","description":"Common troubleshooting steps and solutions for Sample Healthcare platform","icon":"hand-helping","href":"/guides/troubleshooting"}]}]},{"tab":"SampleHC API","pages":[{"title":"SampleHC API","href":"/api-reference/v1/execute-sql-query"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]}]},"title":"Database - Sample Healthcare","buildId":"dpl_9DauxEjb9gzCtcuhPQFbquJvx7FJ","deploymentId":"dpl_9DauxEjb9gzCtcuhPQFbquJvx7FJ","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-D4WcYaf4.js","PlusIcon-CwhPVjTe.js","lightbox-handle-r17bVUz3.js"]}