title: How to Import a SQL file to Python
body: <p>I'm attempting to import an sq file that already has tables into python. However, it doesn't seem to import what I had hoped. The only things I've seen so far are how to creata a new sq file with a table, but I'm looking to just have an already completed sq file imported into python. So far, I've written this.</p>
  
  <pre><code># Python code to demonstrate SQL to fetch data.
  
  # importing the module
  import sqlite3
  
  # connect withe the myTable database
  connection = sqlite3.connect("CEM3_Slice_20180622.sql")
  
  # cursor object
  crsr = connection.cursor()
  
  # execute the command to fetch all the data from the table emp
  crsr.execute("SELECT * FROM 'Trade Details'") 
  
  # store all the fetched data in the ans variable
  ans= crsr.fetchall() 
  
  # loop to print all the data
  for i in ans:
      print(i)
  </code></pre>
  
  <p>However, it keeps claiming that the Trade Details table, which is a table inside the file I've connected it to, does not exist. Nowhere I've looked shows me how to do this with an already created file and table, so please don't just redirect me to an answer about that</p>