<commit_before>.. _ref_eql_params:

Parameters
==========

:edb-alt-title: Query Parameters

EdgeQL queries can reference parameters with ``$`` notation. The value of these
parameters are supplied externally.

.. code-block:: edgeql

  select <str>$var;
  select <int64>$a + <int64>$b;
  select BlogPost filter .id = <uuid>$blog_id;

Note that we provided an explicit type cast before the parameter. This is
required, as it enables EdgeDB to enforce the provided types at runtime.

Usage with clients
------------------

REPL
^^^^

When you include a parameter reference in an EdgeDB REPL, you'll be prompted
interactively to provide a value or values.

.. code-block:: edgeql-repl

  db> select 'I ❤️ ' ++ <str>$var ++ '!';
  Parameter <str>$var: EdgeDB
  {'I ❤️ EdgeDB!'}


Python
^^^^^^

.. code-block:: python

  await client.query(
      "select 'I ❤️ ' ++ <str>$var ++ '!';",
      var="lamp")

  await client.query(
      "select <datetime>$date;",
      date=datetime.today())

JavaScript
^^^^^^^^^^

.. code-block:: javascript

  await client.query("select 'I ❤️ ' ++ <str>$var ++ '!';", {<commit_msg>Fix typo in parameters docs (examples) (#3520)<commit_after>.. _ref_eql_params:

Parameters
==========

:edb-alt-title: Query Parameters

EdgeQL queries can reference parameters with ``$`` notation. The value of these
parameters are supplied externally.

.. code-block:: edgeql

  select <str>$var;
  select <int64>$a + <int64>$b;
  select BlogPost filter .id = <uuid>$blog_id;

Note that we provided an explicit type cast before the parameter. This is
required, as it enables EdgeDB to enforce the provided types at runtime.

Usage with clients
------------------

REPL
^^^^

When you include a parameter reference in an EdgeDB REPL, you'll be prompted
interactively to provide a value or values.

.. code-block:: edgeql-repl

  db> select 'I ❤️ ' ++ <str>$var ++ '!';
  Parameter <str>$var: EdgeDB
  {'I ❤️ EdgeDB!'}


Python
^^^^^^

.. code-block:: python

  await client.query(
      "select 'I ❤️ ' ++ <str>$var ++ '!';",
      var="lamp")

  await client.query(
      "select <datetime>$date;",
      date=datetime.today())

JavaScript
^^^^^^^^^^

.. code-block:: javascript

  await client.query("select 'I ❤️ ' ++ <str>$name ++ '!';", {
{'fraction_non_alphanumeric': 0.17613132209405502, 'fraction_numerical': 0.005323868677905945, 'mean_word_length': 3.4831013916500995, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3070556', 'n_tokens_mistral': 764, 'n_tokens_neox': 733, 'n_words': 242}