hughhhh commented on a change in pull request #16859:
URL: https://github.com/apache/superset/pull/16859#discussion_r717045800



##########
File path: superset/connectors/sqla/models.py
##########
@@ -1673,7 +1673,7 @@ def before_update(
 
         if not DatasetDAO.validate_uniqueness(
             target.database_id, target.schema, target.table_name
-        ):
+        ) and hasattr(target, "columns"):

Review comment:
       Realizing that committed state is returning `NO VALUE` for database_id, 
but there is definitely a value for database_id in the target
   ```
   {'_sa_instance_state': <sqlalchemy.orm.state.InstanceState object at 
0x12dd37760>,
    'cache_timeout': None,
    'changed_by_fk': 1,
    'changed_on': datetime.datetime(2021, 9, 27, 17, 3, 16, 324223),
    'columns': [],
    'created_by_fk': 1,
    'created_on': datetime.datetime(2021, 9, 27, 13, 55, 20, 78105),
    'database_id': 1, # <------
    'default_endpoint': None,
    'description': None,
    'extra': None,
    'fetch_values_predicate': None,
    'filter_select_enabled': False,
    'id': 29,
    'is_featured': False,
    'is_sqllab_view': True,
    'main_dttm_col': None,
    'offset': 0,
    'params': None,
    'perm': '[examples].[hmiles.test_dataset](id:29)',
    'schema': 'public',
    'schema_perm': '[examples].[public]',
    'sql': 'select * from flights',
    'table_name': 'hmiles.test_dataset',
    'template_params': None,
    'uuid': UUID('dfeaabe4-838e-4379-8536-307a3c95988b')}
   ```




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to