DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:sqlraw

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:sqlraw [2013-11-09 21:52] – updated lastupdate date tom_cplugin:sqlraw [2018-06-05 23:59] (current) – [Installation] Klap-in
Line 1: Line 1:
-====== sqlraw Plugin ======+====== SQLRaw Plugin ======
  
 ---- plugin ---- ---- plugin ----
Line 6: Line 6:
 email      : tcafferty@glocalfocal.com  email      : tcafferty@glocalfocal.com 
 type       : syntax type       : syntax
-lastupdate : 2013-11-09 +lastupdate : 2013-11-17 
-compatible : Adora Belle, Weatherwax+compatible : Adora Belle, Weatherwax, Binky
 depends    :  depends    : 
 conflicts  conflicts 
Line 29: Line 29:
 I recommend creating a user account and granting database specific privilege to that account, specifying a database external from your other databases. That user account information will be specified in the plugin software and the user will not need to know the login information. I recommend creating a user account and granting database specific privilege to that account, specifying a database external from your other databases. That user account information will be specified in the plugin software and the user will not need to know the login information.
  
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 Update the configuration data for the user account login information for the database. Update the configuration data for the user account login information for the database.
Line 41: Line 41:
 ===== Examples/Usage ===== ===== Examples/Usage =====
  
-  * The following is data from a scrape of a US Employment data table(Note that column headings have no spaces when a new line is startedOtherwise use an underscore for spaces. Eg: July2013).+Examples can be seen at <del>[[http://clean.glocalfocal.com/doku.php?id=start|Plugin Examples Site]]</del>
  
-  <sqlraw  id='unemployment' title='Unemployment by education level' source='scrapeUrl' link="http://www.bls.gov/news.release/empsit.a.htm">SELECT category, July2013 FROM temptable where (Category = "Less than a high school diploma" or Category = "High school graduates, no college" or Category = "Some college or associate degree" OR Category = "Bachelor's degree and higher" ;</sqlraw>+  * The following is data from a scrape of a US Employment data table. (Note that column headings have no spaces when a new line is started. Otherwise use an underscore for spaces. Eg: Oct_2013). This example uses the fixTable='1' option to correct issues with the table. 
 + 
 +  <sqlraw  id='unemployment' title='Unemployment by education level' source='scrapeUrl' link="http://www.bls.gov/news.release/empsit.a.htm" fixTable='1'>SELECT category, Oct_2013 FROM temptable where (Category = "Less than a high school diploma" or Category = "High school graduates, no college" or Category = "Some college or associate degree" OR Category = "Bachelor's degree and higher" ;</sqlraw>
  
   * The following is an example using a dokuwiki page with a table   * The following is an example using a dokuwiki page with a table
Line 70: Line 72:
 </code> </code>
  
-Create another dokuwiki page with the following content. This uses the tableplot plugin but that is not required to see the output of the sqlraw plugin+Create another dokuwiki page with the following content. This uses the sqlraw plugin to query the existing table and display the query results in a table.
 <code>  <code> 
-<sqlraw id='myrun' title='My Running' source='scrapeUrl'  link="users:admin:data" startMarker="Running">SELECT date, round(time/distance,1) FROM temptable;</sqlraw>+<sqlraw id='myrun' title='My Running' source='scrapeUrl'  link="users:admin:data:runexample" startMarker="Running">SELECT date, round(time/distance,1) FROM temptable;</sqlraw>
  
-<tableplot>&series=columns&width=500&height=250&id=myrun&position=after&plotArgs={title: {text: 'My run times', fontSize: '14pt', textColor: 'skyblue'}, axes: {xaxis: {renderer: jQuery.jqplot.CategoryAxisRenderer, tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer ,tickOptions: {angle: -30}}}, seriesDefaults: {renderer:jQuery.jqplot.BarRenderer, pointLabels: { show: true, location: 'e', edgeTolerance: -15} }}& 
-</tableplot> 
 </code> </code>
 This page processes a scrape of the supplied link to my_run_log page to get the first table present following a marker. The data is put into a temporary database table. Then a query is run on the temporary table to select only date and calculate the speed in minutes per mile. The query produces an output table which is replaced by a plot of the data. This page processes a scrape of the supplied link to my_run_log page to get the first table present following a marker. The data is put into a temporary database table. Then a query is run on the temporary table to select only date and calculate the speed in minutes per mile. The query produces an output table which is replaced by a plot of the data.
Line 84: Line 84:
 {{keywords>sqlRawSort}} {{keywords>sqlRawSort}}
 </code> </code>
-  * Set the class as 'sortable" +Set the class as 'sortable"Use the keywords plugin to pull in the sorting javascript code. Clicking on a column header will sort the table one way (ASC, DESC) and clicking again will sort the table the other direction.
-  * Use the keywords plugin to pull in the sorting javascript code. +
-  * Clicking on a column header will sort the table one way (ASC, DESC) and clicking again will sort the table the other direction.+
  
 +  * The following example gets the data from an online csv file. The source option is now set to csvfile. The url link points to a downloadable csv file.
 +<code>
 +  <sqlraw id="earthquakes" source="csvfile" title="Large Recent Earthquakes" link="http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_week.csv">SELECT time, mag, depth, place FROM temptable WHERE mag > 5.0 AND depth < 70;</sqlraw> 
 +</code>
 ===== Syntax ===== ===== Syntax =====
  
Line 104: Line 106:
 |  caption  |  '0' or '1'  | A '1' specifies to skip the 1st row as it is a caption. Default is '0' | |  caption  |  '0' or '1'  | A '1' specifies to skip the 1st row as it is a caption. Default is '0' |
 |  tableNumber  |  'number'  | The position number of a table to scrape on a web page. For example '2' would scrape the 2nd table. The default is '1' | |  tableNumber  |  'number'  | The position number of a table to scrape on a web page. For example '2' would scrape the 2nd table. The default is '1' |
-|  fixTable  |  '0' or '1'  | A '1' will run a function that attempts to correct tables that have missing </td> elements. The default is '0' to execute faster.  |+|  fixTable  |  '0' or '1'  | A '1' will run a function that attempts to handle such items as row or col span, or a caption as a table heading. The default is '0' to execute faster.  |
  
 ===== Configuration and Settings ===== ===== Configuration and Settings =====
plugin/sqlraw.1384030336.txt.gz · Last modified: 2013-11-09 21:52 by tom_c

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki