airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ludovic Claude <ludovic.claud...@gmail.com>
Subject Re: Is it safe to run Airflow upgradedb command on same Airflow version?
Date Mon, 03 Jul 2017 22:04:14 GMT
Hello,

I'm using upgradedb for my own Ansible scripts. It's perfectly safe to 
use again and again. It's based on SQLAlchemy Alembic, you can find more 
details about its inner workings there : 
http://alembic.zzzcomputing.com/en/latest/

My Ansible role:
https://github.com/HBPMedical/ansible-airflow

Ludovic

On 01/07/17 04:43, Ace Haidrey wrote:
> Airflow has an upgradedb command that needs to be run when upgrading Airflow versions.
I wonder if it's safe to run even if the version is the same. Wondering if that'd be okay
to put part of my ansible deployment.
> I've tried asking on Gitter and Stack Overflow but to no avail.
>
> Code wise I see:
> def upgradedb():
>     logging.info("Creating tables")
>     current_dir = os.path.dirname(os.path.abspath(__file__))
>     package_dir = os.path.normpath(os.path.join(current_dir, '..'))
>     directory = os.path.join(package_dir, 'migrations')
>     config = Config(os.path.join(package_dir, 'alembic.ini'))
>     config.set_main_option('script_location', directory)
>     config.set_main_option('sqlalchemy.url', settings.SQL_ALCHEMY_CONN)
>     command.upgrade(config, 'heads')
>
> Where only the last line I guess is what I have a hard time following: command.upgrade(config,
'heads'). Where is the heads defined? For instance, if I'm on version 1.8.0 and then I run
this command, will it put the heads for the most recent version of Airflow from git?
> I don't think so but just want to make sure it's safe.
>
> How foolish of me to not introduce myself.
> My name is Ace Haidrey and I'm a Software Engineer at Pandora trying to incorporate Airflow
as part of our work management systems.
>
> Cheers,
> ☺
>


Mime
View raw message