title: Connect / Store sqlite3 database in specified directory other than default -- "conn = sqlite3.connect('name_of_database')"
body: <p>I'm working with and Sqlite3 database trying to access its data from a different directory than it was originally created. </p>
  
  <p>The python script(test case) that I have ran through our Squish GUI Automation IDE is located in a directory </p>
  
  <p>C:\Squish_Automation_Functional_nVP2\suite_Production_Checklist\tst_dashboard_functional_setup</p>
  
  <p>There I create a database with the following table inside of that same script: </p>
  
  <pre><code>def get_var_value_pass():
      conn = sqlite3.connect('test_result.db')
      c = conn.cursor()
      c.execute('CREATE TABLE IF NOT EXISTS test_result_pass (pass TEXT,result INTEGER)')    
      c.execute("INSERT INTO test_result_pass VALUES('Pass', 0)")
      conn.commit()  
      c.execute("SELECT * FROM test_result_pass WHERE pass='Pass'", )       
      pass_result = c.fetchone() 
      test.log(str(pass_result[1])) 
      test_result = pass_result[1] 
      c.close()
      conn.close()       
      return test_result
  </code></pre>
  
  <p>Now I'd like to access the same database which I've created formerly by "conn = sqlite3.connect('test_result.db')" inside of another test case which is located in a different directory </p>
  
  <p>C:\Squish_Automation_Functional_nVP2\suite_Production_Checklist\tst_Calling_In-Call-Options_Text_Share-Text_Update-Real-Time</p>
  
  <p>The problem is, when I try a select statement for the same database-- inside of a different script(test case) like so:</p>
  
  <pre><code>def get_var_value_pass(pass_value):
      conn = sqlite3.connect('test_result.db')
      c = conn.cursor()
      c.execute("SELECT * FROM test_result_pass WHERE pass='Pass'", )  
  </code></pre>
  
  <p>My test fails as soon as I try the c.execute("") statement because the table can't be found. Instead, the most recent "conn = sqlite3.connect('test_result.db')" has just created a new empty database, instead of referring to my original created database. Therefore, I've come to the conclusion that I'll want to try and store my original database where both test cases can use them as a test_suite_resource--basically inside of another directory where the other test cases will have reference. Ideally here: </p>
  
  <p>C:\Squish_Automation_Functional_nVP2\suite_Production_Checklist</p>
  
  <p>Is there a sqlite3 function that lets you declare the place where you'd like to Connect / Store your database? Similar to sqlite3.connect('test_result.db') except you define its path? </p>
  
  <p>BTW-- I have tried the second snippet of code inside of the same test script and it runs perfectly. I have also tried an in-memory approach by sqlite3.connect(':memory:') -- still no luck. Please help! Thanks.</p>