How can I check the result of mysql query in python?
Posted on 2016-09-20
I've seen lines like op.execute("CREATE LANGUAGE plpgsql") in other scripts in my system so thought I could do similar with the following.
op.execute("SHOW TABLES LIKE 'table_name'")
How can I check the result from this and then do stuff based on existence or not?
I tried result = op.fetchone() but this is incorrect.
AttributeError: 'module' object has no attribute 'fetchone'
if not op.execute("SHOW TABLES LIKE 'agents'"):