PKG-INFO 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. Metadata-Version: 1.1
  2. Name: sqlparse
  3. Version: 0.2.0
  4. Summary: Non-validating SQL parser
  5. Home-page: https://github.com/andialbrecht/sqlparse
  6. Author: Andi Albrecht
  7. Author-email: albrecht.andi@gmail.com
  8. License: BSD
  9. Description:
  10. ``sqlparse`` is a non-validating SQL parser module.
  11. It provides support for parsing, splitting and formatting SQL statements.
  12. Visit the `project page <https://github.com/andialbrecht/sqlparse>`_ for
  13. additional information and documentation.
  14. **Example Usage**
  15. Splitting SQL statements::
  16. >>> import sqlparse
  17. >>> sqlparse.split('select * from foo; select * from bar;')
  18. [u'select * from foo; ', u'select * from bar;']
  19. Formatting statemtents::
  20. >>> sql = 'select * from foo where id in (select id from bar);'
  21. >>> print sqlparse.format(sql, reindent=True, keyword_case='upper')
  22. SELECT *
  23. FROM foo
  24. WHERE id IN
  25. (SELECT id
  26. FROM bar);
  27. Parsing::
  28. >>> sql = 'select * from someschema.mytable where id = 1'
  29. >>> res = sqlparse.parse(sql)
  30. >>> res
  31. (<Statement 'select...' at 0x9ad08ec>,)
  32. >>> stmt = res[0]
  33. >>> str(stmt) # converting it back to unicode
  34. 'select * from someschema.mytable where id = 1'
  35. >>> # This is how the internal representation looks like:
  36. >>> stmt.tokens
  37. (<DML 'select' at 0x9b63c34>,
  38. <Whitespace ' ' at 0x9b63e8c>,
  39. <Operator '*' at 0x9b63e64>,
  40. <Whitespace ' ' at 0x9b63c5c>,
  41. <Keyword 'from' at 0x9b63c84>,
  42. <Whitespace ' ' at 0x9b63cd4>,
  43. <Identifier 'somes...' at 0x9b5c62c>,
  44. <Whitespace ' ' at 0x9b63f04>,
  45. <Where 'where ...' at 0x9b5caac>)
  46. Platform: UNKNOWN
  47. Classifier: Development Status :: 4 - Beta
  48. Classifier: Intended Audience :: Developers
  49. Classifier: License :: OSI Approved :: BSD License
  50. Classifier: Operating System :: OS Independent
  51. Classifier: Programming Language :: Python
  52. Classifier: Programming Language :: Python :: 2
  53. Classifier: Programming Language :: Python :: 2.7
  54. Classifier: Programming Language :: Python :: 3
  55. Classifier: Programming Language :: Python :: 3.3
  56. Classifier: Programming Language :: Python :: 3.4
  57. Classifier: Programming Language :: Python :: 3.5
  58. Classifier: Topic :: Database
  59. Classifier: Topic :: Software Development