print SQL data in log file

autolog
Posts: 4077
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK
Contact:

Re: print SQL data in log file

Post by autolog »

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 :)
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

print SQL data in log file

Post by kw123 »

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
autolog
Posts: 4077
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK
Contact:

Re: print SQL data in log file

Post by autolog »

Thanks Karl - works well :D
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: print SQL data in log file

Post by kw123 »

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
autolog
Posts: 4077
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK
Contact:

Re: print SQL data in log file

Post by autolog »

Installed and working OK - like the new features :D
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: print SQL data in log file

Post by kw123 »

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


Sent from my iPhone using Tapatalk
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: print SQL data in log file

Post by kw123 »

this function is now part of the general indigo-utilities plugin: http://forums.indigodomo.com/viewtopic. ... 62#p103362


Karl
Post Reply

Return to “Karl's Plugins and Scripts”