Re: [sqlalchemy] Doesnt execute any thing at new pc

2023-09-12 Thread Richard Damon
exists. Your "username" may have changed. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com

Re: [sqlalchemy] Many-to-many cascade delete

2021-11-02 Thread Richard Damon
0458f55e4n%40googlegroups.com <https://groups.google.com/d/msgid/sqlalchemy/b5e4faee-5cd6-4b9b-936b-0d80458f55e4n%40googlegroups.com?utm_medium=email_source=footer>. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post exam

Re: [sqlalchemy] Changing Type of an ORM record

2021-05-03 Thread Richard Damon
On 5/2/21 6:34 PM, Mike Bayer wrote: > > > On Sun, May 2, 2021, at 4:44 PM, Richard Damon wrote: >> I asked this a bit ago, but never got an answer, so trying again wording >> a bit different to see if I can get help. > > sorry if this got missed. > >> >>

[sqlalchemy] Changing Type of an ORM record

2021-05-02 Thread Richard Damon
the value of the type field in the Employee table with an UPDATE. The question is, is there a more "ORM' way to do this? -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Mi

[sqlalchemy] Upgrading an ORM object from a base class to a derived class.

2021-04-16 Thread Richard Damon
to actually do some of the work? I don't think I can just create a new derived object with the original primary key, as that will get rejected as a duplicate key, not replace the object. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http

Re: [sqlalchemy] How to refer to columns whose names begin with a number when autoloading?

2021-04-12 Thread Richard Damon
would be the equivalent of self.1st_period, but not have the name parsed by Python. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http:

Re: [sqlalchemy] Using Abstract Base Classes with ORM Table Classes

2021-03-16 Thread Richard Damon
eclarative/api.html?highlight=instrument_declarative#sqlalchemy.ext.declarative.instrument_declarative> > > > which can be turned into an equivalent decorator. > > that said I have not yet experimented with mapping classes that are > also extending ABCMeta so I'm not sure if there are other issues. > > >

[sqlalchemy] Using Abstract Base Classes with ORM Table Classes

2021-03-14 Thread Richard Damon
to work, or am I missing some other trick? Side question, when doing this sort of mix-in, does the order of the mix-in and declarative_base matter, or is there a real preference? -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org

Re: [sqlalchemy] ORM and objects with properties that need conversion to write to database

2020-10-08 Thread Richard Damon
Thank you, that looks like what I was looking for but didn't know what it was called. On 10/8/20 4:55 AM, Simon King wrote: > On Thu, Oct 8, 2020 at 3:38 AM Richard Damon wrote: >> I am working on a app using SQLAlchemy's ORM layer to interface to the >> database, but I am runnin

[sqlalchemy] ORM and objects with properties that need conversion to write to database

2020-10-07 Thread Richard Damon
representation, and I see an option to add a 'reconstructor' to convert a value read from the database into an object. Is there a similar way that when writing the object, to indicate how to convert the object into a format that can be put into the database? -- Richard Damon -- SQLAlchemy

Re: [sqlalchemy] ORM AmbiguousForeignKeysErro

2020-09-08 Thread Richard Damon
r and caused a more complicated one) > I think you need to post the basics of the code. See the link below about making it a MCVE There is obviously something you aren't describing, or we need to see to point to you what you are missing. -- Richard Damon -- SQLAlchemy - The Python SQL Too

Re: [sqlalchemy] ORM AmbiguousForeignKeysErro

2020-09-08 Thread Richard Damon
I just have a foreign key to that table? It's a simple many to one > > > @Richard: you can use @declared_attr.cascading to cascade the > mapper_args to your child classes. > On Friday, August 28, 2020 at 2:56:02 PM UTC-4 Richard Damon wrote: > > Thank you, so that go into

Re: [sqlalchemy] ORM 3 level hieracrchy

2020-09-03 Thread Richard Damon
ok. On 9/3/20 10:25 AM, Mike Bayer wrote: > yup that was the idea > > > On Thu, Sep 3, 2020, at 10:24 AM, Richard Damon wrote: >> I have a large number (around a dozen or more, and likely to grow) of >> derived classes, so I was hoping to cut down repetition with the >>

Re: [sqlalchemy] ORM 3 level hieracrchy

2020-09-03 Thread Richard Damon
class but this depends on what > you're doing. > > > > On Thu, Sep 3, 2020, at 7:24 AM, Richard Damon wrote: >> I've tried taking my code and changing the ForeignKey to be to Node, and >> that doesn't change the Warning. >> Is the problem trying to DRY with the @declare

