Re: [sqlalchemy] Columns error migrating to autoload_with

2021-03-25 Thread Demitri Muna
Ah, interesting. I updated my code and it works great, thanks! Demitri > On Mar 25, 2021, at 5:53 PM, Mike Bayer wrote: > > the constructor for Table is not expecting that you pass the "name" and > "metadata" argument as keyword arguments and this is causing the reflection > process to not

[sqlalchemy] Columns error migrating to autoload_with

2021-03-25 Thread Demitri Muna
Hello, I’m working on migrating my existing code to the updated APIs. My class definitions for tables before looked like this: class MyTable(Base): __tablename__ = ‘my_table’ __table_args__ = {'autoload' : True, 'schema' : ‘my_schema’} I’m trying to implement declarative mapping via

Re: [sqlalchemy] Mapping PostgreSQL INHERIT tables.

2018-05-22 Thread Demitri Muna
Hi Mike, Thanks for the quick reply. I added the "concrete=True" to the B class definition and got this error: AttributeError: Concrete Mapper|B|b does not implement attribute 'type' at > the instance level. Add this property explicitly to Mapper|B|b. Although is a subclass of A (as defined

[sqlalchemy] Mapping PostgreSQL INHERIT tables.

2018-05-22 Thread Demitri Muna
Hello, I have two tables in PostgreSQL where one is INHERITed from the other: CREATE TABLE a ( pk serial, type_pk integer, value numeric, CONSTRAINT a_pkey PRIMARY KEY (pk), CONSTRAINT a_type_fk FOREIGN KEY (a_type_pk) REFERENCES a_type (pk) MATCH SIMPLE ON

Re: [sqlalchemy] Joining tables across schema in PostgreSQL

2016-08-14 Thread Demitri Muna
I found the problem. Listed here for future generations (or more likely my future self). The classes for each schema I have are defined in separate files. In each I was calling Base = declarative_base(bind=me.engine) I was also doing the same in the class I have that wraps the database

Re: [sqlalchemy] Joining tables across schema in PostgreSQL

2016-08-11 Thread Demitri Muna
Hi Mike, It looks like my Base class was not exactly the same (although it was in my original code), but this is not the problem. I have a custom "DatabaseConnection" Python class that is a singleton and encapsulates the database connection. It's constructed like this: me.engine =

[sqlalchemy] Joining tables across schema in PostgreSQL

2016-08-10 Thread Demitri Muna
There's nothing like hitting a brick wall of a problem that you definitively solved years ago. I am trying to join two tables across two schema in PostgreSQL. Which was solved here: https://groups.google.com/d/msg/sqlalchemy/iLXMXBIkYiA/sHNyNwFui4kJ and has been used successfully since. But

Re: [sqlalchemy] Re: Support for native PostgreSQL "polygon" type?

2015-09-07 Thread Demitri Muna
Hi Michael, On Monday, September 7, 2015 at 5:40:02 PM UTC-4, Michael Bayer wrote: > > SQLAlchemy doesn't do much else with types at the most basic level other > than pass the data through to the DBAPI, in this case hopefully psycopg2. > Feel free to set the column type to NullType and just

[sqlalchemy] Re: Support for native PostgreSQL "polygon" type?

2015-09-06 Thread Demitri Muna
Hi Ian, Thanks for the reply. On Saturday, September 5, 2015 at 11:53:39 AM UTC-4, Ian McCullough wrote: > > Is there some compelling reason you wouldn't just install the PostGIS > extensions? Assuming there is... > There is; I can't use any of the functionality. My use case is astronomical

Re: [sqlalchemy] Inexplicable NoResultFound error

2015-09-04 Thread Demitri Muna
Hi, On Sunday, August 30, 2015 at 11:18:49 PM UTC-4, Michael Bayer wrote: > > if it happens every time with that exact same numeric identifier, that's a > clue. If it happens on more than just one particular Postgresql database > server with the same data, that's another clue. > > You'd want

[sqlalchemy] Support for native PostgreSQL "polygon" type?

2015-09-04 Thread Demitri Muna
Hi, Is there a way to use the native PostgreSQL (i.e. not postgis) "polygon" data type through SQLAlchemy? I'm guessing one might be able to define the model class via autoload as normal, then add some kind of custom column definition? Surely someone has done this before, but I haven't been

Re: [sqlalchemy] Inexplicable NoResultFound error

2015-08-29 Thread Demitri Muna
Hi Michael, On Friday, August 28, 2015 at 11:54:17 AM UTC-4, Michael Bayer wrote: this log shows clearly that the second query is not returning any rows at the DBAPI driver level - you can see that unlike the first query, there is no Row logged. The query you want to run on your

[sqlalchemy] Inexplicable NoResultFound error

2015-08-27 Thread Demitri Muna
Hi, I have a script that's basically been running unmodified for years. In it, it performs an SQLAlchemy query that does a simple join between two tables: platePointing = session.query(PlatePointing).join(Plate).filter(Plate.plate_id==plateid).one() Suddenly, I'm getting a NoResultFound error

Re: [sqlalchemy] Inexplicable NoResultFound error

2015-08-27 Thread Demitri Muna
On Thursday, August 27, 2015 at 1:36:46 PM UTC-4, Michael Bayer wrote: have you upgraded cx_Oracle to 5.2 lately? An API change was introduced which corresponds to some users reporting this issue. The issue is fixed for SQLAlchemy 1.0.9. No, I'm using PostgreSQL v9.3.9. Sorry, I

Re: [sqlalchemy] Inexplicable NoResultFound error

2015-08-27 Thread Demitri Muna
Hi, Thanks for the help. On Thursday, August 27, 2015 at 2:23:59 PM UTC-4, Michael Bayer wrote: So, next thing, has anything changed other than database data? versions of anything? Really, none that I can think of. It's a production system, so almost no one even has access to change

Re: [sqlalchemy] Foreign key reflection error?

2012-05-22 Thread Demitri Muna
Hi, Progress! But still not working 100%. I have three assert statements: one that tests a to one relationship across schemas, one that test a to one relationship within the same scheme, and two that test a many to many relationship across schemas (one assert for each direction). When I set

Re: [sqlalchemy] Foreign key reflection error?

2012-05-22 Thread Demitri Muna
Where in my last email three statements = five statements... Sigh. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to

Re: [sqlalchemy] Foreign key reflection error?

2012-05-22 Thread Demitri Muna
Hi, On May 22, 2012, at 5:03 PM, Michael Bayer wrote: Did a quick experiment, and it appears that a ROLLBACK resets the search path. Try calling dbapi_con.commit() in your event handler, that appears to cause the search path to remain persistent for the life of that connection.

Re: [sqlalchemy] Foreign key reflection error?

2012-05-21 Thread Demitri Muna
Hi Michael, As a very quick test to see if I could make things work, I created a new postgres user and set that user's search_path to just '$user' (since it can't be empty, but as there are no tables with the user's name, that's effectively what it is). My toy example worked. On May 18, 2012,

Re: [sqlalchemy] Foreign key reflection error?

2012-05-18 Thread Demitri Muna
Hi Michael, On May 18, 2012, at 9:19 AM, Michael Bayer wrote: When using cross-schema reflection, you have the option of either using only public in your schema search path, or *not* schema-qualifying the tables. This is because when you have the alternate schemas in your search path,

Re: [sqlalchemy] Foreign key reflection error?

2012-05-17 Thread Demitri Muna
Hi, I'd like to revive this thread from a little while back as I'm still having problems. Thanks again to Michael for the help. In short, I'm having problems with SQLAlchemy determining the foreign key relationship between two tables in two different schemas. For example, this

Re: [sqlalchemy] Foreign key reflection error?

2012-05-17 Thread Demitri Muna
Hi, As a quick follow up, the inability to cross schema in one direction means that join tables won't work regardless of path order. For example, given apogeedb.Calibration platedb.Exposure neither of these will work since, I'm guessing, the join must be made in both directions:

Re: [sqlalchemy] Foreign key reflection error?

2012-05-17 Thread Demitri Muna
On May 17, 2012, at 6:33 PM, Michael Bayer wrote: OK this is way too much verbiage. If the error is as you describe, a bug involving reflection of two tables across two schemas, I'd need a test which illustrates this alone, no ORM or full database dumps, with a simple failure to identify