Click here to Skip to main content
15,886,919 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: need to write a small SQL parser Pin
PIEBALDconsult16-Sep-23 19:25
mvePIEBALDconsult16-Sep-23 19:25 
GeneralRe: need to write a small SQL parser Pin
jschell18-Sep-23 5:59
jschell18-Sep-23 5:59 
GeneralRe: need to write a small SQL parser Pin
RickZeeland16-Sep-23 3:41
mveRickZeeland16-Sep-23 3:41 
GeneralRe: need to write a small SQL parser Pin
Southmountain16-Sep-23 8:51
Southmountain16-Sep-23 8:51 
GeneralRe: need to write a small SQL parser Pin
Nelek16-Sep-23 3:55
protectorNelek16-Sep-23 3:55 
GeneralRe: need to write a small SQL parser Pin
Southmountain16-Sep-23 14:11
Southmountain16-Sep-23 14:11 
GeneralRe: need to write a small SQL parser Pin
Nelek17-Sep-23 3:38
protectorNelek17-Sep-23 3:38 
GeneralRe: need to write a small SQL parser Pin
jschell18-Sep-23 6:19
jschell18-Sep-23 6:19 
Southmountain wrote:
I may need to implement my request by other scripting languages such as SAS.


Huh?

You want to try to implement a SQL Parser using 'SAS' (whatever that is)?

Seems like a bad idea to me.

I have written interpreters. And one compiler.
I have been using Perl for 40 years and I have parsed SQL using that before. Multiple times.
I have also taken a class on compiler theory so I do know what goes into a parser.

And in my estimation with your general description you are setting yourself up for failure. Or for writing a lot more code than you expect.

Thing that can impact the actual project
1. How structured is the SQL? For example if this is dumped from a SQL database tool the form is exact, but if it is human created files then the form will be all over the place.
2. How much SQL exists? 1,000 lines? 10,000? 1 million? The more lines the more likely variations will exist.
3. How often will this need to happen. Every day? Every day for each customer? Only one time and never again?

Consider the following case
1. You are parsing some SQL script files. By that I mean that there is nothing in those files except SQL.
2. Those script files are in use. So you know absolutely that the SQL is valid.
3. This is one time project
4. The number of files are low (total number of lines are probably less than 10,000)
6. You can add a manual step in the process to deal with the more complex examples.

Given the above, and that I really know how to do the above in Perl, this would be a fairly easy project for me.

I however would NOT attempt to do it in Python. Because I have never used Python.
I would not choose to do it in C# nor Java even though I know those languages very well because I know that Perl is going to be better at doing the real work that is needed.

If the project was much bigger than what I suggested above then I would look at making a real parser. Probably in C# or Java. C++ is an option but since it has been so long since I used that I would prefer one of the others. I would do that even though I has been a long time since I made a real parser (versus just munging a solution.) But that is going to become a problem if I could not find an actual BNF type description of the SQL being targeted. There is no way I would attempt to write my own BNF for any of the major databases without vastly increasing the timeline for the work. (And I have written a BNF before and read others.)

Note also that if there are different types of SQL then one needs a parser for each regardless of how one implements it.
GeneralRe: need to write a small SQL parser Pin
Southmountain18-Sep-23 20:13
Southmountain18-Sep-23 20:13 
GeneralRe: need to write a small SQL parser Pin
jschell19-Sep-23 5:10
jschell19-Sep-23 5:10 
GeneralRe: need to write a small SQL parser Pin
Southmountain19-Sep-23 19:42
Southmountain19-Sep-23 19:42 
GeneralRe: need to write a small SQL parser Pin
jschell20-Sep-23 13:08
jschell20-Sep-23 13:08 
GeneralRe: need to write a small SQL parser Pin
Southmountain20-Sep-23 20:02
Southmountain20-Sep-23 20:02 
Generalworldle 602 3/6 Pin
jmaida15-Sep-23 16:11
jmaida15-Sep-23 16:11 
GeneralWordle 819 Pin
StarNamer@work15-Sep-23 13:06
professionalStarNamer@work15-Sep-23 13:06 
GeneralRe: Wordle 819 Pin
Amarnath S15-Sep-23 13:53
professionalAmarnath S15-Sep-23 13:53 
GeneralRe: Wordle 819 Pin
GKP199215-Sep-23 19:09
professionalGKP199215-Sep-23 19:09 
GeneralRe: Wordle 819 Pin
OriginalGriff15-Sep-23 19:37
mveOriginalGriff15-Sep-23 19:37 
GeneralRe: Wordle 819 Pin
GuyThiebaut15-Sep-23 19:49
professionalGuyThiebaut15-Sep-23 19:49 
GeneralRe: Wordle 819 - 5 4 me Pin
pkfox15-Sep-23 20:42
professionalpkfox15-Sep-23 20:42 
GeneralRe: Wordle 819 Pin
Sander Rossel15-Sep-23 23:00
professionalSander Rossel15-Sep-23 23:00 
GeneralRe: Wordle 819 Pin
Cp-Coder16-Sep-23 0:56
Cp-Coder16-Sep-23 0:56 
GeneralRe: Wordle 819 Pin
Sandeep Mewara16-Sep-23 2:53
mveSandeep Mewara16-Sep-23 2:53 
GeneralRe: Wordle 819 Pin
jmaida16-Sep-23 15:22
jmaida16-Sep-23 15:22 
GeneralRobotics, how much is remote control and how much is autonomous decision? Pin
Calin Negru15-Sep-23 5:20
Calin Negru15-Sep-23 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.