Skip to content

Commit

Permalink
Documentation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Feb 21, 2014
1 parent adaccee commit bdf8b72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions doc/topics/advanced_usage.rst
Expand Up @@ -21,12 +21,12 @@ The return value will vary based on the type of query.
Embedded Python
---------------
DQL supports the use of python expressions anywhere that you would otherwise
have to specify a data type. Just surround the python with backticks. Create
your variable scope as a dict and pass it to the engine with the commands:
have to specify a data type by surrounding the python with backticks. Set the
variable scope on the engine and run your query:

.. code-block:: python
>>> engine.scope = {'foo1': 1, 'foo2': 2}
>>> engine.scope.update(foo1=1, foo2=2)
>>> engine.execute("INSERT INTO foobars (foo) VALUES (`foo1`), (`foo2`)")
The interactive client has a special way to modify the scope. You can switch
Expand Down
11 changes: 5 additions & 6 deletions doc/topics/queries/update.rst
Expand Up @@ -70,10 +70,9 @@ row dict directly:

.. code-block:: sql
us-west-1> UPDATE foobars SET foo = m`if row.get('bar'):
> return bar + 1
> else:
> return 1`;
us-west-1> UPDATE foobars SET foo = `row.get('bar', 0) + 1`
This syntax will NOT WORK if you are using the ``KEYS IN`` form of the query,
as that performs the update without doing any table reads.
.. warning::

This syntax will not work if you are using the ``KEYS IN`` form of the
query, as that performs the update without doing any table reads.

0 comments on commit bdf8b72

Please sign in to comment.