blob: fe4869a56749b644ac220bcf52b6a6e729f36132 [file] [log] [blame]
{"version":3,"sources":["webpack:///./src/pages/docs/Connecting to Databases/google-bigquery.mdx"],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","alt","src","isMDXComponent"],"mappings":"0PAQaA,G,UAAe,S,4OAC5B,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,mBADR,mBAGA,2EACF,6BAAGC,WAAW,KAAQ,CAChB,KAAQ,0CADd,cADE,KAIA,iBAAQ,CACN,GAAM,2BADR,2BAGA,yCAAwB,6BAAGA,WAAW,KAAQ,CAC1C,KAAQ,qCADY,QAAxB,oGAIA,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,2DAEL,iBAAQ,CACN,GAAM,0BADR,0BAGA,qJAEA,sBACE,kBAAIA,WAAW,MAAf,uMAEA,kBAAIA,WAAW,MAAf,yJAEF,uBAAK,gCAAMA,WAAW,OAAU,IAA3B,8VAaL,qBAAG,mBAAKC,IAAI,mCAAmCC,IAAI,2GACnD,iBAAQ,CACN,MAAS,GAET,kBAAIF,WAAW,MACb,iBAAGA,WAAW,MAAd,wDACA,iBAAGA,WAAW,MAAd,mDACA,mBAAKA,WAAW,MAAK,gCAAMA,WAAW,OAAU,IAA3B,8BAErB,iBAAGA,WAAW,MAAd,cAAkC,sBAAQA,WAAW,KAAnB,YAAlC,gCAA+G,sBAAQA,WAAW,KAAnB,gBAA/G,yEAEA,mBAAKA,WAAW,MAAK,gCAAMA,WAAW,OAAU,IAA3B,oEAIrB,iBAAGA,WAAW,MAAd,kDACA,mBAAKA,WAAW,MAAK,gCAAMA,WAAW,OAAU,IAA3B,+VAiBzB,sFACA,qBAAG,mBAAKC,IAAI,mCAAmCC,IAAI,2GACnD,sHACF,6BAAGF,WAAW,KAAQ,CAChB,KAAQ,yCADd,cADE,mB,0OAQJJ,EAAWO,gBAAiB","file":"component---src-pages-docs-connecting-to-databases-google-bigquery-mdx-d91267efad4013186cd4.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\": \"google-bigquery\"\n }}>{`Google BigQuery`}</h2>\n <p>{`The recommended connector library for BigQuery is\n`}<a parentName=\"p\" {...{\n \"href\": \"https://github.com/mxmzdlv/pybigquery\"\n }}>{`pybigquery`}</a>{`.`}</p>\n <h3 {...{\n \"id\": \"install-bigquery-driver\"\n }}>{`Install BigQuery Driver`}</h3>\n <p>{`Follow the steps `}<a parentName=\"p\" {...{\n \"href\": \"/docs/databases/dockeradddrivers\"\n }}>{`here`}</a>{` about how to\ninstall new database drivers when setting up Superset locally via docker-compose.`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`echo \"pybigquery\" >> ./docker/requirements-local.txt\n`}</code></pre>\n <h3 {...{\n \"id\": \"connecting-to-bigquery\"\n }}>{`Connecting to BigQuery`}</h3>\n <p>{`When adding a new BigQuery connection in Superset, you'll need to add the GCP Service Account\ncredentials file (as a JSON).`}</p>\n <ol>\n <li parentName=\"ol\">{`Create your Service Account via the Google Cloud Platform control panel, provide it access to the\nappropriate BigQuery datasets, and download the JSON configuration file for the service account.`}</li>\n <li parentName=\"ol\">{`In Superset, you can either upload that JSON or add the JSON blob in the following format (this should be the content of your credential JSON file):`}</li>\n </ol>\n <pre><code parentName=\"pre\" {...{}}>{`{\n \"type\": \"service_account\",\n \"project_id\": \"...\",\n \"private_key_id\": \"...\",\n \"private_key\": \"...\",\n \"client_email\": \"...\",\n \"client_id\": \"...\",\n \"auth_uri\": \"...\",\n \"token_uri\": \"...\",\n \"auth_provider_x509_cert_url\": \"...\",\n \"client_x509_cert_url\": \"...\"\n }\n`}</code></pre>\n <p><img alt=\"CleanShot 2021-10-22 at 04 18 11\" src=\"https://user-images.githubusercontent.com/52086618/138352958-a18ef9cb-8880-4ef1-88c1-452a9f1b8105.gif\" /></p>\n <ol {...{\n \"start\": 3\n }}>\n <li parentName=\"ol\">\n <p parentName=\"li\">{`Additionally, can connect via SQLAlchemy URI instead`}</p>\n <p parentName=\"li\">{` The connection string for BigQuery looks like:`}</p>\n <pre parentName=\"li\"><code parentName=\"pre\" {...{}}>{`bigquery://{project_id}\n`}</code></pre>\n <p parentName=\"li\">{` Go to the `}<strong parentName=\"p\">{`Advanced`}</strong>{` tab, Add a JSON blob to the `}<strong parentName=\"p\">{`Secure Extra`}</strong>{` field in the database configuration form with\nthe following format:`}</p>\n <pre parentName=\"li\"><code parentName=\"pre\" {...{}}>{`{\n\"credentials_info\": <contents of credentials JSON file>\n}\n`}</code></pre>\n <p parentName=\"li\">{`The resulting file should have this structure:`}</p>\n <pre parentName=\"li\"><code parentName=\"pre\" {...{}}>{`{\n \"credentials_info\": {\n \"type\": \"service_account\",\n \"project_id\": \"...\",\n \"private_key_id\": \"...\",\n \"private_key\": \"...\",\n \"client_email\": \"...\",\n \"client_id\": \"...\",\n \"auth_uri\": \"...\",\n \"token_uri\": \"...\",\n \"auth_provider_x509_cert_url\": \"...\",\n \"client_x509_cert_url\": \"...\"\n }\n }\n`}</code></pre>\n </li>\n </ol>\n <p>{`You should then be able to connect to your BigQuery datasets.`}</p>\n <p><img alt=\"CleanShot 2021-10-22 at 04 47 08\" src=\"https://user-images.githubusercontent.com/52086618/138354340-df57f477-d3e5-42d4-b032-d901c69d2213.gif\" /></p>\n <p>{`To be able to upload CSV or Excel files to BigQuery in Superset, you'll need to also add the\n`}<a parentName=\"p\" {...{\n \"href\": \"https://github.com/pydata/pandas-gbq\"\n }}>{`pandas_gbq`}</a>{` library.`}</p>\n\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"sourceRoot":""}