[{"data":1,"prerenderedAt":780},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fconnections\u002Fpostgres-mysql":3},{"page":4,"navigation":696,"surround":777},{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"body":11,"_type":690,"_id":691,"_source":692,"_file":693,"_stem":694,"_extension":695},"\u002Fdocs\u002Fconnections\u002Fpostgres-mysql","connections",false,"","PostgreSQL and MySQL","Connect your product or operational database. Datachef queries a synced copy, not your production database.",{"type":12,"children":13,"toc":682},"root",[14,22,29,162,167,257,263,276,505,510,516,553,559,586,649,655,676],{"type":15,"tag":16,"props":17,"children":18},"element","p",{},[19],{"type":20,"value":21},"text","Connecting your product database is how you put usage data next to your CRM and marketing data. Datachef syncs a copy of the tables you choose, and every query runs against that copy. So analysis, whether it's yours or an AI agent's, never competes with your customers' traffic.",{"type":15,"tag":23,"props":24,"children":26},"h2",{"id":25},"connection-fields",[27],{"type":20,"value":28},"Connection fields",{"type":15,"tag":30,"props":31,"children":32},"table",{},[33,57],{"type":15,"tag":34,"props":35,"children":36},"thead",{},[37],{"type":15,"tag":38,"props":39,"children":40},"tr",{},[41,47,52],{"type":15,"tag":42,"props":43,"children":44},"th",{},[45],{"type":20,"value":46},"Field",{"type":15,"tag":42,"props":48,"children":49},{},[50],{"type":20,"value":51},"PostgreSQL",{"type":15,"tag":42,"props":53,"children":54},{},[55],{"type":20,"value":56},"MySQL",{"type":15,"tag":58,"props":59,"children":60},"tbody",{},[61,76,103,117,131,145],{"type":15,"tag":38,"props":62,"children":63},{},[64,70,73],{"type":15,"tag":65,"props":66,"children":67},"td",{},[68],{"type":20,"value":69},"Host",{"type":15,"tag":65,"props":71,"children":72},{},[],{"type":15,"tag":65,"props":74,"children":75},{},[],{"type":15,"tag":38,"props":77,"children":78},{},[79,84,94],{"type":15,"tag":65,"props":80,"children":81},{},[82],{"type":20,"value":83},"Port",{"type":15,"tag":65,"props":85,"children":86},{},[87],{"type":15,"tag":88,"props":89,"children":91},"code",{"className":90},[],[92],{"type":20,"value":93},"5432",{"type":15,"tag":65,"props":95,"children":96},{},[97],{"type":15,"tag":88,"props":98,"children":100},{"className":99},[],[101],{"type":20,"value":102},"3306",{"type":15,"tag":38,"props":104,"children":105},{},[106,111,114],{"type":15,"tag":65,"props":107,"children":108},{},[109],{"type":20,"value":110},"Database",{"type":15,"tag":65,"props":112,"children":113},{},[],{"type":15,"tag":65,"props":115,"children":116},{},[],{"type":15,"tag":38,"props":118,"children":119},{},[120,125,128],{"type":15,"tag":65,"props":121,"children":122},{},[123],{"type":20,"value":124},"User",{"type":15,"tag":65,"props":126,"children":127},{},[],{"type":15,"tag":65,"props":129,"children":130},{},[],{"type":15,"tag":38,"props":132,"children":133},{},[134,139,142],{"type":15,"tag":65,"props":135,"children":136},{},[137],{"type":20,"value":138},"Password",{"type":15,"tag":65,"props":140,"children":141},{},[],{"type":15,"tag":65,"props":143,"children":144},{},[],{"type":15,"tag":38,"props":146,"children":147},{},[148,153,158],{"type":15,"tag":65,"props":149,"children":150},{},[151],{"type":20,"value":152},"SSL mode",{"type":15,"tag":65,"props":154,"children":155},{},[156],{"type":20,"value":157},"See below",{"type":15,"tag":65,"props":159,"children":160},{},[161],{"type":20,"value":157},{"type":15,"tag":23,"props":163,"children":165},{"id":164},"ssl-mode",[166],{"type":20,"value":152},{"type":15,"tag":30,"props":168,"children":169},{},[170,186],{"type":15,"tag":34,"props":171,"children":172},{},[173],{"type":15,"tag":38,"props":174,"children":175},{},[176,181],{"type":15,"tag":42,"props":177,"children":178},{},[179],{"type":20,"value":180},"Mode",{"type":15,"tag":42,"props":182,"children":183},{},[184],{"type":20,"value":185},"Behaviour",{"type":15,"tag":58,"props":187,"children":188},{},[189,206,223,240],{"type":15,"tag":38,"props":190,"children":191},{},[192,201],{"type":15,"tag":65,"props":193,"children":194},{},[195],{"type":15,"tag":88,"props":196,"children":198},{"className":197},[],[199],{"type":20,"value":200},"require",{"type":15,"tag":65,"props":202,"children":203},{},[204],{"type":20,"value":205},"Encrypted. The server's certificate isn't checked. This is the default.",{"type":15,"tag":38,"props":207,"children":208},{},[209,218],{"type":15,"tag":65,"props":210,"children":211},{},[212],{"type":15,"tag":88,"props":213,"children":215},{"className":214},[],[216],{"type":20,"value":217},"verify-full",{"type":15,"tag":65,"props":219,"children":220},{},[221],{"type":20,"value":222},"Encrypted, and the server's certificate and hostname are verified.",{"type":15,"tag":38,"props":224,"children":225},{},[226,235],{"type":15,"tag":65,"props":227,"children":228},{},[229],{"type":15,"tag":88,"props":230,"children":232},{"className":231},[],[233],{"type":20,"value":234},"prefer",{"type":15,"tag":65,"props":236,"children":237},{},[238],{"type":20,"value":239},"Encrypted if the server supports it.",{"type":15,"tag":38,"props":241,"children":242},{},[243,252],{"type":15,"tag":65,"props":244,"children":245},{},[246],{"type":15,"tag":88,"props":247,"children":249},{"className":248},[],[250],{"type":20,"value":251},"disable",{"type":15,"tag":65,"props":253,"children":254},{},[255],{"type":20,"value":256},"Not encrypted. Only use this for local servers.",{"type":15,"tag":23,"props":258,"children":260},{"id":259},"use-a-read-only-user",[261],{"type":20,"value":262},"Use a read-only user",{"type":15,"tag":16,"props":264,"children":265},{},[266,268,274],{"type":20,"value":267},"Create a user that can only ",{"type":15,"tag":88,"props":269,"children":271},{"className":270},[],[272],{"type":20,"value":273},"SELECT",{"type":20,"value":275}," from the tables you want to sync. In PostgreSQL:",{"type":15,"tag":277,"props":278,"children":282},"pre",{"className":279,"code":280,"language":281,"meta":8,"style":8},"language-sql shiki shiki-themes github-light github-dark","CREATE USER datachef WITH PASSWORD '...';\nGRANT CONNECT ON DATABASE app TO datachef;\nGRANT USAGE ON SCHEMA public TO datachef;\nGRANT SELECT ON ALL TABLES IN SCHEMA public TO datachef;\nALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO datachef;\n","sql",[283],{"type":15,"tag":88,"props":284,"children":285},{"__ignoreMap":8},[286,331,370,406,449],{"type":15,"tag":287,"props":288,"children":291},"span",{"class":289,"line":290},"line",1,[292,298,303,309,314,319,325],{"type":15,"tag":287,"props":293,"children":295},{"style":294},"--shiki-default:#D73A49;--shiki-dark:#F97583",[296],{"type":20,"value":297},"CREATE",{"type":15,"tag":287,"props":299,"children":300},{"style":294},[301],{"type":20,"value":302}," USER",{"type":15,"tag":287,"props":304,"children":306},{"style":305},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[307],{"type":20,"value":308}," datachef",{"type":15,"tag":287,"props":310,"children":311},{"style":294},[312],{"type":20,"value":313}," WITH",{"type":15,"tag":287,"props":315,"children":316},{"style":294},[317],{"type":20,"value":318}," PASSWORD",{"type":15,"tag":287,"props":320,"children":322},{"style":321},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[323],{"type":20,"value":324}," '...'",{"type":15,"tag":287,"props":326,"children":328},{"style":327},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[329],{"type":20,"value":330},";\n",{"type":15,"tag":287,"props":332,"children":334},{"class":289,"line":333},2,[335,340,345,350,355,360,365],{"type":15,"tag":287,"props":336,"children":337},{"style":294},[338],{"type":20,"value":339},"GRANT",{"type":15,"tag":287,"props":341,"children":342},{"style":294},[343],{"type":20,"value":344}," CONNECT",{"type":15,"tag":287,"props":346,"children":347},{"style":294},[348],{"type":20,"value":349}," ON",{"type":15,"tag":287,"props":351,"children":352},{"style":294},[353],{"type":20,"value":354}," DATABASE",{"type":15,"tag":287,"props":356,"children":357},{"style":327},[358],{"type":20,"value":359}," app ",{"type":15,"tag":287,"props":361,"children":362},{"style":294},[363],{"type":20,"value":364},"TO",{"type":15,"tag":287,"props":366,"children":367},{"style":327},[368],{"type":20,"value":369}," datachef;\n",{"type":15,"tag":287,"props":371,"children":373},{"class":289,"line":372},3,[374,378,383,388,393,398,402],{"type":15,"tag":287,"props":375,"children":376},{"style":294},[377],{"type":20,"value":339},{"type":15,"tag":287,"props":379,"children":380},{"style":327},[381],{"type":20,"value":382}," USAGE ",{"type":15,"tag":287,"props":384,"children":385},{"style":294},[386],{"type":20,"value":387},"ON",{"type":15,"tag":287,"props":389,"children":390},{"style":294},[391],{"type":20,"value":392}," SCHEMA",{"type":15,"tag":287,"props":394,"children":395},{"style":327},[396],{"type":20,"value":397}," public ",{"type":15,"tag":287,"props":399,"children":400},{"style":294},[401],{"type":20,"value":364},{"type":15,"tag":287,"props":403,"children":404},{"style":327},[405],{"type":20,"value":369},{"type":15,"tag":287,"props":407,"children":409},{"class":289,"line":408},4,[410,414,419,423,428,433,437,441,445],{"type":15,"tag":287,"props":411,"children":412},{"style":294},[413],{"type":20,"value":339},{"type":15,"tag":287,"props":415,"children":416},{"style":294},[417],{"type":20,"value":418}," SELECT",{"type":15,"tag":287,"props":420,"children":421},{"style":294},[422],{"type":20,"value":349},{"type":15,"tag":287,"props":424,"children":425},{"style":327},[426],{"type":20,"value":427}," ALL TABLES ",{"type":15,"tag":287,"props":429,"children":430},{"style":294},[431],{"type":20,"value":432},"IN",{"type":15,"tag":287,"props":434,"children":435},{"style":294},[436],{"type":20,"value":392},{"type":15,"tag":287,"props":438,"children":439},{"style":327},[440],{"type":20,"value":397},{"type":15,"tag":287,"props":442,"children":443},{"style":294},[444],{"type":20,"value":364},{"type":15,"tag":287,"props":446,"children":447},{"style":327},[448],{"type":20,"value":369},{"type":15,"tag":287,"props":450,"children":452},{"class":289,"line":451},5,[453,458,463,468,472,476,480,484,488,492,497,501],{"type":15,"tag":287,"props":454,"children":455},{"style":294},[456],{"type":20,"value":457},"ALTER",{"type":15,"tag":287,"props":459,"children":460},{"style":294},[461],{"type":20,"value":462}," DEFAULT",{"type":15,"tag":287,"props":464,"children":465},{"style":327},[466],{"type":20,"value":467}," PRIVILEGES ",{"type":15,"tag":287,"props":469,"children":470},{"style":294},[471],{"type":20,"value":432},{"type":15,"tag":287,"props":473,"children":474},{"style":294},[475],{"type":20,"value":392},{"type":15,"tag":287,"props":477,"children":478},{"style":327},[479],{"type":20,"value":397},{"type":15,"tag":287,"props":481,"children":482},{"style":294},[483],{"type":20,"value":339},{"type":15,"tag":287,"props":485,"children":486},{"style":294},[487],{"type":20,"value":418},{"type":15,"tag":287,"props":489,"children":490},{"style":294},[491],{"type":20,"value":349},{"type":15,"tag":287,"props":493,"children":494},{"style":327},[495],{"type":20,"value":496}," TABLES ",{"type":15,"tag":287,"props":498,"children":499},{"style":294},[500],{"type":20,"value":364},{"type":15,"tag":287,"props":502,"children":503},{"style":327},[504],{"type":20,"value":369},{"type":15,"tag":16,"props":506,"children":507},{},[508],{"type":20,"value":509},"Point it at a read replica if you have one.",{"type":15,"tag":23,"props":511,"children":513},{"id":512},"table-names",[514],{"type":20,"value":515},"Table names",{"type":15,"tag":16,"props":517,"children":518},{},[519,521,527,529,535,537,543,545,551],{"type":20,"value":520},"Tables in the default schema (",{"type":15,"tag":88,"props":522,"children":524},{"className":523},[],[525],{"type":20,"value":526},"public",{"type":20,"value":528}," in PostgreSQL) are named as they are in the source. Tables in any other schema keep the schema as a prefix, so ",{"type":15,"tag":88,"props":530,"children":532},{"className":531},[],[533],{"type":20,"value":534},"sales.orders",{"type":20,"value":536}," in a connection named ",{"type":15,"tag":88,"props":538,"children":540},{"className":539},[],[541],{"type":20,"value":542},"warehouse",{"type":20,"value":544}," becomes ",{"type":15,"tag":88,"props":546,"children":548},{"className":547},[],[549],{"type":20,"value":550},"warehouse.sales_orders",{"type":20,"value":552},". The connection's page shows the name each table was given.",{"type":15,"tag":23,"props":554,"children":556},{"id":555},"column-types",[557],{"type":20,"value":558},"Column types",{"type":15,"tag":16,"props":560,"children":561},{},[562,568,570,576,578,584],{"type":15,"tag":88,"props":563,"children":565},{"className":564},[],[566],{"type":20,"value":567},"JSON",{"type":20,"value":569},", ",{"type":15,"tag":88,"props":571,"children":573},{"className":572},[],[574],{"type":20,"value":575},"JSONB",{"type":20,"value":577}," and ",{"type":15,"tag":88,"props":579,"children":581},{"className":580},[],[582],{"type":20,"value":583},"XML",{"type":20,"value":585}," columns arrive as text. To read fields out of them, use DuckDB's JSON functions:",{"type":15,"tag":277,"props":587,"children":589},{"className":279,"code":588,"language":281,"meta":8,"style":8},"SELECT json_extract_string(properties, '$.plan') AS plan\nFROM app.accounts\n",[590],{"type":15,"tag":88,"props":591,"children":592},{"__ignoreMap":8},[593,625],{"type":15,"tag":287,"props":594,"children":595},{"class":289,"line":290},[596,600,605,610,615,620],{"type":15,"tag":287,"props":597,"children":598},{"style":294},[599],{"type":20,"value":273},{"type":15,"tag":287,"props":601,"children":602},{"style":327},[603],{"type":20,"value":604}," json_extract_string(properties, ",{"type":15,"tag":287,"props":606,"children":607},{"style":321},[608],{"type":20,"value":609},"'$.plan'",{"type":15,"tag":287,"props":611,"children":612},{"style":327},[613],{"type":20,"value":614},") ",{"type":15,"tag":287,"props":616,"children":617},{"style":294},[618],{"type":20,"value":619},"AS",{"type":15,"tag":287,"props":621,"children":622},{"style":327},[623],{"type":20,"value":624}," plan\n",{"type":15,"tag":287,"props":626,"children":627},{"class":289,"line":333},[628,633,639,644],{"type":15,"tag":287,"props":629,"children":630},{"style":294},[631],{"type":20,"value":632},"FROM",{"type":15,"tag":287,"props":634,"children":636},{"style":635},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[637],{"type":20,"value":638}," app",{"type":15,"tag":287,"props":640,"children":641},{"style":327},[642],{"type":20,"value":643},".",{"type":15,"tag":287,"props":645,"children":646},{"style":635},[647],{"type":20,"value":648},"accounts\n",{"type":15,"tag":23,"props":650,"children":652},{"id":651},"incremental-sync",[653],{"type":20,"value":654},"Incremental sync",{"type":15,"tag":16,"props":656,"children":657},{},[658,660,666,668,675],{"type":20,"value":659},"Choose a column that increases whenever a row changes, typically ",{"type":15,"tag":88,"props":661,"children":663},{"className":662},[],[664],{"type":20,"value":665},"updated_at",{"type":20,"value":667},". Datachef suggests date, timestamp and integer columns. A table without one should use full refresh. See ",{"type":15,"tag":669,"props":670,"children":672},"a",{"href":671},"\u002Fdocs\u002Fconnections\u002Fsync-settings",[673],{"type":20,"value":674},"sync settings",{"type":20,"value":643},{"type":15,"tag":677,"props":678,"children":679},"style",{},[680],{"type":20,"value":681},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":8,"searchDepth":333,"depth":333,"links":683},[684,685,686,687,688,689],{"id":25,"depth":333,"text":28},{"id":164,"depth":333,"text":152},{"id":259,"depth":333,"text":262},{"id":512,"depth":333,"text":515},{"id":555,"depth":333,"text":558},{"id":651,"depth":333,"text":654},"markdown","content:docs:2.connections:6.postgres-mysql.md","content","docs\u002F2.connections\u002F6.postgres-mysql.md","docs\u002F2.connections\u002F6.postgres-mysql","md",[697],{"title":698,"_path":699,"children":700},"Welcome","\u002Fdocs",[701,702,712,731,747,754,764],{"title":698,"_path":699},{"title":703,"_path":704,"children":705},"Getting started","\u002Fdocs\u002Fgetting-started",[706,709],{"title":707,"_path":708},"Quickstart","\u002Fdocs\u002Fgetting-started\u002Fquickstart",{"title":710,"_path":711},"Key concepts","\u002Fdocs\u002Fgetting-started\u002Fconcepts",{"title":713,"_path":714,"children":715},"Connecting data","\u002Fdocs\u002Fconnections",[716,719,721,724,727,730],{"title":717,"_path":718},"Overview","\u002Fdocs\u002Fconnections\u002Foverview",{"title":720,"_path":671},"Sync settings",{"title":722,"_path":723},"Salesforce","\u002Fdocs\u002Fconnections\u002Fsalesforce",{"title":725,"_path":726},"Marketo","\u002Fdocs\u002Fconnections\u002Fmarketo",{"title":728,"_path":729},"Google Analytics 4","\u002Fdocs\u002Fconnections\u002Fgoogle-analytics-4",{"title":9,"_path":5},{"title":732,"_path":733,"children":734},"Analysis","\u002Fdocs\u002Fanalysis",[735,738,741,744],{"title":736,"_path":737},"Asking questions","\u002Fdocs\u002Fanalysis\u002Fask-a-question",{"title":739,"_path":740},"SQL editor","\u002Fdocs\u002Fanalysis\u002Fsql-editor",{"title":742,"_path":743},"Charts","\u002Fdocs\u002Fanalysis\u002Fcharts",{"title":745,"_path":746},"Tabs and sharing","\u002Fdocs\u002Fanalysis\u002Ftabs-and-sharing",{"title":748,"_path":749,"children":750},"Models","\u002Fdocs\u002Fmodels",[751],{"title":752,"_path":753},"Working with models","\u002Fdocs\u002Fmodels\u002Foverview",{"title":755,"_path":756,"children":757},"AI agents","\u002Fdocs\u002Fai-agents",[758,761],{"title":759,"_path":760},"Claude connector","\u002Fdocs\u002Fai-agents\u002Fclaude-connector",{"title":762,"_path":763},"Tools","\u002Fdocs\u002Fai-agents\u002Ftools",{"title":765,"_path":766,"children":767},"Administration","\u002Fdocs\u002Fadministration",[768,771,774],{"title":769,"_path":770},"People and roles","\u002Fdocs\u002Fadministration\u002Fpeople-and-roles",{"title":772,"_path":773},"Sign-in and SSO","\u002Fdocs\u002Fadministration\u002Fsign-in-and-sso",{"title":775,"_path":776},"Security","\u002Fdocs\u002Fadministration\u002Fsecurity",[778,779],{"_path":729,"title":728},{"_path":737,"title":736},1792546943081]