print SQL data in log file

Posted on
Sun Sep 13, 2015 4:11 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: print SQL data in log file

Follow up to the previous post, the working SQL now looks like this:
Code: Select all
  SQL command=                    /Library/PostgreSQL/bin/psql indigo_history postgres  -c  "SELECT id, to_char(ts,'YYYY-mm-dd-HH24:MI:ss'),value from variable_history_94014379 order by ID  LIMIT 100 OFFSET (SELECT COUNT(*) FROM variable_history_94014379)-100;"
That's all for today (as it is 23:10 in the UK) - I'll check in again tomorrow morning :)

Posted on
Sun Sep 13, 2015 4:41 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

print SQL data in log file

v 0-8-2

"order by id"
that is now in the plugin, I ran it - it gives no syntax error and prints sorted rows. But i can not test if it works for you or with a non sorted id column.

I added a field in config to switch "order by id" on/off

the default is off, as it can take a lot of cpu to go through a large db

Karl

Posted on
Mon Sep 14, 2015 3:57 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: print SQL data in log file

Thanks Karl - works well :D

Posted on
Mon Sep 14, 2015 11:24 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: print SQL data in log file

version 0.9.1 posted on first page:

added:
- you can add a section condition for state 0 i.e. equal or not equal to e.g. on or off or 55
- added some more checks to make sure the query does not get too big, and the log file does not get killed. i.e. number of records must be <= 1000 for printing to log file


Karl

Posted on
Mon Sep 14, 2015 1:59 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: print SQL data in log file

Installed and working OK - like the new features :D

Posted on
Mon Sep 14, 2015 4:07 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: print SQL data in log file

Nothing new for the next 3 weeks... But if you have ideas let me know.


Sent from my iPhone using Tapatalk

Posted on
Thu Oct 08, 2015 4:42 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: print SQL data in log file

this function is now part of the general indigo-utilities plugin: http://forums.indigodomo.com/viewtopic.php?f=164&t=14825&p=103362#p103362


Karl

Who is online

Users browsing this forum: No registered users and 2 guests