diff --git a/airflow/hooks/http_hook.py b/airflow/hooks/http_hook.py index 07cf9f264931a..5a257b0552633 100644 --- a/airflow/hooks/http_hook.py +++ b/airflow/hooks/http_hook.py @@ -1,3 +1,17 @@ +# -*- coding: utf-8 -*- +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# from builtins import str import logging diff --git a/airflow/migrations/versions/2e82aab8ef20_rename_user_table.py b/airflow/migrations/versions/2e82aab8ef20_rename_user_table.py new file mode 100644 index 0000000000000..91883ca9ced43 --- /dev/null +++ b/airflow/migrations/versions/2e82aab8ef20_rename_user_table.py @@ -0,0 +1,25 @@ +"""rename user table + +Revision ID: 2e82aab8ef20 +Revises: 1968acfc09e3 +Create Date: 2016-04-02 19:28:15.211915 + +""" + +# revision identifiers, used by Alembic. +revision = '2e82aab8ef20' +down_revision = '1968acfc09e3' +branch_labels = None +depends_on = None + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.rename_table('user', 'users') + + +def downgrade(): + op.rename_table('users', 'user') + diff --git a/airflow/models.py b/airflow/models.py index 3a5883cf6c38c..7dd4a9f2ac0a7 100644 --- a/airflow/models.py +++ b/airflow/models.py @@ -376,7 +376,7 @@ def paused_dags(self): class User(Base): - __tablename__ = "user" + __tablename__ = "users" id = Column(Integer, primary_key=True) username = Column(String(ID_LEN), unique=True) @@ -2645,7 +2645,7 @@ class Chart(Base): id = Column(Integer, primary_key=True) label = Column(String(200)) conn_id = Column(String(ID_LEN), nullable=False) - user_id = Column(Integer(), ForeignKey('user.id'), nullable=True) + user_id = Column(Integer(), ForeignKey('users.id'), nullable=True) chart_type = Column(String(100), default="line") sql_layout = Column(String(50), default="series") sql = Column(Text, default="SELECT series, x, y FROM table") @@ -2681,7 +2681,7 @@ class KnownEvent(Base): label = Column(String(200)) start_date = Column(DateTime) end_date = Column(DateTime) - user_id = Column(Integer(), ForeignKey('user.id'),) + user_id = Column(Integer(), ForeignKey('users.id'),) known_event_type_id = Column(Integer(), ForeignKey('known_event_type.id'),) reported_by = relationship( "User", cascade=False, cascade_backrefs=False, backref='known_events') diff --git a/airflow/www/views.py b/airflow/www/views.py index d7864ec746f3f..955963aa49d55 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -1,3 +1,17 @@ +# -*- coding: utf-8 -*- +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# import sys import os