Re: [sqlalchemy] Using connection pools with individual PostgreSQL user logins for a backend REST API

2023-02-27 Thread Nate J
html#sqlalchemy.events.PoolEvents.checkin> > > > @event.listens_for(engine, "checkin") > def receive_checkin(dbapi_connection, connection_record): > cursor = dbapi_connection.cursor() > cursor.execute("RESET ROLE") > cursor.clo

[sqlalchemy] Using connection pools with individual PostgreSQL user logins for a backend REST API

2023-02-26 Thread Nate J
Hi List, I have no Google-fu. This is especially obvious when trying to search for something like I’m asking about. Does anyone have any info or links to docs, blog posts, etc. that covers how to use connection pools with individual PostgreSQL user logins for a backend REST API? The reason I

[sqlalchemy] MemoryError in VSCode using dtype NVARCHAR(None) for SQL Server NVARCHAR(max)

2020-11-12 Thread J Sherwood
Hello, I am moving an Oracle Database to SQL Server. I go through the table columns and create a dictionary of columnName: sqlalchemy.types. and then push them to SQL Server using df.to_sql. Most tables work fine except when I have a large VARCHAR2 from Oracle of 8000+ I need it to become a

[sqlalchemy] OverflowError: int to big to convert

2020-11-09 Thread J Sherwood
Hello, I am trying to transfer an Oracle Database(12) to an SQL database(2016) table by table. I read it from the Oracle database using: *ocon = cx_Oracle.connect(username,password,dsn,encoding='UTF-8') df = pd.read_sql("SELECT * FROM TABLE",con=ocon) * I then try to write the dataframe to the

[sqlalchemy] mapping question

2018-06-19 Thread J D
Hello: I am new to sqlalchemy and i want to know that how i can map my json keys with database table columns to insert the json key values. Below is my data. {'sampleTimestamp': '2018-05-31T13:52:00.000Z', 'waterHeight': '0.0', 'fuelHeight': '31.02', 'temperature01': '60.00', 'temperature00':

Re: [sqlalchemy] Naming convention for primary key and Flask, Sqlalchemy

2016-01-26 Thread Gastón J . Avila
I had to use __tablename__ = 'some_name' __table_args__ = (PrimaryKeyConstraint('id'), ) in my declarative models to get the same result. Thanks Mike, that clears it all up. On Mon, Jan 25, 2016 at 6:12 PM, Mike Bayer wrote: > > > On 01/25/2016 02:51 PM, Gastón

Re: Multi-column foreign key constrait using postgresql, autogenerated migration fails

2015-10-30 Thread Gastón J . Avila
That clears it all up. I used __table_args__ and ForeignKeyConstrait. Alembic handled it perfectly. Thanks Mike for your help and for creating these libraries. On Thu, Oct 29, 2015 at 8:34 PM, Mike Bayer wrote: > > > On 10/29/15 4:26 PM, Gastón Avila wrote: > > Hi

[sqlalchemy] sqlalchemy mappper could no assemble any primary key column

2014-08-28 Thread Maurice J Elagu
class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) # id = Column(Integer, ForeignKey('cart.id')) name = Column(Unicode(255), unique=True, nullable=False) password = Column(Unicode(255), nullable=False) last_logged = Column(DateTime,

[sqlalchemy] Accessing several databases

2011-06-16 Thread Julian J. M.
.commitEverything() item2 = project2.getItem(8) item2.value = another test project2.commitEverything() The problem i'm facing is how to create the engine, metadata, mapper, session, and the orm classes for each AppProject instance. I'm not sure if this is supported or even a good idea. Thanks, Julian J

Re: [sqlalchemy] Accessing several databases

2011-06-16 Thread Julian J. M.
. Julian. On Thu, Jun 16, 2011 at 13:54, King Simon-NFHD78 simon.k...@motorolasolutions.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Julian J. M. Sent: 16 June 2011 11:43 To: sqlalchemy Subject: [sqlalchemy] Accessing

[sqlalchemy] Re: is there a way to add methods to sqlsoup's MappedFoo classes?

2010-11-17 Thread J
...@zzzcomputing.com wrote: On Nov 17, 2010, at 4:23 AM, J wrote: so i'm using sqlsoup to support a legacy db, and am thoroughly enjoying it.  it was awesome setting up relationships and all that even though the underlying db schema didn't have any foreign key defines! however, i'm at a point where

