[GitHub] [airflow] mortenbpost commented on a change in pull request #5349: [AIRFLOW-4591] Make default_pool a real pool

2019-07-31 Thread GitBox
mortenbpost commented on a change in pull request #5349: [AIRFLOW-4591] Make 
default_pool a real pool
URL: https://github.com/apache/airflow/pull/5349#discussion_r309405312
 
 

 ##
 File path: 
airflow/migrations/versions/6e96a59344a4_make_taskinstance_pool_not_nullable.py
 ##
 @@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+"""Make TaskInstance.pool not nullable
+
+Revision ID: 6e96a59344a4
+Revises: 939bb1e647c8
+Create Date: 2019-06-13 21:51:32.878437
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+
+# revision identifiers, used by Alembic.
+revision = '6e96a59344a4'
+down_revision = '939bb1e647c8'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+"""
+Make TaskInstance.pool field not nullable.
+"""
+# use batch_alter_table to support SQLite workaround
+with op.batch_alter_table('task_instance') as batch_op:
+batch_op.alter_column(
+column_name='pool',
+type_=sa.String(50),
+nullable=False,
 
 Review comment:
   You're right, there is no other way: 
https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-2017.
 It's a costly thing, but whether it takes a long time or not depends on the 
size of the table and your hardware. We are using MSSQL as a backend for 
Airflow and rebuilding the indexes is the least of my concern :-)


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] mortenbpost commented on a change in pull request #5349: [AIRFLOW-4591] Make default_pool a real pool

2019-07-31 Thread GitBox
mortenbpost commented on a change in pull request #5349: [AIRFLOW-4591] Make 
default_pool a real pool
URL: https://github.com/apache/airflow/pull/5349#discussion_r309213144
 
 

 ##
 File path: 
airflow/migrations/versions/6e96a59344a4_make_taskinstance_pool_not_nullable.py
 ##
 @@ -0,0 +1,60 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+"""Make TaskInstance.pool not nullable
+
+Revision ID: 6e96a59344a4
+Revises: 939bb1e647c8
+Create Date: 2019-06-13 21:51:32.878437
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+
+# revision identifiers, used by Alembic.
+revision = '6e96a59344a4'
+down_revision = '939bb1e647c8'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+"""
+Make TaskInstance.pool field not nullable.
+"""
+# use batch_alter_table to support SQLite workaround
+with op.batch_alter_table('task_instance') as batch_op:
+batch_op.alter_column(
+column_name='pool',
+type_=sa.String(50),
+nullable=False,
 
 Review comment:
   FYI, this will break on MSSQL which I known isn't supported atm. One would 
need to drop the index 'ti_pool', alter the column, and recreate the index.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services