-1

There are many relational algebra packages (arel, axiom, alf) which generate SQL from an abstract representation of a query.

Are there any libraries that allow you to go the other way - from SQL to a relational algebra?

Cameron Martin
  • 5,952
  • 2
  • 40
  • 53
  • 1
    If you re-phrase your question as not looking for a library, but wanting to make the reverse transform, perhaps with an example input and desired output (from one of the packages you suggest), then that would improve the question. Asking directly for a recommended library is off topic on Stack Overflow. Besides which some of the ones you link may be able to assist a reverse process with a little more code. – Neil Slater Mar 20 '14 at 11:09

2 Answers2

1

No, I wouldn't count on it.

SQL is a horrendous language, parsing it is an immense task, and parsing it for the purpose of capturing the original algebraic intent is considered infeasible by just about the whole world, as far as I know.

And then I haven't even begun to mention the various ways in which vendors turn it into something that is actually no less than a completely proprietary language, despite a possible superficial resemblance to what is supposed to be a standard.

And even if such a package existed, what would you do with the output you obtained from it ?

Erwin Smout
  • 18,113
  • 4
  • 33
  • 52
0

Apache Calcite might be what you're looking for.