Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with executing queries #2

Open
weedroyal opened this issue May 28, 2018 · 1 comment
Open

Problem with executing queries #2

weedroyal opened this issue May 28, 2018 · 1 comment

Comments

@weedroyal
Copy link

weedroyal commented May 28, 2018

Hi again,

I tried to use psycopg2 connector and found that the connection with the database was working.
But I have run into another problem. Although the program is executing without throwing any errors the queries are not executing.

def setup_db():
    db = psycopg2.connect(host='localhost', user='postgres', password='1234', dbname='test')
    cur = db.cursor()
    cur.execute("create extension if not exists cube;")
    cur.execute("drop table if exists vectors")
    cur.execute("create table vectors (id serial, file varchar, vec_low cube, vec_high cube);")
    cur.execute("create index vectors_vec_idx on vectors (vec_low, vec_high);")

I have modified the function as shown above. But when I run face-add.py I am returned with the following error

Found 1 faces in the image file him.jpg
- Face #0 found at Left: 919 Top: 348 Right: 1240 Bottom: 669
Traceback (most recent call last):
  File "face-add.py", line 47, in <module>
    cur.execute(query)
psycopg2.ProgrammingError: relation "vectors" does not exist
LINE 1: INSERT INTO vectors (file, vec_low, vec_high) VALUES ('him.jpg)
@vearutop
Copy link
Owner

You need to initialize db before you can use it, please check db.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants