pylint equivalent for SQL? - sql

python having pylint
scala having Scalastyle
I searched around but didn't find a style checker for SQL. Does it exist?
Thank you.

You don't require any error checker for Sql, as Sql is not a programming language. They IDE you use will help you to understand the issue in the query and can be formatted accordingly. Please choose appropriate IDE (Sql developer/ db weaver)

I also found this sql style guide
https://www.sqlstyle.guide/
so it's more of a team wide consensus on which SQL style to go with, but not a linter to spot it out.

Related

Open source alternative to SQLMaestro for PostgreSQL

I'm looking for oen source alternative to SQLMaestro for PostgreSQL because it has visual database designer which not avaliable in pgAdmin which make database desinging so easy.
PS
I'm not sure if this is illegal here but I've to ask about it because google didn't help me for find the alternative.
SQL Power Architect did the trick for me. Runs on Windows, OS X and Linux.
I found awesome tools in PostgreSQL wiki thank for your help guys.

Sql objects spell checker

I am just wondering that whether there is any utility which can help in determining the spelling mistakes in sql objects.
I can only think of getting information of all the sql objects and the save them in any other system (e.g. excel file) and then run a spell checker on it.
I am looking forward for a better way for this, like any plugin for MSSQL.
You can use spell check functionality built in Office as CLR function. Example see here:
http://msdn.microsoft.com/en-us/library/office/aa537153%28v=office.11%29.aspx
To use this, you need MS Word to be installed on server side.

Is there an sql reindenter?

I'm looking to pretty print SQL code. Preferably free and/or online based.
My favorite: http://www.dpriver.com/pp/sqlformat.htm?ref=g_wangz
If you have SQLNAV you May have the formatter tools as well.
They can do the job
take a look at this lightweight javascript plugin
http://www.eslinstructor.net/vkbeautify/
simply grab the code and use it.
With this plugin you can beautify not only SQL, but also XML, JSON and CSS.
Pretty useful.

SQL code editor with syntax highlighing, auto-formatting and code folding

Is there any SQL editor that supports syntax highlighting, automatic code formatting and code folding? I found this, but it's an Eclipse plugin (I'm a NetBeans user), and cannot automatically format code, which is the most important feature I'm after.
Autocompletion is not important, nor is the possibility of running the code (like the SQL editor in NetBeans).
Edit: I'm sorry for not specifying, I'm looking for Linux or even web-based software.
SQuirreL ticks a lot of your boxes, and has formatting and other plugins and runs on Linux
I'd give it a try at least
Programmers Notepad is a nice little application.
Online SQL Formater http://sqlserverlearner.com/online-tools/tsql-code-formatter
Use VIM.
See this link on how to set it up:
http://www.faqs.org/docs/Linux-HOWTO/Vim-HOWTO.html
Take a look at QweryBuilder. It supports syntax highlighting, automatic code formatting, code folding and auto completion.

SQL parser in C

I want to parse and store the columns and values of a SQL DML (INSERT, UPDATE, DELETE) statement in C. Need the URL of the open source code or a library with which I can link my C program. The platform is SUSE Linux. Have tried to make and use libSQL unsuccessfully. A detailed answer is appreciated. Thanks.
Additional Notes: Please suggest a library/code that I can link with my C program. In my program I want to use the functions of this library to parse and use the tokens for further processing.
You can have a look at the source code for SQLite. It uses a parser called Lemon.
Links:
SQLite architecture
Lemon parser
You can also look at the source code for postgresql-plpython3. Looks like it has a pure C based SQL parser.
Link:
postgresql-plpython3 # github
I would suggest to start from the real parser of a real DBMS. There are several in free software. For instance, the parser of PostgreSQL is in the directory src/backend/parser of the distribution and is written in C and Yacc.
See the Chapter "Parsing SQL" in "Lex & Yacc"(O'Reilly) in google books http://books.google.fr/books?id=YrzpxNYegEkC&lpg=PT1&dq=bison%20flex%20sql%20grammar&client=firefox-a&hl=en&pg=PA109
Have you looked at SQLite ? It certainly does have the code to parse SQL, so maybe you could avoid reimplementing it..
ANTLR can target C, among other languages, and its catalog of premade grammars has a bunch of SQL dialects - notably MySQL and Oracle.
µSQL for C++
What is µSQL ?
µSQL is a SQL parser engine for C++ to develop SQL based applications
easily, and it supports other SQL like domain specific languages such
as UnQL and GQL too. Because µSQL is written only in old standard C++
library such as STL with ANTLR, then you can use it with many C++
compilers and platforms.
Repo on Github
The standalone SQL parser of the Hyrise database system is open source and, even though it is written in C++, it can be accessed from C and is easy to understand and modify. It utilizes bison and flex.
Not sure is there any mature C sql parser can do that easily.
Here is a Java version SQL library can do what you need exactly, it can be used to Retrieve/Refactor table & column name from a complex SQL query easily.
Have you considered writing your own using lex and yacc? (the hacker - hardcore approach)
Not trivial .. but this site might help you get started