title: Variable table name in sqlite
body: <p>Question: Is it possible to use a variable as your table name without having to use string constructors to do so?</p>
  
  <hr>
  
  <p>Info: </p>
  
  <p>I'm working on a project right now that catalogs data from a star simulation of mine. To do so I'm loading all the data into a sqlite database. It's working pretty well, but I've decided to add a lot more flexibility, efficiency, and usability to my db. I plan on later adding planetoids to the simulation, and wanted to have a table for each star. This way I wouldn't have to query a table of 20m some planetoids for the 1-4k in each solar system. </p>
  
  <p>I've been told using string constructors is bad because it leaves me vulnerable to a SQL injection attack. While that isn't a big deal here as I'm the only person with access to these dbs, I would like to follow best practices. And also this way if I do a project with a similar situation where it is open to the public, I know what to do.</p>
  
  <p>Currently I'm doing this:</p>
  
  <pre><code>cursor.execute("CREATE TABLE StarFrame"+self.name+" (etc etc)")
  </code></pre>
  
  <p>This works, but I would like to do something more like:</p>
  
  <pre><code>cursor.execute("CREATE TABLE StarFrame(?) (etc etc)",self.name)
  </code></pre>
  
  <p>though I understand that this would probably be impossible. though I would settle for something like</p>
  
  <pre><code>cursor.execute("CREATE TABLE (?) (etc etc)",self.name)
  </code></pre>
  
  <p>If this is not at all possible, I'll accept that answer, but if anyone knows a way to do this, do tell. :)</p>
  
  <p>I'm coding in python.</p>