Re: [sqlalchemy] ORM 3 level hieracrchy

2020-09-03 Thread Richard Damon
ode_id = Column(Integer, ForeignKey("Property.node_id"), > primary_key=True) > >     __mapper_args__ = { >     "polymorphic_identity": "Name", >     "inherit_condition": node_id == Property.node_id, >     } > > > > On Wed, Sep 2, 2020,

Re: [sqlalchemy] ORM 3 level hieracrchy

2020-09-02 Thread Richard Damon
://docs.sqlalchemy.org/en/13/faq/ormconfiguration.html#i-m-getting-a-warning-or-error-about-implicitly-combining-column-x-under-attribute-y > > for joined table inheritance, where Name(Node) -> node_id are FK -> > PK, the warning isn't emitted.  so please share the mapping if it is

[sqlalchemy] ORM 3 level hieracrchy

2020-09-02 Thread Richard Damon
, it is just where it hits the 3rd level that it seems to want something explicit. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http

Re: [sqlalchemy] ORM AmbiguousForeignKeysErro

2020-08-28 Thread Richard Damon
gt; > class Foo(...): >    __mapper_args__ = { >   "inherit_condition": node_id == Node.node_id >    } > -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Compl

[sqlalchemy] ORM AmbiguousForeignKeysErro

2020-08-28 Thread Richard Damon
s to Node to push this into the subclasses? Would I use a @declared_attr, which would need to check if the type was Node since it is different? (Background, long time programmer, but somewhat new to python, looking to learn how with reasons, not just rote recipes to follow) -- Richard Damon

Re: [sqlalchemy] Re: ArgumentError: Only one Column may be marked autoincrement=True, found both id and id.` when I run the following insert

2020-08-22 Thread Richard Damon
into the table_args for the table (but that loses the column object) -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com

Re: [sqlalchemy] Re: ArgumentError: Only one Column may be marked autoincrement=True, found both id and id.` when I run the following insert

2020-08-22 Thread Richard Damon
, as that would cause issues, but in an explicit scope like a class it works. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://st

Re: [sqlalchemy] Attaching a second database to a connection

2020-07-07 Thread Richard Damon
/20 12:46 AM, Mike Bayer wrote: > > > On Mon, Jul 6, 2020, at 11:19 PM, Richard Damon wrote: >> SQLite allows a program to attach multiple databases to a single >> connection, and you are able to reference tables in these additional >> databases with things like schema.t

[sqlalchemy] Attaching a second database to a connection

2020-07-06 Thread Richard Damon
me do a lot of the work down in the database engine. I also have found being able to bind different sets of tables into different engines, but in my case the database will have the same set of tables, so this doesn't look to work. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and

Re: [sqlalchemy] Getting SQLite INTEGER PRIMARY KEY for a column

2020-07-02 Thread Richard Damon
't an alias shows it following the inserted data, so I guess it is becoming the named alias for the ROWID. I think I came across a different section wording that restriction that wasn't as clear about it, or it was long enough ago that they have updated that wording to be clearer. -- Richard Damo

[sqlalchemy] Getting SQLite INTEGER PRIMARY KEY for a column

2020-07-01 Thread Richard Damon
for the ROWID. I can't seem to find anything documented to do to make this happen. I would think this would be a commonly wanted optimization. Is there something I can do to get this? I would like to be able to use the ORM. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relat

Re: [sqlalchemy] Handling multiple very similar tables

2020-06-06 Thread Richard Damon
be more or less current: > > https://github.com/sqlalchemy/sqlalchemy/wiki/EntityName > > note the second example that shows declarative with a mixin, and shows > how you can use the type() function to generate new classes > dynamically.   Creating new classes in Python is quite o

[sqlalchemy] Handling multiple very similar tables

2020-06-05 Thread Richard Damon
, or the decorator could just duck type the needed hooks into the class. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com

Re: [sqlalchemy] SQLAlchemy Access to Native Bulk Loaders

2020-04-19 Thread Richard Damon
ementation more DB independent. > > Anyhow, thanks again for your note and your work on SQLAlchemy. I > appreciate it. > > Ben I will admit that wasn't a command I was familiar with, but being DB Specific it would be something I tend to try to minimize the use of. -- Richard D

Re: [sqlalchemy] SQLAlchemy Access to Native Bulk Loaders

2020-04-19 Thread Richard Damon
ture, but that is NOT part of the base SQL language. -- Richard Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve

Re: [sqlalchemy] Bidirectional many-to-many without foreign key

