eirnym commented on issue #1642:
URL:
https://github.com/apache/datafusion-sqlparser-rs/issues/1642#issuecomment-4028493316
@alamb It would be a very nice addition to have such interface in this
library, as `datafusion` is too big by itself to use it just to have a builder
interface.
I use this library to generate more or less complex dynamic statements and
filling most of the fields I don't use or features I don't use is quite
mouthful.
For example, an below an update example. User may provide any combination of
fields to update (noop for empty set). Query is required to check consistency
and access (of some sort). Sub-select is SQLite limitation, as TableA and
TableB both contain field with name `field1`. Code to generate this query is
about 200 lines and can be compacted to 100-120 only if AST structure fields
with default values will be omitted.
```sql
-- TableA.TableB_Id is a ForeignKey to TableB.id
-- TableB.TableC_Id is a ForeignKey to TableC.id
UPDATE TableA
SET
field1 = "field1",
field2 = "field2",
TableB_Id = 3
WHERE
TableA.id = 4
AND TableB_Id IN (
SELECT id FROM TableB
WHERE TableC_ID = 2
)
AND 3 IN (
SELECT id FROM TableB
WHERE TableC_Id = 2
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]