1

I recently downloaded Atom for running my python and sqlite codes however I am having trouble to access to my sqlite database via Atom. When I run a simple script, it errors out saying "no such table!". Is there any package I should install or can it be related to system variables? Any help is much appreciated, thanks in advance!

import sqlite3
from sqlalchemy import create_engine
import numpy as np
import sys
import pandas as pd

# connection to database
db = sqlite3.connect('my_db.db')
# cursor
cursor = db.cursor()

cursor.execute("""DROP TABLE IF EXISTS test""")
cursor.execute("""
CREATE TABLE test as
SELECT DISTINCT
x1,
x2
FROM my_db.my_table""")
Cagdas Kanar
  • 713
  • 4
  • 13
  • 23
  • 1
    does it error at the drop statement or the create statement? does your `my_table` exist? if it doesn't you can't select from it – Buckeye14Guy Feb 27 '20 at 19:40
  • it errors at create statement, I showed a mock-up here but the table I use in real code really exists in the db and I am able to access it via Jupyter notebook normally. I want to figure out how I can do the same via atom-editor. – Cagdas Kanar Feb 27 '20 at 19:48
  • ah I see. I don't use atom so I'd rather not say anything :) – Buckeye14Guy Feb 27 '20 at 19:52
  • 1) It's looking for db in current working directory, if it's not there it creates it new. 2) Maybe it's complaining about the `my_db` prefix on the table name, since there is not an attached database. . – DinoCoderSaurus Feb 27 '20 at 23:27

0 Answers0