also, INSERT without ever needing a SELECT definitely implies you don't need an ORM. Use Core directly.


On 08/10/2016 12:40 PM, mdob wrote:
Me again.

Just wanted to say that

|
engine
=create_engine(connstr,implicit_returning=False,use_scope_identity=True,echo=True)
|

actually works as expected. I was able to add new objects without select
permission on table :)



On Wednesday, August 10, 2016 at 5:33:30 PM UTC+2, mdob wrote:

    Hi Everyone,

    How to save new objects to database without SELECT permission on the
    table?

    I tried using implicit_returning and use_scope_identity in
    create_engine.
    |
    engine
    
=create_engine(connstr,implicit_returning=False,use_scope_identity=False,echo=True)
    db_session =sessionmaker(engine)()
    db_session.add_all(new_resources)
    |

    No luck with that. There's always some sort of select on table that
    returned row identity.
    I found on StackOverflow that I could execute insert on table with
    insert(inline=True) and list of raw data to send.

    |
    
self.db_session.execute(query_class.__table__.insert(inline=True),new_resources_data)
    |

    Though with that approach I need to extract data from ORM objects
    and manually map them into dict with column names.

    Any suggestions?

--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to