I use format(stmt, strip_whitespace=True) to strip the whitespaces of the statement. And i find the whitespace can not be stripped when it is the first character of the statement.
Here is a example:
[root@gorilla sqlparse-master]# python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import sqlparse
sql=' select 1'
sqlparse.format(sql, strip_whitespace=True)
u' select 1'
I think it is a bug. If you agree with that i will send you a patch.
Thank you!