NoSQL Support
Is it possible to use with a no sql db like MongoDB. I noticed it is tightly coupled with gorm which dos not support this.
You need to overwrite the CRUD handlers. Take a look https://doc.getqor.com/admin/extend_admin.html#overwrite-curd-handler . The default QOR handlers are written in only 148 lines. Looks easy to rewrite them to another storage engine.
@gstvg , could you elaborate on that approach a little more? I understand the idea of overriding the handlers, but how do I leverage resource loading through these handlers in my view controllers that I register into routers? When I look at the QOR example site, I see code like this:
tx.Preload("OrderItems").Where("state <> ? AND state != ?", orders.DraftState, "").Where(&orders.Order{UserID: ¤tUser.ID}).Find(&Orders)
The general idea of this code is clear to me, but it still uses gorm.DB internally to load the resource. How can I make QOR use the handlers associated with the resource?
@mrclayman: you are mixing a gorm example with the qor data access interface.
If you want to use any other db in your application (in qor-example this is the shop) you use that interface just like in any other.
If you want to use the /admin interface with anything other than gorm, that’s when you replace the handlers. It doesn’t magically retrofit gorm with querying abilities.
Thank you very much for your response, @cryptix . I guess I am mixing things up, I am totally new to qor. Since I am only interested in the admin component of qor, I did override the 4 handlers and was able to read data from my MongoDB backend and display them in a table. However, I assume I am missing some additional routes because when I click on any item in that table, another window is shown (i.e. slides out) with the exact same table. I guess I am going to need to further customize the behavior of the resource, but at the moment, I have little idea as to how to do that. The entire qor-example website is great to show off the system, but it does not help much in terms of getting to understand the internal workings of qor because it is just too complex to do a good job of that IMO.
Btw. would you mind popping up on Gitter? I am there as mrclayman and I would appreciate it very much if you could provide me with a little more information.
Thanks for insights. I have understood now that, Just by replacing these 4 functions, we would be able to change the data storage and retrieval. But additionally isn't porting QOR itself is needed. Is there any possibility to use the GORM with say google DataStore which is a flat database. How will db.AutoMigrate() work... I guess only after porting the dialect.
I guess only after porting the dialect.
yup - that's the alternative.
make something that gorm can use and dialects is the way to do just that.
While I was reading yesterday I found that dialect + basic sql interface is what it needs .... and execute function do not know the internal details of query ....
But in case of flats database , it needs internal details of DB object ... and use that in different way than SQL ... so in such case SQLcore object should be part of form so that it has access to form internal objects and can make use of them ...
How do u think the approach would be ?
On Tue, 14 Aug 2018 at 1:59 PM, Henry [email protected] wrote:
I guess only after porting the dialect.
yup - that's the alternative.
make something that gorm can use and dialects is the way to do just that.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qor/admin/issues/113#issuecomment-412795358, or mute the thread https://github.com/notifications/unsubscribe-auth/AnyY01sVyC875eoZQWOMgO_2wcHmhnDPks5uQopWgaJpZM4QsAQq .
Typo error ... plz read form and GORM
On Tue, 14 Aug 2018 at 2:05 PM, Sachin Puranik [email protected] wrote:
While I was reading yesterday I found that dialect + basic sql interface is what it needs .... and execute function do not know the internal details of query ....
But in case of flats database , it needs internal details of DB object ... and use that in different way than SQL ... so in such case SQLcore object should be part of form so that it has access to form internal objects and can make use of them ...
How do u think the approach would be ?
On Tue, 14 Aug 2018 at 1:59 PM, Henry [email protected] wrote:
I guess only after porting the dialect.
yup - that's the alternative.
make something that gorm can use and dialects is the way to do just that.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qor/admin/issues/113#issuecomment-412795358, or mute the thread https://github.com/notifications/unsubscribe-auth/AnyY01sVyC875eoZQWOMgO_2wcHmhnDPks5uQopWgaJpZM4QsAQq .
please open a new issue about this at the gorm issue tracker. this is not the place.
Sure. Thanks. I thought it was like mailing list. I have raised the issue on GORM. Will add few more comments.
I am working on qor-admin with a NoSQL database.
I started with the example in document: https://doc.getqor.com/get_started.html Code using sqlite3 (exactly as the example above): https://gist.github.com/WoolWarrior/2bd7ffe68d1ddefa2862bbd4723ab535
The first step is to use a dummy object to replace gorm object.
I tried to overwrite the CRUD handler as the doc suggested: https://doc.getqor.com/admin/extend_admin.html#overwrite-curd-handler
My initial code not working as expected. Basically, an assignment does not work properly:
result = &product101
1st attempt code:
https://gist.github.com/WoolWarrior/90eec2d82ee6fa6201ea108db97f6b41
I spent 3 days to figure the solution. Finally, used deep copy concept to replace naive assignment:
either https://godoc.org/github.com/getlantern/deepcopy#pkg-files
deepcopy.Copy(result, product101)
or https://www.jianshu.com/p/f1cdb1bc1b74
var buf bytes.Buffer
json.NewEncoder(&buf).Encode(product101)
json.NewDecoder(bytes.NewBuffer(buf.Bytes())).Decode(&result)
2nd attempt code (seems working well): https://gist.github.com/WoolWarrior/3b95a0c0579af53c040c80081a7e7c98
Finally managed to get QOR-admin working with NoSQL (AWS DynamoDB)
overwrite CRUD handler in func ConfigureQorResource and func ConfigureQorResourceDynamoDB https://gist.github.com/WoolWarrior/add5a8adab34d4b8522be7008ba93cdb
How can the other sections work with aws , google data store or Dynamo , since GORM is used ... Can gorm be also used with these databases ....
Thanks
On Wed, 11 Sep 2019 at 8:19 PM, Rui.Z [email protected] wrote:
Finally managed to get QOR-admin working with NoSQL (AWS DynamoDB)
overwrite CRUD handler in func ConfigureQorResource and func ConfigureQorResourceDynamoDB https://gist.github.com/WoolWarrior/add5a8adab34d4b8522be7008ba93cdb
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qor/admin/issues/113?email_source=notifications&email_token=AJ6JRUYMDDZBAJJHBPVXZILQJEAPDA5CNFSM4EFQAQVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6OYDQQ#issuecomment-530416066, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ6JRU5DXHHVGG2PORMGDPLQJEAPDANCNFSM4EFQAQVA .
How can the other sections work with aws , google data store or Dynamo , since GORM is used ... Can gorm be also used with these databases .... Thanks …
I think you could use Gorm with them if you write a dialect in GORM, which I didn't.
Yeah I did checked that .... the basic problem is execute function in gorm finally forms the query and gives exec responsibility to RDBMS
Where as in this case no SQL needs lots of internal object access to di this
I have sent a email earlier in this regard quoting here again
——————-old question aan below
But in case of flats database , it needs internal details of DB object ... and use that in different way than SQL ... so in such case SQLcore object should be part of form so that it has access to form internal objects and can make use of them ...
How do u think the approach would be ?
On Thu, 12 Sep 2019 at 2:33 PM, Rui.Z [email protected] wrote:
How can the other sections work with aws , google data store or Dynamo , since GORM is used ... Can gorm be also used with these databases .... Thanks … <#m_6890151919070670659_m_-8416992684102856564_>
I think you could use Gorm with them if you write a dialect in GORM, which I didn't.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/qor/admin/issues/113?email_source=notifications&email_token=AJ6JRUZ4OE2BSEARANNYCDDQJIAX5A5CNFSM4EFQAQVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6RGDLI#issuecomment-530735533, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ6JRUYUCJ2YX3AXUVDXZ73QJIAX5ANCNFSM4EFQAQVA .