Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mgood@capstone11 ~/D/c/b/boots.mgood> boots -H capstonedd -l python
Boots (v0.2.0)
capstonedd:3306 (server v2009.11.1220)
> from boots.api import constructors
> @constructors.register('reverse')
+ def reverse():
+ from boots.api.nodes.node import SyncNode
+ from boots.api.api import Rows
+ def reverse_data(data):
+ return Rows((("".join(reversed(field)) if isinstance(field,basestring) else field
+ for field in row)
+ for row in data)
+ , data.description)
+
+ return SyncNode(reverse_data)
+
> \use pipedsql
> use world;
0 rows affected (0.00 seconds)
> SELECT * FROM city WHERE district='Oregon'; | reverse()
+------+----------+-------------+----------+------------+
| ID | Name | CountryCode | District | Population |
+------+----------+-------------+----------+------------+
| 0283 | dnaltroP | ASU | nogerO | 121925 |
| 0593 | eneguE | ASU | nogerO | 398731 |
| 2593 | melaS | ASU | nogerO | 429631 |
+------+----------+-------------+----------+------------+
3 rows in set (0.00 seconds)
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.