[sqlalchemy] sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) ([Errno 13] Permission denied)")

2020-08-18 Thread Hari Ananthuni
I'm trying to connect to mysql using below engine = create_engine("mysql+pymysql://user:pwd@localhost/test") connection = engine.connect() it works while in local and when deployed the code in one of our linux box , am getting sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError)

[sqlalchemy] Getting column data from result set with column name as a string.

2020-08-18 Thread Dale Preston
I'm using sqlalchemy 1.3.18. I'm trying to write an app that looks at data from an ORM declarative table without necessarily knowing the table definition. What I am looking for is a way to get a single object (row in resultSet), having the name of column[1] is "lastname", and having

Re: [sqlalchemy] Getting column data from result set with column name as a string.

2020-08-18 Thread Mike Bayer
On Tue, Aug 18, 2020, at 5:20 PM, Dale Preston wrote: > I'm using sqlalchemy 1.3.18. I'm trying to write an app that looks at data > from an ORM declarative table without necessarily knowing the table > definition. > > What I am looking for is a way to get a single object (row in resultSet),

[sqlalchemy] pg_temp for testing with postgres

2020-08-18 Thread uok...@gmail.com
Hi all, thought I would post this here since this community might find this useful. I've created a simple python module which can be used to quickly spin up a temporary, disposable postgres server. The main purpose I envisioned for this was for writing tests.

[sqlalchemy] Re: `Base.prepare()` doesn't backfill missing columns and relationships in AutomapBase-derived models

2020-08-18 Thread Vitaly Kruglikov
I just noticed a TYPO - but google groups doesn't let me edit my post. In a couple of places in my post, I accidentally entered `sqa_global_context` as the table name instead of `ewf_sqa_global_context`. But in actual code that I am executing, it's `ewf_sqa_global_context` everywhere. --

[sqlalchemy] Re: sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) ([Errno 13] Permission denied)")

2020-08-18 Thread Jonathan Vanasco
> using the same user and am able to connect from python terminal from the same linux box but it doesnt work using the python code. When this works in the terminal, how are you connecting? In Python via the database driver, or using the mysql client? If it's the mysql client, check the

[sqlalchemy] `Base.prepare()` doesn't backfill missing columns and relationships in AutomapBase-derived models

2020-08-18 Thread Vitaly Kruglikov
Dear all, I am using: sqlalchemy==1.3.18 psycopg2==2.8.4 connection url schema: "postgresql+psycopg2://..." postgres 10.x when I define an explicit AutomapBase-derived model for 'sqa_global_context' table with only the primary key, I expected that running

Re: [sqlalchemy] `Base.prepare()` doesn't backfill missing columns and relationships in AutomapBase-derived models

2020-08-18 Thread Mike Bayer
your reflect() call requires extend_existing=True in this case otherwise existing Table objects as the one you are creating with SqaGlobalContext will not be affected. On Tue, Aug 18, 2020, at 1:59 PM, Vitaly Kruglikov wrote: > Dear all, > > I am using: > sqlalchemy==1.3.18 > psycopg2==2.8.4

Re: [sqlalchemy] `Base.prepare()` doesn't backfill missing columns and relationships in AutomapBase-derived models

2020-08-18 Thread Vitaly Kruglikov
Thanks Mike! `extend_existing=True` is having the partially-specified explicit models pick up all the remaining columns. On Tuesday, August 18, 2020 at 11:29:39 AM UTC-7 Mike Bayer wrote: > your reflect() call requires extend_existing=True in this case otherwise > existing Table objects as the

Re: [sqlalchemy] Getting column data from result set with column name as a string.

2020-08-18 Thread Dale Preston
Thanks. The label is an interesting option; I'll look into that. On a StackOverflow thread, I got *row.__table__.columns* which I can iterate over and test the key, allowing me to get the column I need but I have to loop through all the columns until I find the one I want for each row because