Photo of Miqueas Nieves

0

SQL error

I am getting an error when attempting to use sql in the demo.

This my Lava:

{% sql %}

   SELECT [NickName], [LastName] FROM [Person]

   WHERE [LastName] = 'Decker'

{% endsql %}


{% for item in results %}

   {{ item.NickName }} {{ item.LastName }}

{% endfor %}


this is is the error message:

The Lava command 'sql' is not configured for this template. SELECT [NickName], [LastName] FROM [Person] WHERE [LastName] = 'Decker'

  • Photo of Michael Garrison

    0

    Miqueas,

    Allowing SQL to be run from Lava can be a security concern, as anyone in your organization with the ability to enter Lava in a field can then get ANY information out of the database, irrespective of security. Therefore Rock requires that you (the administrator) enable these commands.

    If you're running this in an HTML block, it gets turned on on a block-by-block basis: go to the Block Properties dialogue (not the Edit HTML dialogue) and on the "Basic Settings" tab, you'll need to check "Sql" under the "Enabled Lava Commands" header.

    Otherwise, you may need to enable Sql on the "Default Enabled Lava Commands Value" Global Setting - but be aware this enables SQL lava to be run from almost any lava-enabled field. Consider carefully the security implications and access to your data before doing that.