Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using views #306

Open
dleavitt802 opened this issue Jun 14, 2019 · 6 comments
Open

Using views #306

dleavitt802 opened this issue Jun 14, 2019 · 6 comments

Comments

@dleavitt802
Copy link

Any suggestions on how to use views from within sqlite_orm? Can the sync_schema functionality create views and can they be accessed the same way as tables?

@fnc12
Copy link
Owner

fnc12 commented Jun 14, 2019

Hi. View is not implemented right now but it exists in TODO list. The way how I see view API is:
There are two options of creating view:

  1. static view specified in make_storage function call. It will call CREATE VIEW during sync_schema
  2. dynamic view specified with a storage's member function like storage.create_view<ViewClass>(make_table(...));. It will call CREATE TEMP VIEW at once.

Also you need to have a class in C++ to map to your view.

What do you think?

@fnc12
Copy link
Owner

fnc12 commented Jun 14, 2019

What view do you need? TEMP or not?

@dleavitt802
Copy link
Author

dleavitt802 commented Jun 14, 2019 via email

@fnc12
Copy link
Owner

fnc12 commented Jun 16, 2019

You can use aliases in the lib until views are not implemented

@gbittoun
Copy link

gbittoun commented Mar 21, 2021

Hello,

I’d also like to be able to read a view… Read only is enough for me today. is there already a way for doing so ? (There doesn’t seem to be any but I ask just in case :) ). I tried with a make_table method but obviously, it didn’t work.

Thanks,
PS: this lib is great ! \o/

@fnc12
Copy link
Owner

fnc12 commented Mar 22, 2021

Hello. Views feature is not implemented right now unfortunately. It exists in TODO list. You can implement it by yourself or wait until I or anyone else implement it.

@fnc12 fnc12 mentioned this issue Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants