[web2py] Re: mssql set identity_insert on

2019-12-20 Thread Davidiam
I agree that this is not good practice, but it is the only workable solution 
that we have found for multi pillar release.

We are also heavily using roles, but here the problem is guaranteeing that 
users have the same ids on all pillars, otherwise we risk users belonging to 
the wrong groups in production

I have found a work around to the insert problem by reserving a range of user 
records and doing updates instead of inserts; also not a clean solution. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9e15be13-0b69-4885-a4ae-62d4d03be5ee%40googlegroups.com.


[web2py] Re: mssql set identity_insert on

2019-12-19 Thread Dave S


On Thursday, December 19, 2019 at 2:37:29 PM UTC-8, Davidiam wrote:
>
> As part of our release process, we need to insert records in the auth 
> tables using specific id's.  On sqlite this is no problem, but in mssql we 
> get an error saying insert_identity is off.
> The solution is to set insert_identity ON, but I am not sure how to do 
> this using the web2py DAL.  Can any give me an code example for this?
> We are basically inserting user and group records using ids from a master 
> table.
>
> This is the command that I would need to run before doing the inserts :
>
> SET IDENTITY_INSERT dbo.auth_user ON;   
>
> Thanks, 
> David 
>



I can't, because I'm using a different DB, but I remember thinking at the 
time of your earlier post about IDs that ... this is wrong.  I think your 
process should be using *roles*, not *ID*s, and this is what the auth_group 
table is for.  Perhaps if I understood your process, I would agree that 
relying on specific IDs is the right answer, but it is going to take some 
effort to convince me.

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/709105be-e47f-487f-a486-5865fe0e37b2%40googlegroups.com.