2020-01-29 Thread Richard Damon
be a violation of the normal form, and makes operations for creating these relationships very complicated. -- Richard Damon THis -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete

Re: [sqlalchemy] Error with polymorphic selectin and adding item to session.info: 'expanding' parameters can't be used with an empty list

2018-03-05 Thread damon
Hey Mike, Noticed 1.2.5 doesn't have a release date yet on http://docs.sqlalchemy.org/en/latest/changelog/changelog_12.html#change-1.2.2. Was wondering if that could be released sometime soon - we're blocked from switching over until it's released. Damon On Friday, February 23, 2018 at 12

Re: [sqlalchemy] Error with polymorphic selectin and adding item to session.info: 'expanding' parameters can't be used with an empty list

2018-02-23 Thread damon
Awesome, thanks Mike! Looking forward to the release. Damon On Friday, February 23, 2018 at 11:20:33 AM UTC-8, Mike Bayer wrote: > > On Fri, Feb 23, 2018 at 1:38 PM, Mike Bayer <mik...@zzzcomputing.com > > wrote: > > *perfect* test case, I'll get a bug report up and

[sqlalchemy] Error with polymorphic selectin and adding item to session.info: 'expanding' parameters can't be used with an empty list

2018-02-23 Thread Damon Doucet
here's anything more I can do to clarify/help. Thanks! Damon from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import event Base = declarative_base() class A(Base): __tablename__ = 'a' id = Column(I

Re: [sqlalchemy] Large number of polymorphic subclasses

2017-05-01 Thread damon
l?q=https%3A%2F%2Fbitbucket.org%2Fzzzeek%2Fsqlalchemy%2Fissues%2F3944=D=1=AFQjCNHP34Q9-nl0O_qmczm7uZFo8daCAA> > . Thanks! Damon On Tuesday, April 4, 2017 at 8:24:07 PM UTC-7, Mike Bayer wrote: > > Reusing the original query is hard, and the case you have is due to > mismatched entities

Re: [sqlalchemy] Large number of polymorphic subclasses

2017-04-04 Thread damon
ls) with q = context.session.query(target_cls).join(orig_query.subquery()) fixes the issue, though this feels less than ideal. Subclassing Query also seems less than ideal. Do you have any ideas here? Thanks, Damon On Tuesday, April 4, 2017 at 6:42:32 AM UTC-7, Mike Bayer wrote: > > This r

Re: [sqlalchemy] Large number of polymorphic subclasses

2017-04-03 Thread damon
a way to compare query equality, or alternatively have a solution to both of these issues? Could you also elaborate on what you meant by this comment? # store this strong reference so recs don't get lost while # iterating Thanks again for all your help, Damon On Monday, April 3, 2017 at 6

Re: [sqlalchemy] Large number of polymorphic subclasses

2017-04-03 Thread damon
Thanks a ton for your help, Mike! We played around with it and are pretty happy with your solution using the load() event, so we'll be using that moving forward. Damon On Wednesday, March 29, 2017 at 2:40:39 PM UTC-7, Mike Bayer wrote: > > I have a working version of both l

Re: [sqlalchemy] Large number of polymorphic subclasses

2017-03-23 Thread damon
it? Regarding STI and relationships, is there any way to do that but still get the benefits of JTI? e.g. is there an easy way to resolve my_base_class_inst.subclass_prop as a proxy to the subclass? We could roll our own using __getitem__ but it seems a little hairy. Thanks again, Damon

[sqlalchemy] Large number of polymorphic subclasses

2017-03-22 Thread damon
are added to the session?) - groups the models by type and runs its own subqueries to load the data Any help here is greatly appreciated! Thanks, Damon -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE

[sqlalchemy] Re: Inferring joins from table A to table C via table B

2009-09-03 Thread Damon
relationships that we have already defined in our mapper objects. Again, my example was not the joining between two adjacent tables, which we can get SA to handle on its own without our help. It was between two tables that are adjacent only through an intermediary table that touches both of them. --Damon

[sqlalchemy] Re: Inferring joins from table A to table C via table B

2009-09-03 Thread Damon
follow similar logic to construct query objects as well -- in a completely analogous fasion -- when supplied with filters. Alas that this is not the case. :( --Damon On Sep 3, 12:29 pm, Michael Bayer mike...@zzzcomputing.com wrote: Damon wrote: MUST we explicitly supply the join to such query

[sqlalchemy] Inferring joins from table A to table C via table B

2009-09-01 Thread Damon
criteria. But we want SA to *know* how to infer that join criteria itself. Is this possible? Thanks in advance, Damon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email