Mercurial > hg > ltpda
view m-toolbox/html_help/help/ug/repo_explore_content.html @ 22:b11e88004fca database-connection-manager
Update collection.fromRepository
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
<p> Exploring an LTPDA repository is most easily achieved using the purpose-built graphical user interface. This interace is accesible either from the LTPDA workbench, or via a toolbar button the workspace browser. </p> <p> The figure belows shows the query dialog that appears through either interface: <br> <img src="images/querydialog.png" alt="LTPDA Query Builder" border="3"> <br> </p> <p> You can construct a query by use of the drop-down menus and buttons, then execute the query to retreive a table of results, like the one shown below: <br> <img src="images/queryresults.png" alt="LTPDA Query Results" border="3"> <br> </p> <p> If the query dialog is launched from within the LTPDA Workbench, the results table has an additional button which can be used to create constructor blocks on the current pipeline corresponding to the selected records in the results table. </p> <!-- <p> Since an LTPDA repository is just a MySQL database, you can query the database using standard SQL commands via any of the popular MySQL clients. In addition, the LTPDA toolbox provides a simplified command that can be used to execute simple queries with only basic SQL knowledge. </p> <p> The command is <tt>utils.mysql.dbquery</tt> and it can be used to perform various queries. It takes the following input arguments: <table border="1" cellpadding="2" width="30%" bgcolor="#DDDDDD"> <tr valign="top"> <td><tt>conn</tt></td><td>A database connection object</td> </tr> <tr valign="top"> <td><tt>tablename</tt></td><td>The name of a table to search</td> </tr> <tr valign="top"> <td><tt>query</tt></td><td>The query string written in MySQL SQL syntax</td> </tr> </table> <br> Examples of usage are: </p> <h2>Searching particular tables</h2> <p> <div class="fragment"><pre> >> info = utils.mysql.dbquery(conn, 'select * from objmeta where id>1000 and id<2000'); >> info = utils.mysql.dbquery(conn, 'ao', 'id>1000 and id<2000'); >> info = utils.mysql.dbquery_dbquery(conn, 'objmeta', 'name like "x12"'); >> info = utils.mysql.dbquery(conn, 'users', 'username="aouser"'); >> info = utils.mysql.dbquery(conn, 'collections', 'id=3'); >> info = utils.mysql.dbquery(conn, 'collections', 'obj_ids="1,2"'); >> info = utils.mysql.dbquery(conn, 'transactions', 'user_id=3'); >> info = utils.mysql.dbquery(conn, 'transactions', 'obj_id=56'); </pre></div> </p> <h2>Retrieving a list of tables</h2> <p> You can retrieve a list of the tables in a database with the call: <div class="fragment"><pre> >> info = utils.mysql.dbquery(conn) </pre></div> </p> <h2>High-level queries</h2> <p> Various standard queries are envisaged which ask typical questions, such as: "Give me data for a particular signal spanning a particular time-span". </p> <p> Formulating this question as an SQL query requires a good knowledge of the SQL syntax used by MySQL. The query has to search across multiple tables in order to gather the IDs of the objects that fulfill the query. For these standard questions, high-level functions will be built which perform the query given some input information. This avoids the user having to formulate complicated SQL statements. </p> <p> The following high-level queries currently exist in the toolbox: <table border="1" cellpadding="2" bgcolor="#DDDDDD"> <tr valign="top"> <td><tt>ltpda_getAOsInTimeSpan</tt></td><td>Retrieve particular AOs in the given time-span</td> </tr> </table> </p> -->