title: Can't use column name list to create SQLite View in Python
body: <p>I've created a database and am able to create a simple view using the following command:</p>
  
  <pre><code>CREATE VIEW IF NOT EXISTS monthly_terminals (year, month) AS
    SELECT reportYear, reportMonth FROM osMonthlyTerminals
  </code></pre>
  
  <p>This command works just fine if I paste into the SQLite Manager plugin on FireFox:</p>
  
  <p><a href="https://i.stack.imgur.com/9dmWG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9dmWG.jpg" alt="enter image description here"></a></p>
  
  <p>I then drop this view and try to use the exact same command in the following Python 3 code to create this view...</p>
  
  <pre><code>import sqlite3
  db_name = "../data/OsReportMerchants.sqlite"
  conn = sqlite3.connect(db_name)
  cur = conn.cursor()
  cur.execute("CREATE VIEW IF NOT EXISTS monthly_terminals (year, month) AS SELECT reportYear, reportMonth FROM osMonthlyTerminals")
  </code></pre>
  
  <p>... but I get the following error:</p>
  
  <pre><code>sqlite3.OperationalError: near "(": syntax error
  </code></pre>
  
  <p>More specifically, it looks like this in ipython:</p>
  
  <p><a href="https://i.stack.imgur.com/JE56U.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JE56U.jpg" alt="enter image description here"></a></p>
  
  <p>Yes, I know I should be parameterizing this and I have tried to do so, but keep running into this same snag.</p>
  
  <p>I look at this:  <a href="https://www.sqlite.org/lang_createview.html" rel="nofollow noreferrer">https://www.sqlite.org/lang_createview.html</a>  and it says that column lists are supported in 3.9 and later, so I updated to version 3.13 of sqlite3 and still ran into this issue.</p>
  
  <p>When I remove the column list and use this:</p>
  
  <pre><code>import sqlite3
  db_name = "../data/OsReportMerchants.sqlite"
  conn = sqlite3.connect(db_name)
  cur = conn.cursor()
  cur.execute("CREATE VIEW IF NOT EXISTS monthly_terminals AS SELECT reportYear, reportMonth FROM osMonthlyTerminals")
  </code></pre>
  
  <p>it works fine.  Not sure why it works in one context and not in the other.</p>