@@ -135,7 +135,7 @@ def alter(self, prompt=True, context=None):
135
135
sql , external_stores = alter (self .definition , old_definition , context )
136
136
if not sql :
137
137
if prompt :
138
- logger .warn ("Nothing to alter." )
138
+ logger .warning ("Nothing to alter." )
139
139
else :
140
140
sql = "ALTER TABLE {tab}\n \t " .format (
141
141
tab = self .full_table_name
@@ -518,7 +518,13 @@ def cascade(table):
518
518
try :
519
519
delete_count = table .delete_quick (get_count = True )
520
520
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 ()
522
528
# if schema name missing, use table
523
529
if "`.`" not in match ["child" ]:
524
530
match ["child" ] = "{}.{}" .format (
@@ -641,7 +647,7 @@ def cascade(table):
641
647
# Confirm and commit
642
648
if delete_count == 0 :
643
649
if safemode :
644
- logger .warn ("Nothing to delete." )
650
+ logger .warning ("Nothing to delete." )
645
651
if transaction :
646
652
self .connection .cancel_transaction ()
647
653
elif not transaction :
@@ -651,12 +657,12 @@ def cascade(table):
651
657
if transaction :
652
658
self .connection .commit_transaction ()
653
659
if safemode :
654
- logger .info ("Deletes committed." )
660
+ logger .info ("Delete committed." )
655
661
else :
656
662
if transaction :
657
663
self .connection .cancel_transaction ()
658
664
if safemode :
659
- logger .warn ( "Deletes cancelled" )
665
+ logger .warning ( "Delete cancelled" )
660
666
return delete_count
661
667
662
668
def drop_quick (self ):
@@ -724,11 +730,6 @@ def size_on_disk(self):
724
730
).fetchone ()
725
731
return ret ["Data_length" ] + ret ["Index_length" ]
726
732
727
- def show_definition (self ):
728
- raise AttributeError (
729
- "show_definition is deprecated. Use the describe method instead."
730
- )
731
-
732
733
def describe (self , context = None , printout = False ):
733
734
"""
734
735
:return: the definition string for the query using DataJoint DDL.
0 commit comments