Jan 22, 2013

Introducing SQL Data


Finally got some time this evening to add a new feature to Barista: The ability to query sql data.

All that needs to happen is to require(“Sql Data”) and pass a parameter to DynamicModel. From there, use “query” and pass it a sql statement, you’ll get JSON back.

alt text

but there’s more:

Setting the properties “tableSchema” and “tableName” will allow to use some convenience methods:

“all” will return all records in the specified table. If a JSON object is passed as a parameter, easy ordering/filtering can will occur: Possible options: limit, orderBy, columns, args

alt text

“paged” will return a paged representation of the data. It defaults to a page size of 20. Similarly to ‘all’, if a json object is passed, additional filtering can occur. Options: sql, primaryKeyField, where, orderBy, columns, currentPage, pageSize, args.

alt text

Barista knows about the SQL Binary data type, so you can create a SQL Image browser if you wanted to.

alt text

There’s support for Insert, Update, Delete, Scalar, Single…

alt text alt text alt text alt text alt text alt text

The “Schema” property will return the schema of the table you’re interested in.

alt text