You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airflow.apache.org by Lance Norskog <la...@gmail.com> on 2016/05/18 20:34:13 UTC

Sample DB script

What is a sample script to add a Connection? Is there a command-line
feature or API feature to do this?  Or would we just use a MySQL script?

-- 
Lance Norskog
lance.norskog@gmail.com
Redwood City, CA

Re: Sample DB script

Posted by Lance Norskog <la...@gmail.com>.
Thanks!


On Wed, May 18, 2016 at 7:17 PM, Chris Riccomini <cr...@apache.org>
wrote:

> Hey Lance,
>
> You could definitely write a Python script to do this. MySQL script could
> be tricky if you want to encrypt the password.
>
> Something like:
>
> conn = models.Connection(
>     conn_id='airflow_db', conn_type='mysql',
>     host='localhost', login='root', password='',
>     schema='airflow'))
> session.add(conn)
> session.commit()
>
> Cheers,
> Chris
>
> On Wed, May 18, 2016 at 1:34 PM, Lance Norskog <la...@gmail.com>
> wrote:
>
> > What is a sample script to add a Connection? Is there a command-line
> > feature or API feature to do this?  Or would we just use a MySQL script?
> >
> > --
> > Lance Norskog
> > lance.norskog@gmail.com
> > Redwood City, CA
> >
>



-- 
Lance Norskog
lance.norskog@gmail.com
Redwood City, CA

Re: Sample DB script

Posted by Chris Riccomini <cr...@apache.org>.
Hey Lance,

You could definitely write a Python script to do this. MySQL script could
be tricky if you want to encrypt the password.

Something like:

conn = models.Connection(
    conn_id='airflow_db', conn_type='mysql',
    host='localhost', login='root', password='',
    schema='airflow'))
session.add(conn)
session.commit()

Cheers,
Chris

On Wed, May 18, 2016 at 1:34 PM, Lance Norskog <la...@gmail.com>
wrote:

> What is a sample script to add a Connection? Is there a command-line
> feature or API feature to do this?  Or would we just use a MySQL script?
>
> --
> Lance Norskog
> lance.norskog@gmail.com
> Redwood City, CA
>