blob: 0c23c3234b61012856d482c57ad13dd263120f1a [file] [log] [blame]
"use strict";(self.webpackChunkdocs_v_2=self.webpackChunkdocs_v_2||[]).push([[2331],{66390:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(83117),a=(n(67294),n(3905));const o={title:"Snowflake",hide_title:!0,sidebar_position:29,version:1},s=void 0,i={unversionedId:"databases/snowflake",id:"databases/snowflake",title:"Snowflake",description:"Snowflake",source:"@site/docs/databases/snowflake.mdx",sourceDirName:"databases",slug:"/databases/snowflake",permalink:"/docs/databases/snowflake",draft:!1,editUrl:"https://github.com/apache/superset/tree/master/docs/docs/databases/snowflake.mdx",tags:[],version:"current",sidebarPosition:29,frontMatter:{title:"Snowflake",hide_title:!0,sidebar_position:29,version:1},sidebar:"tutorialSidebar",previous:{title:"Presto",permalink:"/docs/databases/presto"},next:{title:"Microsoft SQL Server",permalink:"/docs/databases/sql-server"}},l={},c=[{value:"Snowflake",id:"snowflake",level:2},{value:"Install Snowflake Driver",id:"install-snowflake-driver",level:3}],p={toc:c},u="wrapper";function d(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"snowflake"},"Snowflake"),(0,a.kt)("h3",{id:"install-snowflake-driver"},"Install Snowflake Driver"),(0,a.kt)("p",null,"Follow the steps ",(0,a.kt)("a",{parentName:"p",href:"/docs/databases/docker-add-drivers"},"here")," about how to\ninstall new database drivers when setting up Superset locally via docker compose."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'echo "snowflake-sqlalchemy" >> ./docker/requirements-local.txt\n')),(0,a.kt)("p",null,"The recommended connector library for Snowflake is\n",(0,a.kt)("a",{parentName:"p",href:"https://pypi.org/project/snowflake-sqlalchemy/"},"snowflake-sqlalchemy"),"."),(0,a.kt)("p",null,"The connection string for Snowflake looks like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"snowflake://{user}:{password}@{account}.{region}/{database}?role={role}&warehouse={warehouse}\n")),(0,a.kt)("p",null,"The schema is not necessary in the connection string, as it is defined per table/query. The role and\nwarehouse can be omitted if defaults are defined for the user, i.e."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"snowflake://{user}:{password}@{account}.{region}/{database}\n")),(0,a.kt)("p",null,"Make sure the user has privileges to access and use all required\ndatabases/schemas/tables/views/warehouses, as the Snowflake SQLAlchemy engine does not test for\nuser/role rights during engine creation by default. However, when pressing the \u201cTest Connection\u201d\nbutton in the Create or Edit Database dialog, user/role credentials are validated by passing\n\u201cvalidate_default_parameters\u201d: True to the connect() method during engine creation. If the user/role\nis not authorized to access the database, an error is recorded in the Superset logs."),(0,a.kt)("p",null,"And if you want connect Snowflake with ",(0,a.kt)("a",{parentName:"p",href:"https://docs.snowflake.com/en/user-guide/key-pair-auth.html#step-6-configure-the-snowflake-client-to-use-key-pair-authentication"},"Key Pair Authentication"),'.\nPlease make sure you have the key pair and the public key is registered in Snowflake.\nTo connect Snowflake with Key Pair Authentication, you need to add the following parameters to "SECURE EXTRA" field.'),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("em",{parentName:"strong"},"Please note that you need to merge multi-line private key content to one line and insert ",(0,a.kt)("inlineCode",{parentName:"em"},"\\n")," between each line"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'{\n "auth_method": "keypair",\n "auth_params": {\n "privatekey_body": "-----BEGIN ENCRYPTED PRIVATE KEY-----\\n...\\n...\\n-----END ENCRYPTED PRIVATE KEY-----",\n "privatekey_pass":"Your Private Key Password"\n }\n }\n')),(0,a.kt)("p",null,'If your private key is stored on server, you can replace "privatekey_body" with \u201cprivatekey_path\u201d in parameter.'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'{\n "auth_method": "keypair",\n "auth_params": {\n "privatekey_path":"Your Private Key Path",\n "privatekey_pass":"Your Private Key Password"\n }\n}\n')))}d.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),f=a,k=u["".concat(l,".").concat(f)]||u[f]||d[f]||o;return n?r.createElement(k,s(s({ref:t},p),{},{components:n})):r.createElement(k,s({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"}}]);