sea-query
sea-query copied to clipboard
issues-179 Add support for view
PR Info
Depends on:
- https://github.com/SeaQL/sea-query/pull/436
Adds
Add support for: create, delete, rename VIEW.
TODO:
- [x] add backends
- [ ] add tests
- [ ] add docs
I need more time for support backends, because SQLite, MySQL and Postgres are very different in the details.
@tyt2y3 @billy1624, hello. POC for support VIEW is done (without docs and tests). I have one question: ViewCreateStatement has field: query which is SelectStatement. For transform SelectStatement to SQL needed impl QueryStatementBuilder on the other hand: ViewDropStatement does not needed QueryStatementBuilder (only SchemaStatementBuilder).
What to do? In impl ViewStatement everywhere return (String, Values) or is there something better?
@tyt2y3 @billy1624 any ideas?
Hey @ikrivosheev, sorry for the delay. What a huge PR loll
Notice a few things. For, create view:
OR REPLACEis supported by MySQL, MariaDB and PostgreSQL, SQLite wasn't supported- However,
IF NOT EXISTSis supported by SQLite but not the other three dbTEMPORARYis supported by PostgreSQL and SQLite but not the other two dbRECURSIVEis supported only by PostgreSQLWITH [ CASCADED | LOCAL ]...And, the list goes on. I think it's better to document these db specific features later in this PR. Or, even, dump some of the feature that supported by only one db.
References:
- https://dev.mysql.com/doc/refman/8.0/en/create-view.html
- https://mariadb.com/kb/en/create-view/
- https://www.postgresql.org/docs/current/sql-createview.html
- https://www.sqlite.org/lang_createview.html
I understood this. My question was: https://github.com/SeaQL/sea-query/pull/293#issuecomment-1089338484
I think ViewCreateStatement should impl QueryStatementBuilder. May be we can forget ViewStatement for now, if we do keep it then all methods should return (String, Values)
status?
status?
@ian-p-cooke hello! I am working on support Postgres array in SeaQuery. After I will return back to this PR.
Well, It's time to continue working on this PR.
Any news on this?