blob: b26cecaca457f53fb0d2ffe179ee5e17b64ce459 [file] [log] [blame]
{"version":3,"sources":["webpack:///./src/pages/docs/Connecting to Databases/extra-settings.mdx"],"names":["_frontmatter","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","isMDXComponent"],"mappings":"wPAMaA,G,UAAe,S,2OAE5B,IAKMC,EAAYC,IACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,EACF,8BACD,OAAO,YAACJ,EAAD,eAAeI,EAAf,CAAsBD,WAAYA,EAAYE,QAAQ,cAC3D,iBAAQ,CACN,GAAM,2BADR,2BAGA,iBAAQ,CACN,GAAM,iCADR,iCAGA,wIAEE,qBAAY,CACV,WAAc,KADhB,iBAFF,2BAME,qBAAY,CACV,WAAc,KADhB,SANF,0BAUA,oFACE,yBAAgB,CACd,WAAc,KADhB,iBADF,mCAME,yBAAgB,CACd,WAAc,KADhB,4BANF,oBAUE,yBAAgB,CACd,WAAc,KADhB,mBAVF,2BAeE,yBAAgB,CACd,WAAc,KADhB,uBAfF,6DAmBA,iBAAQ,CACN,GAAM,WADR,WAGA,qEACE,qBAAY,CACV,WAAc,KADhB,UADF,yCAME,qBAAY,CACV,WAAc,KADhB,YANF,mEAUE,qBAAY,CACV,WAAc,KADhB,UAVF,sBAeE,qBAAY,CACV,WAAc,KADhB,eAfF,2CAmBA,iBAAQ,CACN,GAAM,sDADR,sDAGA,2OAGA,uFACE,yBAAgB,CACd,WAAc,KADhB,mBADF,wEAME,yBAAgB,CACd,WAAc,KADhB,oCANF,oDAWA,uBAAK,mBAAU,CACX,UAAa,kBACb,WAAc,OAFb,kLASL,qGAEE,yBAAgB,CACd,WAAc,KADhB,oCAFF,uCAMA,uBAAK,mBAAU,CACX,UAAa,kBACb,WAAc,OAFb,4OAUL,iBAAQ,CACN,GAAM,2BADR,2BAGA,wCACE,yBAAgB,CACd,WAAc,KADhB,SADF,iBAKE,qBAAY,CACV,WAAc,KADhB,kBALF,2BASA,uBAAK,mBAAU,CACX,UAAa,gBACb,WAAc,OAFb,wM,yOAiBTH,EAAWI,gBAAiB","file":"component---src-pages-docs-connecting-to-databases-extra-settings-mdx-b7050544644ab77cb036.js","sourcesContent":["import * as React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nimport DefaultLayout from \"/Users/evan/GitHub/incubator-superset_preset/docs/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\n\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n return <div {...props} />;\n};\n\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...props} components={components} mdxType=\"MDXLayout\">\n <h2 {...{\n \"id\": \"extra-database-settings\"\n }}>{`Extra Database Settings`}</h2>\n <h3 {...{\n \"id\": \"deeper-sqlalchemy-integration\"\n }}>{`Deeper SQLAlchemy Integration`}</h3>\n <p>{`It is possible to tweak the database connection information using the parameters exposed by\nSQLAlchemy. In the `}\n <strong {...{\n \"parentName\": \"p\"\n }}>{`Database edit`}</strong>\n {` view, you can edit the `}\n <strong {...{\n \"parentName\": \"p\"\n }}>{`Extra`}</strong>\n {` field as a JSON blob.`}</p>\n <p>{`This JSON string contains extra configuration elements. The `}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`engine_params`}</inlineCode>\n {` object gets unpacked\ninto the `}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`sqlalchemy.create_engine`}</inlineCode>\n {` call, while the `}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`metadata_params`}</inlineCode>\n {` get unpacked into the\n`}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`sqlalchemy.MetaData`}</inlineCode>\n {` call. Refer to the SQLAlchemy docs for more information.`}</p>\n <h3 {...{\n \"id\": \"schemas\"\n }}>{`Schemas`}</h3>\n <p>{`Databases like Postgres and Redshift use the `}\n <strong {...{\n \"parentName\": \"p\"\n }}>{`schema`}</strong>\n {` as the logical entity on top of the\n`}\n <strong {...{\n \"parentName\": \"p\"\n }}>{`database`}</strong>\n {`. For Superset to connect to a specific schema, you can set the `}\n <strong {...{\n \"parentName\": \"p\"\n }}>{`schema`}</strong>\n {` parameter in\nthe `}\n <strong {...{\n \"parentName\": \"p\"\n }}>{`Edit Tables`}</strong>\n {` form (Sources > Tables > Edit record).`}</p>\n <h3 {...{\n \"id\": \"external-password-store-for-sqlalchemy-connections\"\n }}>{`External Password Store for SQLAlchemy Connections`}</h3>\n <p>{`Superset can be configured to use an external store for database passwords. This is useful if you a\nrunning a custom secret distribution framework and do not wish to store secrets in Superset’s meta\ndatabase.`}</p>\n <p>{`Example: Write a function that takes a single argument of type `}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`sqla.engine.url`}</inlineCode>\n {` and returns the\npassword for the given connection string. Then set `}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`SQLALCHEMY_CUSTOM_PASSWORD_STORE`}</inlineCode>\n {` in your config\nfile to point to that function.`}</p>\n <pre><code {...{\n \"className\": \"language-python\",\n \"parentName\": \"pre\"\n }}>{`def example_lookup_password(url):\n secret = <<get password from external framework>>\n return 'secret'\n\nSQLALCHEMY_CUSTOM_PASSWORD_STORE = example_lookup_password\n`}</code></pre>\n <p>{`A common pattern is to use environment variables to make secrets available.\n`}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`SQLALCHEMY_CUSTOM_PASSWORD_STORE`}</inlineCode>\n {` can also be used for that purpose.`}</p>\n <pre><code {...{\n \"className\": \"language-python\",\n \"parentName\": \"pre\"\n }}>{`def example_password_as_env_var(url):\n# assuming the uri looks like\n# mysql://localhost?superset_user:{SUPERSET_PASSWORD}\nreturn url.password.format(os.environ)\n\nSQLALCHEMY_CUSTOM_PASSWORD_STORE = example_password_as_env_var\n`}</code></pre>\n <h3 {...{\n \"id\": \"ssl-access-to-databases\"\n }}>{`SSL Access to Databases`}</h3>\n <p>{`You can use the `}\n <inlineCode {...{\n \"parentName\": \"p\"\n }}>{`Extra`}</inlineCode>\n {` field in the `}\n <strong {...{\n \"parentName\": \"p\"\n }}>{`Edit Databases`}</strong>\n {` form to configure SSL:`}</p>\n <pre><code {...{\n \"className\": \"language-JSON\",\n \"parentName\": \"pre\"\n }}>{`{\n \"metadata_params\": {},\n \"engine_params\": {\n \"connect_args\":{\n \"sslmode\":\"require\",\n \"sslrootcert\": \"/path/to/my/pem\"\n }\n }\n}\n`}</code></pre>\n\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""}