[sqlalchemy] Re: is there a way to add methods to sqlsoup's MappedFoo classes?

2010-11-17 Thread J
mike...@zzzcomputing.com wrote: On Nov 17, 2010, at 4:05 PM, J wrote: hmm... but i was thinking of having specialized methods for every table/object.  am i missing something from your suggestion?   No, SqlSoup only offers the base class for all objects as an option.  Here's a patch you can

[sqlalchemy] Mapping MySQL geometry type.

2009-07-15 Thread J. Cliff Dyer
I'm trying to create a custom geometry type for MySQL, but I'm running up against my limited knowledge of SQLAlchemy. My goal is to be able to pass in a geos.Point object on INSERT and UPDATE, convert it to WKT representation ('POINT (1. 2.)'), and pass that to

[sqlalchemy] Re: Mapper with declarative

2009-04-07 Thread J. Cliff Dyer
On Tue, 2009-04-07 at 06:28 -0700, Scripper wrote: Hello everyone, I have a concrete question about using declarative mapper in my project. When i there appeared some errors. I wonder whether declarative mapper supports two relation in a single class. Thanks! Well, so far, that's an

[sqlalchemy] Mapping an existing database

2009-03-29 Thread j...@robinlea.com
Hi, I'm new to SQLAlchemy. I am trying to use Pylons to expose an existing database in a browser. All the introductory material assumes I am going to create the database from python object definitions, but I want to create the python object definitions from the database. Am I on my own, or is

[sqlalchemy] Re: SQLAlchemy Migrate

2009-03-06 Thread J. Cliff Dyer
On Thu, 2009-03-05 at 01:03 -0800, jarrod.ches...@gmail.com wrote: Hi All I'm writing a metadata based schema migration tool. As SQLAlchemy doesn't support much schema modification. I will implement a complete set of schema migration functions one way or another for several of the

[sqlalchemy] query returns old data until session is closed

2008-12-14 Thread J Stam
Within a contextual session, multiple queries all seem to return the same data even though with SQL logging I can see the data has been changed by another thread and a SELECT has been issued by the query. I realize that I need to close or remove the session when I am finished, but shouldn't a

[sqlalchemy] Re: executemany upate

2008-10-18 Thread J Stam
Is there a way to do executemany() semantic updates? Suppose I have a list of employee id's and I want to do something like: ids = [1, 2, 3, 4, 5, 6] session.execute( tbl_employees.update(tbl_employees.c.id == ids), tbl_employees.c.status=you're fired ) Just us the in_ syntax

[sqlalchemy] executemany upate

2008-10-17 Thread J Stam
Is there a way to do executemany() semantic updates? Suppose I have a list of employee id's and I want to do something like: ids = [1, 2, 3, 4, 5, 6] session.execute( tbl_employees.update(tbl_employees.c.id == ids), tbl_employees.c.status=you're fired )

[sqlalchemy] Re: Temporarily disabling autoflush

2008-07-08 Thread J. Cliff Dyer
Not knowing your specific requirements, can you use a separate session? Just instantiate it for the manual-flushing section, and then close it out, and go back to using your old session. Cheers, Cliff On Tue, 2008-07-08 at 05:57 -0700, Moshe C. wrote: Hi, I have an autoflush session and I

[sqlalchemy] UnboundExecutionError with SQL objects in subclassed Django Context

