I have encountered an issue with the tables_involved property of the SQLQuery model. Currently, this property only identifies tables involved in SELECT and JOIN operations. However, it fails to recognize tables involved in UPDATE operation.
The existing implementation:
class SQLQuery(models.Model):
query = TextField()
...
@property
def tables_involved(self):
...
for idx, component in enumerate(components):
...
if component.lower() == 'from' or component.lower() == 'join' or component.lower() == 'as':
...
return tables
As a result, it is not accurately capturing tables involved in UPDATE queries. This limits the utility of the tables_involved property for comprehensive SQL analysis.
I will create a pull request for this.
Honestly, is the UPDATE query useful for analysis? I'm not sure. However, it doesn't hurt to have the 'table name' field full when showing the UPDATE query.
I have encountered an issue with the
tables_involved
property of the SQLQuery model. Currently, this property only identifies tables involved in SELECT and JOIN operations. However, it fails to recognize tables involved in UPDATE operation.The existing implementation:
As a result, it is not accurately capturing tables involved in UPDATE queries. This limits the utility of the
tables_involved
property for comprehensive SQL analysis.I will create a pull request for this.
Honestly, is the UPDATE query useful for analysis? I'm not sure. However, it doesn't hurt to have the 'table name' field full when showing the UPDATE query.