++ it looks pretty easy to add once the Sole is built by adding a hook to the console input method before data gets passed to a multi or connect object.
Devananda Sent from my BlackBerry -----Original Message----- From: Jay Pipes <[email protected]> Date: Wed, 18 Nov 2009 09:24:00 To: drizzle-discuss Discuss<[email protected]>; Chromakode<[email protected]> Subject: [Drizzle-discuss] Request for new Drizzle Client BOOTS Console: Macro Support Hi all! I've been reading through the requested features for the new client on the wiki here: http://drizzle.org/wiki/Proposed_Client_Features http://drizzle.org/wiki/Client/Boots_API_Design_Concept I think all the stuff on that link is excellent so far. I'd also like to request a feature that I think will be a really cool timesaver for DBAs and developers using Drizzle. Macro Support. Remember, "way back when" you used Microsoft Excel and were able to start recording your actions, then when you stopped recording, Excel would store a "macro" of your actions that you could subsequently replay? I think this would be incredibly useful for folks who do repetitive work in the console. Sure, I know, I know...the first reaction folks will say is "but HEY, you guys removed stored procedures!". Yeah, yeah... but the feature I'm proposing here is different from stored procedures in the following ways: 1) It's entirely client-side. There is no server-side storage/cache, processing, parsing, or anything. 2) It's not limited to the small subset of SQL that stored procedures (at least in MySQL) are currently limited to. Anything the new client can do would be able to go into a macro. 3) Since the client is in Python, the macros are themselves re-writable in a scripting language. This gives the recorded macros incredible flexibility. 4) No fussing and mussing around with SQL stored procedure permissions at runtime (you know, the silly INVOKER/DEFINER crap) 5) Ability to interact with result sets in the macro. Just try doing that easily in a SQL stored procedure. Using CURSORs is incredibly clunk and ugly. Applying a Python function or closure/lambda on each of a result set is elegant and easy. Imagine the following rough example interface... drizzle> RECORD MACRO "sales_report_with_email" (to_email); macro recording started. drizzle> mode python; in python mode. python> import datetime python> today= datetime.datetime.now().isoformat() python> filename= python("%s-%s-%s" % ("sales", to_email, today)); python> Ctrl-D drizzle> SELECT * FROM sales WHERE manager = @to_email; > csv(@filename); drizzle> mode python; In python mode. python> report_txt= open(filename, "r+b").read() python> import smtplib python> mailserver = smtplib.SMTP('localhost') python> mailserver.sendmail('[email protected]', to_email, report_txt) python> mailserver.quit() python> print "Mail sent to %s\n" % to_email python> Ctrl-D drizzle> STOP MACRO; Macro "sales_report_with_email" saved. drizzle> macro("sales_report_with_email", "[email protected]"); Mail sent to [email protected] --- Pretty powerful, eh? If you follow the flow above, you will notice the only real trick to solve is passing the macro's arguments into the console's variable array, and from the console's variable array into the Python interpreter's variable scope. But this is a fairly simple problem to solve... Thoughts? Jay _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

