I connect database with pycharm and I use sqlAlchemy. When I am trying to execute an insert query it shows the following error:
Invalid object name 'pfAnalytics.optPrice'
The error is due to the fact that it add "[" and "]" to my tables' name when I do :
ins = table.insert()
if I check the string I see:
str(ins) == 'INSERT INTO [pfAnalytics.optPrice] DEFAULT VALUES'
instead of:
str(ins) == 'INSERT INTO pfAnalytics.optPrice DEFAULT VALUES'
my request look like this:
listToWrite = all.to_dict(orient='records')
metadata = sql.schema.MetaData(bind=engine,reflect=True)
table = sql.Table("pfAnalytics.optPrice", metadata)
Session = sessionmaker(bind=engine)
session = Session()
querydel = sql.delete("pfAnalytics.optPrice")
results = consql.execute(querydel)
consql.execute(sql.insert(table), listToWrite)
How to get rid of these brackets?