SQLPARSE5 years of parsing andformatting SQL statements/PythonCamp, CologneMay 2013Andi Albecht @andialbrecht
sqlparse - UsagePurposeGive a little insight into SQL statements in Python.Simple top-level APIKnown Use CasesMake generated statements readableGive it a string, get a list of separate statementsExtract table and column namessqlparse.parse(sql,encoding=None)sqlparse.split(sql,encoding=None)sqlparse.format(sql,**options)
sqlparse - HistoryBasic needBasic need Get at least a little knowledge of statementsin CrunchyFrog.Basic ideaBasic idea Cant be validating since it should work whileediting SQL statements. "If highlighting isright, parsing couldnt be so wrong." → useas a base!Sep. 2008Sep. 2008 First pieces of code in CrunchyFrogApr. 2009Apr. 2009 First official release (0.1.0)Pygmentsappear
sqlparse - HistoryImmediate reply (sorry, couldnt find the original tweet):"This is just script kiddy stuff. I wont give a shit."Challenge accepted.
sqlparse - HistoryApr. 2013Apr. 2013 Current release (0.1.7)Its still here.
sqlparse - somenumbersabout 2.300 LOC (~3.300 total)88% test coverage, > 120 testssingle code base for Python 2.4, 2.5, 2.6, 2.7, 3.2, 3.3,PyPyversion 0.1.6 had > 10.000 downloads from PyPIlicensed under BSDdevelopment happens on Github
sqlparse - exampleprojectsRunSQLRun - Database query tool for LinuxSuccessor of CrunchyFrog, based on Gtk3 / Python 3