mirror of
https://github.com/apache/superset.git
synced 2026-05-08 09:25:56 +00:00
498 lines
31 KiB
HTML
498 lines
31 KiB
HTML
<!DOCTYPE html>
|
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<title>Installation & Configuration — caravel documentation</title>
|
|
|
|
<link rel="stylesheet" href="_static/basic.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/bootstrap-3.3.6/css/bootstrap.min.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/bootstrap-3.3.6/css/bootstrap-theme.min.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/docs.css" type="text/css" />
|
|
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT: './',
|
|
VERSION: '',
|
|
COLLAPSE_INDEX: false,
|
|
FILE_SUFFIX: '.html',
|
|
HAS_SOURCE: true
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
|
<script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
|
|
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
|
|
<script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script>
|
|
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
|
|
<link rel="top" title="caravel documentation" href="index.html" />
|
|
<link rel="next" title="Tutorial" href="tutorial.html" />
|
|
<link rel="prev" title="Overview" href="index.html" />
|
|
<meta charset='utf-8'>
|
|
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
|
|
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
|
</head>
|
|
<body role="document">
|
|
|
|
<div id="navbar" class="navbar navbar-default ">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
|
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
</button>
|
|
<a class="navbar-brand" href="index.html">
|
|
Caravel Documentation</a>
|
|
<span class="navbar-text navbar-version pull-left"><b></b></span>
|
|
</div>
|
|
|
|
<div class="collapse navbar-collapse nav-collapse">
|
|
<ul class="nav navbar-nav">
|
|
|
|
|
|
<li class="dropdown globaltoc-container">
|
|
<a role="button"
|
|
id="dLabelGlobalToc"
|
|
data-toggle="dropdown"
|
|
data-target="#"
|
|
href="index.html">Topics <b class="caret"></b></a>
|
|
<ul class="dropdown-menu globaltoc"
|
|
role="menu"
|
|
aria-labelledby="dLabelGlobalToc"><ul class="current">
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Installation & Configuration</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">Tutorial</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="security.html">Security</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="videos.html">Videos</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="gallery.html">Gallery</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="druid.html">Druid</a></li>
|
|
<li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a></li>
|
|
</ul>
|
|
</ul>
|
|
</li>
|
|
|
|
<li class="dropdown">
|
|
<a role="button"
|
|
id="dLabelLocalToc"
|
|
data-toggle="dropdown"
|
|
data-target="#"
|
|
href="#">Page <b class="caret"></b></a>
|
|
<ul class="dropdown-menu localtoc"
|
|
role="menu"
|
|
aria-labelledby="dLabelLocalToc"><ul>
|
|
<li><a class="reference internal" href="#">Installation & Configuration</a><ul>
|
|
<li><a class="reference internal" href="#getting-started">Getting Started</a></li>
|
|
<li><a class="reference internal" href="#os-dependencies">OS dependencies</a></li>
|
|
<li><a class="reference internal" href="#python-virtualenv">Python virtualenv</a></li>
|
|
<li><a class="reference internal" href="#python-s-setup-tools-and-pip">Python’s setup tools and pip</a></li>
|
|
<li><a class="reference internal" href="#caravel-installation-and-initialization">Caravel installation and initialization</a></li>
|
|
<li><a class="reference internal" href="#configuration-behind-a-load-balancer">Configuration behind a load balancer</a></li>
|
|
<li><a class="reference internal" href="#configuration">Configuration</a></li>
|
|
<li><a class="reference internal" href="#database-dependencies">Database dependencies</a></li>
|
|
<li><a class="reference internal" href="#caching">Caching</a></li>
|
|
<li><a class="reference internal" href="#deeper-sqlalchemy-integration">Deeper SQLAlchemy integration</a></li>
|
|
<li><a class="reference internal" href="#schemas-postgres-redshift">Schemas (Postgres & Redshift)</a></li>
|
|
<li><a class="reference internal" href="#ssl-access-to-databases">SSL Access to databases</a></li>
|
|
<li><a class="reference internal" href="#druid">Druid</a></li>
|
|
<li><a class="reference internal" href="#cors">CORS</a></li>
|
|
<li><a class="reference internal" href="#upgrading">Upgrading</a></li>
|
|
<li><a class="reference internal" href="#sql-lab">SQL Lab</a></li>
|
|
<li><a class="reference internal" href="#making-your-own-build">Making your own build</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="hidden-sm"></li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<form class="navbar-form navbar-right" action="search.html" method="get">
|
|
<div class="form-group">
|
|
<input type="text" name="q" class="form-control" placeholder="Search" />
|
|
</div>
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="container mainbody">
|
|
|
|
<div class="section" id="installation-configuration">
|
|
<h1>Installation & Configuration<a class="headerlink" href="#installation-configuration" title="Permalink to this headline">¶</a></h1>
|
|
<div class="section" id="getting-started">
|
|
<h2>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h2>
|
|
<p>Caravel is tested using Python 2.7 and Python 3.4+. Python 3 is the recommended version,
|
|
Python 2.6 won’t be supported.</p>
|
|
</div>
|
|
<div class="section" id="os-dependencies">
|
|
<h2>OS dependencies<a class="headerlink" href="#os-dependencies" title="Permalink to this headline">¶</a></h2>
|
|
<p>Caravel stores database connection information in its metadata database.
|
|
For that purpose, we use the <code class="docutils literal"><span class="pre">cryptography</span></code> Python library to encrypt
|
|
connection passwords. Unfortunately this library has OS level dependencies.</p>
|
|
<p>You may want to attempt the next step
|
|
(“Caravel installation and initialization”) and come back to this step if
|
|
you encounter an error.</p>
|
|
<p>Here’s how to install them:</p>
|
|
<p>For <strong>Debian</strong> and <strong>Ubuntu</strong>, the following command will ensure that
|
|
the required dependencies are installed:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">build</span><span class="o">-</span><span class="n">essential</span> <span class="n">libssl</span><span class="o">-</span><span class="n">dev</span> <span class="n">libffi</span><span class="o">-</span><span class="n">dev</span> <span class="n">python</span><span class="o">-</span><span class="n">dev</span> <span class="n">python</span><span class="o">-</span><span class="n">pip</span> <span class="n">libsasl2</span><span class="o">-</span><span class="n">dev</span> <span class="n">libldap2</span><span class="o">-</span><span class="n">dev</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>For <strong>Fedora</strong> and <strong>RHEL-derivatives</strong>, the following command will ensure
|
|
that the required dependencies are installed:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">yum</span> <span class="n">upgrade</span> <span class="n">python</span><span class="o">-</span><span class="n">setuptools</span>
|
|
<span class="n">sudo</span> <span class="n">yum</span> <span class="n">install</span> <span class="n">gcc</span> <span class="n">libffi</span><span class="o">-</span><span class="n">devel</span> <span class="n">python</span><span class="o">-</span><span class="n">devel</span> <span class="n">python</span><span class="o">-</span><span class="n">pip</span> <span class="n">python</span><span class="o">-</span><span class="n">wheel</span> <span class="n">openssl</span><span class="o">-</span><span class="n">devel</span> <span class="n">libsasl2</span><span class="o">-</span><span class="n">devel</span> <span class="n">openldap</span><span class="o">-</span><span class="n">devel</span>
|
|
</pre></div>
|
|
</div>
|
|
<p><strong>OSX</strong>, system python is not recommended. brew’s python also ships with pip</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">brew</span> <span class="n">install</span> <span class="n">pkg</span><span class="o">-</span><span class="n">config</span> <span class="n">libffi</span> <span class="n">openssl</span> <span class="n">python</span>
|
|
<span class="n">env</span> <span class="n">LDFLAGS</span><span class="o">=</span><span class="s2">"-L$(brew --prefix openssl)/lib"</span> <span class="n">CFLAGS</span><span class="o">=</span><span class="s2">"-I$(brew --prefix openssl)/include"</span> <span class="n">pip</span> <span class="n">install</span> <span class="n">cryptography</span>
|
|
</pre></div>
|
|
</div>
|
|
<p><strong>Windows</strong> isn’t officially supported at this point, but if you want to
|
|
attempt it, download <a class="reference external" href="https://bootstrap.pypa.io/get-pip.py">get-pip.py</a>, and run <code class="docutils literal"><span class="pre">python</span> <span class="pre">get-pip.py</span></code> which may need admin access. Then run the following:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">C</span><span class="p">:</span>\<span class="o">></span> <span class="n">pip</span> <span class="n">install</span> <span class="n">cryptography</span>
|
|
|
|
<span class="c1"># You may also have to create C:\Temp</span>
|
|
<span class="n">C</span><span class="p">:</span>\<span class="o">></span> <span class="n">md</span> <span class="n">C</span><span class="p">:</span>\<span class="n">Temp</span>
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="python-virtualenv">
|
|
<h2>Python virtualenv<a class="headerlink" href="#python-virtualenv" title="Permalink to this headline">¶</a></h2>
|
|
<p>It is recommended to install Caravel inside a virtualenv. Python 3 already ships virtualenv, for
|
|
Python 2 you need to install it. If it’s packaged for your operating systems install it from there
|
|
otherwise you can install from pip:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">virtualenv</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>You can create and activate a virtualenv by:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># virtualenv is shipped in Python 3 as pyvenv</span>
|
|
<span class="n">virtualenv</span> <span class="n">venv</span>
|
|
<span class="o">.</span> <span class="o">./</span><span class="n">venv</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">activate</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>On windows the syntax for activating it is a bit different:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">venv</span>\<span class="n">Scripts</span>\<span class="n">activate</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>Once you activated your virtualenv everything you are doing is confined inside the virtualenv.
|
|
To exit a virtualenv just type <code class="docutils literal"><span class="pre">deactivate</span></code>.</p>
|
|
</div>
|
|
<div class="section" id="python-s-setup-tools-and-pip">
|
|
<h2>Python’s setup tools and pip<a class="headerlink" href="#python-s-setup-tools-and-pip" title="Permalink to this headline">¶</a></h2>
|
|
<p>Put all the chances on your side by getting the very latest <code class="docutils literal"><span class="pre">pip</span></code>
|
|
and <code class="docutils literal"><span class="pre">setuptools</span></code> libraries.:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="o">--</span><span class="n">upgrade</span> <span class="n">setuptools</span> <span class="n">pip</span>
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="caravel-installation-and-initialization">
|
|
<h2>Caravel installation and initialization<a class="headerlink" href="#caravel-installation-and-initialization" title="Permalink to this headline">¶</a></h2>
|
|
<p>Follow these few simple steps to install Caravel.:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># Install caravel</span>
|
|
<span class="n">pip</span> <span class="n">install</span> <span class="n">caravel</span>
|
|
|
|
<span class="c1"># Create an admin user</span>
|
|
<span class="n">fabmanager</span> <span class="n">create</span><span class="o">-</span><span class="n">admin</span> <span class="o">--</span><span class="n">app</span> <span class="n">caravel</span>
|
|
|
|
<span class="c1"># Initialize the database</span>
|
|
<span class="n">caravel</span> <span class="n">db</span> <span class="n">upgrade</span>
|
|
|
|
<span class="c1"># Load some data to play with</span>
|
|
<span class="n">caravel</span> <span class="n">load_examples</span>
|
|
|
|
<span class="c1"># Create default roles and permissions</span>
|
|
<span class="n">caravel</span> <span class="n">init</span>
|
|
|
|
<span class="c1"># Start the web server on port 8088</span>
|
|
<span class="n">caravel</span> <span class="n">runserver</span> <span class="o">-</span><span class="n">p</span> <span class="mi">8088</span>
|
|
|
|
<span class="c1"># To start a development web server, use the -d switch</span>
|
|
<span class="c1"># caravel runserver -d</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>After installation, you should be able to point your browser to the right
|
|
hostname:port <a class="reference external" href="http://localhost:8088">http://localhost:8088</a>, login using
|
|
the credential you entered while creating the admin account, and navigate to
|
|
<cite>Menu -> Admin -> Refresh Metadata</cite>. This action should bring in all of
|
|
your datasources for Caravel to be aware of, and they should show up in
|
|
<cite>Menu -> Datasources</cite>, from where you can start playing with your data!</p>
|
|
<p>Please note that <em>gunicorn</em>, Caravel default application server, does not
|
|
work on Windows so you need to use the development web server.
|
|
The development web server though is not intended to be used on production systems
|
|
so better use a supported platform that can run <em>gunicorn</em>.</p>
|
|
</div>
|
|
<div class="section" id="configuration-behind-a-load-balancer">
|
|
<h2>Configuration behind a load balancer<a class="headerlink" href="#configuration-behind-a-load-balancer" title="Permalink to this headline">¶</a></h2>
|
|
<p>If you are running caravel behind a load balancer or reverse proxy (e.g. NGINX
|
|
or ELB on AWS), you may need to utilise a healthcheck endpoint so that your
|
|
load balancer knows if your caravel instance is running. This is provided
|
|
at <code class="docutils literal"><span class="pre">/health</span></code> which will return a 200 response containing “OK” if the
|
|
webserver is running.</p>
|
|
<p>If the load balancer is inserting X-Forwarded-For/X-Forwarded-Proto headers, you
|
|
should set <cite>ENABLE_PROXY_FIX = True</cite> in the caravel config file to extract and use
|
|
the headers.</p>
|
|
</div>
|
|
<div class="section" id="configuration">
|
|
<h2>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h2>
|
|
<p>To configure your application, you need to create a file (module)
|
|
<code class="docutils literal"><span class="pre">caravel_config.py</span></code> and make sure it is in your PYTHONPATH. Here are some
|
|
of the parameters you can copy / paste in that configuration module:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1">#---------------------------------------------------------</span>
|
|
<span class="c1"># Caravel specific config</span>
|
|
<span class="c1">#---------------------------------------------------------</span>
|
|
<span class="n">ROW_LIMIT</span> <span class="o">=</span> <span class="mi">5000</span>
|
|
<span class="n">CARAVEL_WORKERS</span> <span class="o">=</span> <span class="mi">4</span>
|
|
|
|
<span class="n">CARAVEL_WEBSERVER_PORT</span> <span class="o">=</span> <span class="mi">8088</span>
|
|
<span class="c1">#---------------------------------------------------------</span>
|
|
|
|
<span class="c1">#---------------------------------------------------------</span>
|
|
<span class="c1"># Flask App Builder configuration</span>
|
|
<span class="c1">#---------------------------------------------------------</span>
|
|
<span class="c1"># Your App secret key</span>
|
|
<span class="n">SECRET_KEY</span> <span class="o">=</span> <span class="s1">'</span><span class="se">\2\1</span><span class="s1">thisismyscretkey</span><span class="se">\1\2</span><span class="s1">\e\y\y\h'</span>
|
|
|
|
<span class="c1"># The SQLAlchemy connection string to your database backend</span>
|
|
<span class="c1"># This connection defines the path to the database that stores your</span>
|
|
<span class="c1"># caravel metadata (slices, connections, tables, dashboards, ...).</span>
|
|
<span class="c1"># Note that the connection information to connect to the datasources</span>
|
|
<span class="c1"># you want to explore are managed directly in the web UI</span>
|
|
<span class="n">SQLALCHEMY_DATABASE_URI</span> <span class="o">=</span> <span class="s1">'sqlite:////path/to/caravel.db'</span>
|
|
|
|
<span class="c1"># Flask-WTF flag for CSRF</span>
|
|
<span class="n">CSRF_ENABLED</span> <span class="o">=</span> <span class="kc">True</span>
|
|
|
|
<span class="c1"># Set this API key to enable Mapbox visualizations</span>
|
|
<span class="n">MAPBOX_API_KEY</span> <span class="o">=</span> <span class="s1">''</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>This file also allows you to define configuration parameters used by
|
|
Flask App Builder, the web framework used by Caravel. Please consult
|
|
the <a class="reference external" href="http://flask-appbuilder.readthedocs.org/en/latest/config.html">Flask App Builder Documentation</a>
|
|
for more information on how to configure Caravel.</p>
|
|
<p>Please make sure to change:</p>
|
|
<ul class="simple">
|
|
<li><em>SQLALCHEMY_DATABASE_URI</em>, by default it is stored at <em>~/.caravel/caravel.db</em></li>
|
|
<li><em>SECRET_KEY</em>, to a long random string</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section" id="database-dependencies">
|
|
<h2>Database dependencies<a class="headerlink" href="#database-dependencies" title="Permalink to this headline">¶</a></h2>
|
|
<p>Caravel does not ship bundled with connectivity to databases, except
|
|
for Sqlite, which is part of the Python standard library.
|
|
You’ll need to install the required packages for the database you
|
|
want to use as your metadata database as well as the packages needed to
|
|
connect to the databases you want to access through Caravel.</p>
|
|
<p>Here’s a list of some of the recommended packages.</p>
|
|
<table border="1" class="docutils">
|
|
<colgroup>
|
|
<col width="15%" />
|
|
<col width="37%" />
|
|
<col width="49%" />
|
|
</colgroup>
|
|
<thead valign="bottom">
|
|
<tr class="row-odd"><th class="head">database</th>
|
|
<th class="head">pypi package</th>
|
|
<th class="head">SQLAlchemy URI prefix</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody valign="top">
|
|
<tr class="row-even"><td>MySQL</td>
|
|
<td><code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">mysqlclient</span></code></td>
|
|
<td><code class="docutils literal"><span class="pre">mysql://</span></code></td>
|
|
</tr>
|
|
<tr class="row-odd"><td>Postgres</td>
|
|
<td><code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">psycopg2</span></code></td>
|
|
<td><code class="docutils literal"><span class="pre">postgresql+psycopg2://</span></code></td>
|
|
</tr>
|
|
<tr class="row-even"><td>Presto</td>
|
|
<td><code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">pyhive</span></code></td>
|
|
<td><code class="docutils literal"><span class="pre">presto://</span></code></td>
|
|
</tr>
|
|
<tr class="row-odd"><td>Oracle</td>
|
|
<td><code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">cx_Oracle</span></code></td>
|
|
<td><code class="docutils literal"><span class="pre">oracle://</span></code></td>
|
|
</tr>
|
|
<tr class="row-even"><td>sqlite</td>
|
|
<td> </td>
|
|
<td><code class="docutils literal"><span class="pre">sqlite://</span></code></td>
|
|
</tr>
|
|
<tr class="row-odd"><td>Redshift</td>
|
|
<td><code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">sqlalchemy-redshift</span></code></td>
|
|
<td><code class="docutils literal"><span class="pre">redshift+psycopg2://</span></code></td>
|
|
</tr>
|
|
<tr class="row-even"><td>MSSQL</td>
|
|
<td><code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">pymssql</span></code></td>
|
|
<td><code class="docutils literal"><span class="pre">mssql://</span></code></td>
|
|
</tr>
|
|
<tr class="row-odd"><td>Impala</td>
|
|
<td><code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">impyla</span></code></td>
|
|
<td><code class="docutils literal"><span class="pre">impala://</span></code></td>
|
|
</tr>
|
|
<tr class="row-even"><td>SparkSQL</td>
|
|
<td><code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">pyhive</span></code></td>
|
|
<td><code class="docutils literal"><span class="pre">jdbc+hive://</span></code></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Note that many other database are supported, the main criteria being the
|
|
existence of a functional SqlAlchemy dialect and Python driver. Googling
|
|
the keyword <code class="docutils literal"><span class="pre">sqlalchemy</span></code> in addition of a keyword that describes the
|
|
database you want to connect to should get you to the right place.</p>
|
|
</div>
|
|
<div class="section" id="caching">
|
|
<h2>Caching<a class="headerlink" href="#caching" title="Permalink to this headline">¶</a></h2>
|
|
<p>Caravel uses <a class="reference external" href="https://pythonhosted.org/Flask-Cache/">Flask-Cache</a> for
|
|
caching purpose. Configuring your caching backend is as easy as providing
|
|
a <code class="docutils literal"><span class="pre">CACHE_CONFIG</span></code>, constant in your <code class="docutils literal"><span class="pre">caravel_config.py</span></code> that
|
|
complies with the Flask-Cache specifications.</p>
|
|
<p>Flask-Cache supports multiple caching backends (Redis, Memcached,
|
|
SimpleCache (in-memory), or the local filesystem). If you are going to use
|
|
Memcached please use the pylibmc client library as python-memcached does
|
|
not handle storing binary data correctly. If you use Redis, please install
|
|
[python-redis](<a class="reference external" href="https://pypi.python.org/pypi/redis">https://pypi.python.org/pypi/redis</a>).</p>
|
|
<p>For setting your timeouts, this is done in the Caravel metadata and goes
|
|
up the “timeout searchpath”, from your slice configuration, to your
|
|
data source’s configuration, to your database’s and ultimately falls back
|
|
into your global default defined in <code class="docutils literal"><span class="pre">CACHE_CONFIG</span></code>.</p>
|
|
</div>
|
|
<div class="section" id="deeper-sqlalchemy-integration">
|
|
<h2>Deeper SQLAlchemy integration<a class="headerlink" href="#deeper-sqlalchemy-integration" title="Permalink to this headline">¶</a></h2>
|
|
<p>It is possible to tweak the database connection information using the
|
|
parameters exposed by SQLAlchemy. In the <code class="docutils literal"><span class="pre">Database</span></code> edit view, you will
|
|
find an <code class="docutils literal"><span class="pre">extra</span></code> field as a <code class="docutils literal"><span class="pre">JSON</span></code> blob.</p>
|
|
<a class="reference internal image-reference" href="_images/add_db.png"><img alt="_images/add_db.png" src="_images/add_db.png" style="width: 534.0px; height: 370.8px;" /></a>
|
|
<p>This JSON string contains extra configuration elements. The <code class="docutils literal"><span class="pre">engine_params</span></code>
|
|
object gets unpacked into the
|
|
<a class="reference external" href="http://docs.sqlalchemy.org/en/latest/core/engines.html#sqlalchemy.create_engine">sqlalchemy.create_engine</a> call,
|
|
while the <code class="docutils literal"><span class="pre">metadata_params</span></code> get unpacked into the
|
|
<a class="reference external" href="http://docs.sqlalchemy.org/en/rel_1_0/core/metadata.html#sqlalchemy.schema.MetaData">sqlalchemy.MetaData</a> call. Refer to the SQLAlchemy docs for more information.</p>
|
|
</div>
|
|
<div class="section" id="schemas-postgres-redshift">
|
|
<h2>Schemas (Postgres & Redshift)<a class="headerlink" href="#schemas-postgres-redshift" title="Permalink to this headline">¶</a></h2>
|
|
<p>Postgres and Redshift, as well as other database,
|
|
use the concept of <strong>schema</strong> as a logical entity
|
|
on top of the <strong>database</strong>. For Caravel to connect to a specific schema,
|
|
there’s a <strong>schema</strong> parameter you can set in the table form.</p>
|
|
</div>
|
|
<div class="section" id="ssl-access-to-databases">
|
|
<h2>SSL Access to databases<a class="headerlink" href="#ssl-access-to-databases" title="Permalink to this headline">¶</a></h2>
|
|
<p>This example worked with a MySQL database that requires SSL. The configuration
|
|
may differ with other backends. This is what was put in the <code class="docutils literal"><span class="pre">extra</span></code>
|
|
parameter</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">{</span>
|
|
<span class="s2">"metadata_params"</span><span class="p">:</span> <span class="p">{},</span>
|
|
<span class="s2">"engine_params"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="s2">"connect_args"</span><span class="p">:{</span>
|
|
<span class="s2">"sslmode"</span><span class="p">:</span><span class="s2">"require"</span><span class="p">,</span>
|
|
<span class="s2">"sslrootcert"</span><span class="p">:</span> <span class="s2">"/path/to/my/pem"</span>
|
|
<span class="p">}</span>
|
|
<span class="p">}</span>
|
|
<span class="p">}</span>
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="druid">
|
|
<h2>Druid<a class="headerlink" href="#druid" title="Permalink to this headline">¶</a></h2>
|
|
<ul class="simple">
|
|
<li>From the UI, enter the information about your clusters in the
|
|
<code class="docutils literal"><span class="pre">Admin->Clusters</span></code> menu by hitting the + sign.</li>
|
|
<li>Once the Druid cluster connection information is entered, hit the
|
|
<code class="docutils literal"><span class="pre">Admin->Refresh</span> <span class="pre">Metadata</span></code> menu item to populate</li>
|
|
<li>Navigate to your datasources</li>
|
|
</ul>
|
|
<p>Note that you can run the <code class="docutils literal"><span class="pre">caravel</span> <span class="pre">refresh_druid</span></code> command to refresh the
|
|
metadata from your Druid cluster(s)</p>
|
|
</div>
|
|
<div class="section" id="cors">
|
|
<h2>CORS<a class="headerlink" href="#cors" title="Permalink to this headline">¶</a></h2>
|
|
<p>The extra CORS Dependency must be installed:</p>
|
|
<blockquote>
|
|
<div>caravel[cors]</div></blockquote>
|
|
<p>The following keys in <cite>caravel_config.py</cite> can be specified to configure CORS:</p>
|
|
<ul class="simple">
|
|
<li><code class="docutils literal"><span class="pre">ENABLE_CORS</span></code>: Must be set to True in order to enable CORS</li>
|
|
<li><code class="docutils literal"><span class="pre">CORS_OPTIONS</span></code>: options passed to Flask-CORS (<cite>documentation <http://flask-cors.corydolphin.com/en/latest/api.html#extension></cite>)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section" id="upgrading">
|
|
<h2>Upgrading<a class="headerlink" href="#upgrading" title="Permalink to this headline">¶</a></h2>
|
|
<p>Upgrading should be as straightforward as running:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">caravel</span> <span class="o">--</span><span class="n">upgrade</span>
|
|
<span class="n">caravel</span> <span class="n">db</span> <span class="n">upgrade</span>
|
|
<span class="n">caravel</span> <span class="n">init</span>
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="sql-lab">
|
|
<h2>SQL Lab<a class="headerlink" href="#sql-lab" title="Permalink to this headline">¶</a></h2>
|
|
<p>SQL Lab is a powerful SQL IDE that works with all SQLAlchemy compatible
|
|
databases out there. By default, queries are run in a web request, and
|
|
may eventually timeout as queries exceed the maximum duration of a web
|
|
request in your environment, whether it’d be a reverse proxy or the Caravel
|
|
server itself.</p>
|
|
<p>In the modern analytics world, it’s not uncommon to run large queries that
|
|
run for minutes or hours.
|
|
To enable support for long running queries that
|
|
execute beyond the typical web request’s timeout (30-60 seconds), it is
|
|
necessary to deploy an asynchronous backend, which consist of one or many
|
|
Caravel worker, which is implemented as a Celery worker, and a Celery
|
|
broker for which we recommend using Redis or RabbitMQ.</p>
|
|
<p>It’s also preferable to setup an async result backend as a key value store
|
|
that can hold the long-running query results for a period of time. More
|
|
details to come as to how to set this up here soon.</p>
|
|
</div>
|
|
<div class="section" id="making-your-own-build">
|
|
<h2>Making your own build<a class="headerlink" href="#making-your-own-build" title="Permalink to this headline">¶</a></h2>
|
|
<p>For more advanced users, you may want to build Caravel from sources. That
|
|
would be the case if you fork the project to add features specific to
|
|
your environment.:</p>
|
|
<div class="highlight-default"><div class="highlight"><pre><span></span># assuming $CARAVEL_HOME as the root of the repo
|
|
cd $CARAVEL_HOME/caravel/assets
|
|
npm install
|
|
npm run prod
|
|
cd $CARAVEL_HOME
|
|
python setup.py install
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<footer class="footer">
|
|
<div class="container">
|
|
<p class="pull-right">
|
|
<a href="#">Back to top</a>
|
|
|
|
</p>
|
|
<p>
|
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.<br/>
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html> |