Giter Site home page Giter Site logo

frankfanslc / sqlparse Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andialbrecht/sqlparse

0.0 1.0 0.0 1.62 MB

A non-validating SQL parser module for Python

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.23% Python 98.09% PLpgSQL 1.68%

sqlparse's Introduction

python-sqlparse - Parse SQL statements

buildstatus coverage docs

sqlparse is a non-validating SQL parser for Python. It provides support for parsing, splitting and formatting SQL statements.

The module is compatible with Python 3.5+ and released under the terms of the New BSD license.

Visit the project page at https://github.com/andialbrecht/sqlparse for further information about this project.

Quick Start

$ pip install sqlparse
>>> import sqlparse

>>> # Split a string containing two SQL statements:
>>> raw = 'select * from foo; select * from bar;'
>>> statements = sqlparse.split(raw)
>>> statements
['select * from foo;', 'select * from bar;']

>>> # Format the first statement and print it out:
>>> first = statements[0]
>>> print(sqlparse.format(first, reindent=True, keyword_case='upper'))
SELECT *
FROM foo;

>>> # Parsing a SQL statement:
>>> parsed = sqlparse.parse('select * from foo')[0]
>>> parsed.tokens
[<DML 'select' at 0x7f22c5e15368>, <Whitespace ' ' at 0x7f22c5e153b0>, <Wildcard '*' … ]
>>>

Links

Project page
https://github.com/andialbrecht/sqlparse
Bug tracker
https://github.com/andialbrecht/sqlparse/issues
Documentation
https://sqlparse.readthedocs.io/
Online Demo
https://sqlformat.org/

sqlparse is licensed under the BSD license.

Parts of the code are based on pygments written by Georg Brandl and others. pygments-Homepage: http://pygments.org/

sqlparse's People

Contributors

adamgreenhall avatar andialbrecht avatar andrew-tipton-cgg avatar dagwieers avatar darikg avatar dbczumar avatar demetrio92 avatar dlenski avatar fredyw avatar j-martin avatar jacekpliszka avatar jdufresne avatar john-bodley avatar johshoff avatar kilowu avatar koljonen avatar phdru avatar pidelport avatar piranna avatar rowanseymour avatar rygwdn avatar shenlongxing avatar sjoerdjob avatar soloman1124 avatar spigwitmer avatar timgraham avatar twang2218 avatar vmuriart avatar wind39 avatar yriveiro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.