2008-06-12 Thread J. Cliff Dyer
In the following code, I am using django templates to render data from a SQLAlchemy-mapped database. I subclass django.template.Context, so that I can pass it a unique ID, from which it determines what to pull from the DB. But when it comes time to render the template (that is: when I actually

[sqlalchemy] Polymorphic across foreign key

2008-05-15 Thread J. Cliff Dyer
I'm trying to implement polymorphic inheritance using the sqlalchemy.ext.declarative, but the field that I want to use for the polymorphic_on is not in my polymorphic base table, but at the other end of a many-to-one relationship. We have items of many types, and in the item table, we have a

[sqlalchemy] Re: Polymorphic across foreign key

2008-05-15 Thread J. Cliff Dyer
On Thu, 2008-05-15 at 11:24 -0400, J. Cliff Dyer wrote: I'm trying to implement polymorphic inheritance using the sqlalchemy.ext.declarative, but the field that I want to use for the polymorphic_on is not in my polymorphic base table, but at the other end of a many-to-one relationship. We

[sqlalchemy] Re: Polymorphic across foreign key

2008-05-15 Thread J. Cliff Dyer
On Thu, 2008-05-15 at 11:30 -0400, J. Cliff Dyer wrote: On Thu, 2008-05-15 at 11:24 -0400, J. Cliff Dyer wrote: I'm trying to implement polymorphic inheritance using the sqlalchemy.ext.declarative, but the field that I want to use for the polymorphic_on is not in my polymorphic base table

[sqlalchemy] Re: Polymorphic across foreign key

2008-05-15 Thread J. Cliff Dyer
On Thu, 2008-05-15 at 12:27 -0400, Michael Bayer wrote: On May 15, 2008, at 12:12 PM, J. Cliff Dyer wrote: How can I use this field for polymorphism? Is it possible? polymorphic discriminators are currently table-local scalar columns. So if you had a many-to-one

[sqlalchemy] what = declarative_base

2008-04-02 Thread J. Cliff Dyer
It makes me twitch when I see the following: Base = declarative_base(metadata=metadata) class Spam(Base): ... Base is a singularly undescriptive name to use for the base class of a declarative table class. People are doing this because it's in the documentation. If it were changed there,

[sqlalchemy] Re: Use of new_instance() in the user-defined-state branch?

2008-03-28 Thread Phillip J. Eby
At 09:45 AM 3/28/2008 -0400, Michael Bayer wrote: On Mar 28, 2008, at 12:55 AM, Phillip J. Eby wrote: Sadly, about the only way for me to implement that without code duplication will be to temporarily change the item's __class__ to a subclass with an empty __init__ method. Unless there's

[sqlalchemy] Re: Use of new_instance() in the user-defined-state branch?

2008-03-28 Thread Phillip J. Eby
So you're still disagreeing with Jason, who's quite explicitly saying that SA's __init__ will blow up if it gets called. Which of you is right? :) At 11:38 AM 3/28/2008 -0400, Michael Bayer wrote: On Mar 28, 2008, at 10:58 AM, Phillip J. Eby wrote: Sorry, I should have included more

[sqlalchemy] Use of new_instance() in the user-defined-state branch?

2008-03-27 Thread Phillip J. Eby
I just noticed that in the latest version of the branch, there's a new_instance() call that is using a class' __new__ method in order to create a new instance, rather than using 'class()'. What I'd like to find out is how to get around this, because Trellis objects will not be properly

[sqlalchemy] Re: Use of new_instance() in the user-defined-state branch?

2008-03-27 Thread Phillip J. Eby
At 02:26 PM 3/27/2008 -0700, jason kirtland wrote: new_instance creates an instance without invoking __init__. The ORM uses it to recreate instances when loading from the database. new_instance can be added to InstrumentationManager as an extension method... The ORM doesn't care how

[sqlalchemy] Re: Integrating the ORM with Trellis

2008-03-04 Thread Phillip J. Eby
At 02:04 PM 3/3/2008 -0500, Michael Bayer wrote: the bug is that unregister_attribute() is not working, which the test suite is using to remove and re-register new instrumentation: class Foo(object): pass attributes.register_attribute(Foo, collection,

[sqlalchemy] Re: Integrating the ORM with Trellis

2008-03-03 Thread Phillip J. Eby
At 04:04 PM 2/27/2008 -0500, Michael Bayer wrote: do you have any interest in committing changes to the branch yourself ? as long as the unit tests keep running whatever you'd want is most likely fine with meotherwise I will at least experiment with doing away with __mro__ searching and

[sqlalchemy] Error in the behaviour of dynamic relation backreferences

2007-12-14 Thread David J. Mellor
I believe that I may have found an error in dynamic relation backrefences. When the dynamic query is executed, it appears to fetch all of the rows in the referenced table instead of only the ones linked to the object from which the dynamic relation was obtained. The following test script

[sqlalchemy] Re: Error in the behaviour of dynamic relation backreferences

2007-12-14 Thread David J. Mellor
On Friday 14 December 2007 7:41 am, Michael Bayer wrote: seems to work in SVN trunk, have you tried there ? Sorry - I forgot to mention that I ran this test against 0.4.1. I have not tried pulling from the trunk. --~--~-~--~~~---~--~~ You received this message

[sqlalchemy] ordering_list for many to many relations

2007-12-12 Thread Fernando J. Zunino
? -- Fernando J. Zunino Zauber S.A. http://www.zauber.com.ar/ signature.asc Description: OpenPGP digital signature