@@ -135,7 +135,7 @@ def alter(self, prompt=True, context=None):
135135 sql , external_stores = alter (self .definition , old_definition , context )
136136 if not sql :
137137 if prompt :
138- logger .warn ("Nothing to alter." )
138+ logger .warning ("Nothing to alter." )
139139 else :
140140 sql = "ALTER TABLE {tab}\n \t " .format (
141141 tab = self .full_table_name
@@ -518,7 +518,13 @@ def cascade(table):
518518 try :
519519 delete_count = table .delete_quick (get_count = True )
520520 except IntegrityError as error :
521- match = foreign_key_error_regexp .match (error .args [0 ]).groupdict ()
521+ match = foreign_key_error_regexp .match (error .args [0 ])
522+ if match is None :
523+ raise DataJointError (
524+ "Cascading deletes failed because the error message is missing foreign key information."
525+ "Make sure you have REFERENCES privilege to all dependent tables."
526+ ) from None
527+ match = match .groupdict ()
522528 # if schema name missing, use table
523529 if "`.`" not in match ["child" ]:
524530 match ["child" ] = "{}.{}" .format (
@@ -641,7 +647,7 @@ def cascade(table):
641647 # Confirm and commit
642648 if delete_count == 0 :
643649 if safemode :
644- logger .warn ("Nothing to delete." )
650+ logger .warning ("Nothing to delete." )
645651 if transaction :
646652 self .connection .cancel_transaction ()
647653 elif not transaction :
@@ -651,12 +657,12 @@ def cascade(table):
651657 if transaction :
652658 self .connection .commit_transaction ()
653659 if safemode :
654- logger .info ("Deletes committed." )
660+ logger .info ("Delete committed." )
655661 else :
656662 if transaction :
657663 self .connection .cancel_transaction ()
658664 if safemode :
659- logger .warn ( "Deletes cancelled" )
665+ logger .warning ( "Delete cancelled" )
660666 return delete_count
661667
662668 def drop_quick (self ):
@@ -724,11 +730,6 @@ def size_on_disk(self):
724730 ).fetchone ()
725731 return ret ["Data_length" ] + ret ["Index_length" ]
726732
727- def show_definition (self ):
728- raise AttributeError (
729- "show_definition is deprecated. Use the describe method instead."
730- )
731-
732733 def describe (self , context = None , printout = False ):
733734 """
734735 :return: the definition string for the query using DataJoint DDL.
0 commit comments