python - SQL Drop View with if -
def q1(): db.executescript( drop view if exists q1; create view q1 select c.company_name, a.price_amount companies c, acquisitions c.status = 'acquired' , c.company_name = a.company_name; select * q1; ) return q1() when running above, i'm getting following error:
drop view if exists q1; ^ syntaxerror: invalid syntax
can see i'm doing wrong here?
you use create or replace view instead, while removing drop view line completely
Comments
Post a Comment