blob: c2d444bd48241369edb81da6fd4719f42ce9eb7c [file] [log] [blame]
{"version":3,"sources":["webpack:///./src/pages/docs/Connecting to Databases/docker-add-drivers.mdx"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","isMDXComponent"],"mappings":"wPAQaA,G,UAAe,S,+OAC5B,IAAMC,EAAc,CAClBD,gBAEIE,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,EACF,8BACD,OAAO,YAACJ,EAAD,eAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,cAG5E,iBAAQ,CACN,GAAM,yCADR,yCAGA,sLACuD,0BAAYC,WAAW,KAAvB,kBADvD,6CAGF,6BAAGA,WAAW,KAAQ,CAChB,KAAQ,oEADd,oBAHE,SAMF,6BAAGA,WAAW,KAAQ,CAChB,KAAQ,wEADd,wBANE,sCAUA,mRAGA,iBAAQ,CACN,GAAM,mCADR,oCAGA,yDAAwC,6BAAGA,WAAW,KAAQ,CAC1D,KAAQ,gDAD4B,mBAAxC,oBAGA,iHACA,iBAAQ,CACN,GAAM,0BADR,2BAGA,qFAAoE,0BAAYA,WAAW,KAAvB,kBAApE,2BACF,0BAAYA,WAAW,KAAvB,2BADE,0GAGA,+DAA8C,0BAAYA,WAAW,KAAvB,kBAA9C,uKAGA,+BAAc,0BAAYA,WAAW,KAAvB,2BACd,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,qEAGL,+DACA,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,4DAEL,+EACA,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,sCAEL,gGACA,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,wBAEL,iBAAQ,CACN,GAAM,sBADR,uBAGA,iHACA,oVAIA,qDACA,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,yEAEL,mDACA,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,4FAEL,+KAEA,yH,6OAKJJ,EAAWK,gBAAiB","file":"component---src-pages-docs-connecting-to-databases-docker-add-drivers-mdx-f0c3fbe2726d9b857381.js","sourcesContent":["import * as React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\n\nimport DefaultLayout from \"/home/runner/work/superset/superset/docs/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n\n\n <h2 {...{\n \"id\": \"adding-new-database-drivers-in-docker\"\n }}>{`Adding New Database Drivers in Docker`}</h2>\n <p>{`Superset requires a Python database driver to be installed for each additional type of database you\nwant to connect to. When setting up Superset locally via `}<inlineCode parentName=\"p\">{`docker-compose`}</inlineCode>{`, the drivers and packages\ncontained in\n`}<a parentName=\"p\" {...{\n \"href\": \"https://github.com/apache/superset/blob/master/requirements.txt\"\n }}>{`requirements.txt`}</a>{` and\n`}<a parentName=\"p\" {...{\n \"href\": \"https://github.com/apache/superset/blob/master/requirements-dev.txt\"\n }}>{`requirements-dev.txt`}</a>{`\nwill be installed automatically.`}</p>\n <p>{`In this section, we'll walk through how to install the MySQL connector library. The connector\nlibrary installation process is the same for all additional libraries and we'll end this section\nwith the recommended connector library for each database.`}</p>\n <h3 {...{\n \"id\": \"1-determine-the-driver-you-need\"\n }}>{`1. Determine the driver you need`}</h3>\n <p>{`To figure out how to install the `}<a parentName=\"p\" {...{\n \"href\": \"/docs/databases/installing-database-drivers\"\n }}>{`database driver`}</a>{` of your choice.`}</p>\n <p>{`In the example, we'll walk through the process of installing a MySQL driver in Superset.`}</p>\n <h3 {...{\n \"id\": \"2-install-mysql-driver\"\n }}>{`2. Install MySQL Driver`}</h3>\n <p>{`As we are currently running inside of a Docker container via `}<inlineCode parentName=\"p\">{`docker compose`}</inlineCode>{`, we cannot simply run\n`}<inlineCode parentName=\"p\">{`pip install mysqlclient`}</inlineCode>{` on our local shell and expect the drivers to be installed within the\nDocker containers for superset.`}</p>\n <p>{`In order to address this, the Superset `}<inlineCode parentName=\"p\">{`docker compose`}</inlineCode>{` setup comes with a mechanism for you to\ninstall packages locally, which will be ignored by Git for the purposes of local development. Please\nfollow these steps:`}</p>\n <p>{`Create `}<inlineCode parentName=\"p\">{`requirements-local.txt`}</inlineCode></p>\n <pre><code parentName=\"pre\" {...{}}>{`# From the repo root...\ntouch ./docker/requirements-local.txt\n`}</code></pre>\n <p>{`Add the driver selected in step above:`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`echo \"mysqlclient\" >> ./docker/requirements-local.txt\n`}</code></pre>\n <p>{`Rebuild your local image with the new driver baked in:`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`docker-compose build --force-rm\n`}</code></pre>\n <p>{`After the rebuild is complete, which make take a few minutes, relaunch:`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`docker-compose up\n`}</code></pre>\n <h3 {...{\n \"id\": \"3-connect-to-mysql\"\n }}>{`3. Connect to MySQL`}</h3>\n <p>{`Now that you've got a MySQL driver installed locally, you should be able to test it out.`}</p>\n <p>{`We can now create a Datasource in Superset that can be used to connect to a MySQL instance. Assuming\nyour MySQL instance is running locally and can be accessed via localhost, use the following\nconnection string in “SQL Alchemy URI”, by going to Sources > Databases > + icon (to add a new\ndatasource) in Superset.`}</p>\n <p>{`For Docker running in Linux:`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`mysql://mysqluser:mysqluserpassword@localhost/example?charset=utf8\n`}</code></pre>\n <p>{`For Docker running in OSX:`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`mysql://mysqluser:mysqluserpassword@docker.for.mac.host.internal/example?charset=utf8\n`}</code></pre>\n <p>{`Then click “Test Connection”, which should give you an “OK” message. If not, please look at your\nterminal for error messages, and reach out for help.`}</p>\n <p>{`You can repeat this process for every database you want superset to be able to connect to.`}</p>\n\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""}