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

[Bug] SequelizeDatabaseError: there is no unique #3

Open
2 tasks done
agustinpallares94 opened this issue Apr 12, 2023 · 13 comments
Open
2 tasks done

[Bug] SequelizeDatabaseError: there is no unique #3

agustinpallares94 opened this issue Apr 12, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@agustinpallares94
Copy link

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

I have launched the application with everything needed. I have created conversation in cockroachdb and when I launch the application I get the following error:

Error adding entry: SequelizeDatabaseError: there is no unique or exclusion constraint matching the ON CONFLICT specification

Expected Behavior

Have the chatbot answer my questions

Steps To Reproduce

1.Create .env file
2. Launch the application with npm run dev

Relevant log output

No response

Environment

- **OS**:
- **Language version**:
- **Pinecone client version**:

Additional Context

No response

@agustinpallares94 agustinpallares94 added the bug Something isn't working label Apr 12, 2023
@aaronmckeehan
Copy link

aaronmckeehan commented Apr 27, 2023

There dont seem to be instructions on how to create the Table, but here is what I did, I imagine theres a reason ON CONFLICT is used, but I just changed it to:

INSERT INTO conversations (user_id, entry, speaker) VALUES (?, ?, ?)

Here is the create table command I used for Cockroach:
CREATE TABLE conversations ( user_id STRING, entry STRING, speaker STRING, created_at TIMESTAMP DEFAULT now() );

Since we are running a SELECT on the user ID, and ordering by created time, I don't see why ON CONFLICT is necessary.

@axelferdinand
Copy link

There dont seem to be instructions on how to create the Table, but here is what I did, I imagine theres a reason ON CONFLICT is used, but I just changed it to:

INSERT INTO conversations (user_id, entry, speaker) VALUES (?, ?, ?)

Here is the create table command I used for Cockroach: CREATE TABLE conversations ( user_id STRING, entry STRING, speaker STRING, created_at TIMESTAMP DEFAULT now() );

Since we are running a SELECT on the user ID, and ordering by created time, I don't see why ON CONFLICT is necessary.

Yeah, I was wondering the same thing: How do you actually create the Table, in the first place? To make Pinecone index the pages, you had to rund this URL GET https://localhost:3000/api/crawl?urls=url1,url2&limit=10&indexName=yourIndexName

@axelferdinand
Copy link

I figured I needed to name the database conversations, but now I get this error:

[DatabaseError [SequelizeDatabaseError]: relation "conversations" does not exist] {
  parent: [error: relation "conversations" does not exist] {
    length: 110,
    severity: 'ERROR',
    code: '42P01',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'errors.go',
    line: '168',
    routine: 'NewUndefinedRelationError',
    sql: "SELECT entry, speaker, created_at FROM conversations WHERE user_id = 'undefined' ORDER By created_at DESC LIMIT 10",
    parameters: undefined
  },
  original: [error: relation "conversations" does not exist] {
    length: 110,
    severity: 'ERROR',
    code: '42P01',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'errors.go',
    line: '168',
    routine: 'NewUndefinedRelationError',
    sql: "SELECT entry, speaker, created_at FROM conversations WHERE user_id = 'undefined' ORDER By created_at DESC LIMIT 10",
    parameters: undefined
  },
  sql: "SELECT entry, speaker, created_at FROM conversations WHERE user_id = 'undefined' ORDER By created_at DESC LIMIT 10",
  parameters: {}

@luqiang4xenera
Copy link

if you created the conversations table and still show the error [Error adding entry: SequelizeDatabaseError: there is no unique or exclusion constraint matching the ON CONFLICT specification]

you can run sql below
ALTER TABLE conversations ADD CONSTRAINT conversations_created_at_unique UNIQUE (created_at);

@siddhijain47
Copy link

I am also facing the same error. How to resolve it any idea @axelferdinand @luqiang4xenera . How I can create that table

@axelferdinand
Copy link

It turned out I simply had to set up and use the right API keys from all the needed services (6 in total, I think) – then it worked as expected, with no code changes :)

@siddhijain47
Copy link

@axelferdinand Can you share the right way to provide ABLY_API_KEY?

@axelferdinand
Copy link

Skjermbilde 2023-07-04 kl  12 26 45

@siddhijain47
Copy link

siddhijain47 commented Jul 4, 2023

@axelferdinand I also provided the same as you share but still facing error
image

@axelferdinand
Copy link

Try the other API key, the bottom one

@siddhijain47
Copy link

Try the other API key, the bottom one

tried from both none work for me

@siddhijain47
Copy link

if you created the conversations table and still show the error [Error adding entry: SequelizeDatabaseError: there is no unique or exclusion constraint matching the ON CONFLICT specification]

you can run sql below ALTER TABLE conversations ADD CONSTRAINT conversations_created_at_unique UNIQUE (created_at);

Is I have to create locally ? I am expecting when i ran command it will automatically created

@ktranish
Copy link

ktranish commented Sep 2, 2023

The schema is not set up and the imports of Metadata, getMatchesFromEmbeddings are incorrect so you'd have to do code changes in order to make it work but hey @axelferdinand thanks for playing

If you look through the git issues they will help you fill in the missing gaps @siddhijain47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants