Skip to content

Creating constraints #34

@dias-bakhtiyarov

Description

@dias-bakhtiyarov

Hi guys! Really appreciate what you are creating! This is amazing!

The question is simple:
How do I create constraints?

I tried:

g.query("CREATE CONSTRAINT ON (x:Persona) ASSERT x.name IS UNIQUE")

Which produces this error:

File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/falkordb/graph.py", line 115, in query
    return self._query(q, params=params, timeout=timeout, read_only=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/falkordb/graph.py", line 91, in _query
    response = self.execute_command(*command)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/redis/client.py", line 605, in execute_command
    return self._execute_command(*args, **options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/redis/client.py", line 616, in _execute_command
    return conn.retry.call_with_retry(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/redis/retry.py", line 62, in call_with_retry
    return do()
           ^^^^
  File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/redis/client.py", line 617, in <lambda>
    lambda: self._send_command_parse_response(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/redis/client.py", line 588, in _send_command_parse_response
    return self.parse_response(conn, command_name, **options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/redis/client.py", line 635, in parse_response
    response = connection.read_response()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lgblkb/PycharmProjects/simsim/.venv/lib/python3.12/site-packages/redis/connection.py", line 637, in read_response
    raise response
redis.exceptions.ResponseError: Invalid constraint command use the GRAPH.CONSTRAINT command instead


This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
🕵️‍♂️ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #34 either in the PR description or in a PR's comment.

🪙 Also, everyone can tip any user commenting /tip 20 @dias-bakhtiyarov (replace 20 with the amount, and @dias-bakhtiyarov with the user to tip).

📖 If you want to learn more, check out our documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions