Jan-18-2018, 03:21 PM
Hello Python gurus,
I have sql file, in that
I have some commands like set echo on, set feedback on
and drop table, create table and inserts
and pkg scripts followed by "/".
how do I call this script in pyhton, so far my trials, its not working
I have sql file, in that
I have some commands like set echo on, set feedback on
and drop table, create table and inserts
and pkg scripts followed by "/".
how do I call this script in pyhton, so far my trials, its not working
def get_rules():
con = pyutils.conn_st()
cur = con.cursor()
f = open("run_all_su.sql")
full_sql = f.read()
sql_commands = full_sql.split(';')
#sql_commands = full_sql.replace('\n', '').split(';')[:-1] # this bring just [] which is empty
print(sql_commands)
for sql_command in sql_commands:
print(sql_command)
cur.execute(sql_command)
cur.close()
con.close()
