Re: [sqlalchemy] Callback for when orm data is load

2021-04-30 Thread Mike Bernson
, only_load_props)     else:     state._commit_all(dict_, session_identity_map) are there any events after this point in the loading/refresh process ? On 4/30/21 4:03 PM, Mike Bernson wrote: The load and refresh events is close to what I am looking for. I need

Re: [sqlalchemy] Callback for when orm data is load

2021-04-30 Thread Mike Bernson
Tue, Apr 27, 2021, at 3:43 PM, Mike Bernson wrote: That callback look like it happening before orm instances are created. I am looking for a callback that is after all the instances are created. I am using the events to get a list of instances that need work done when they are loaded from the

Re: [sqlalchemy] Callback for when orm data is load

2021-04-27 Thread Mike Bernson
m_execute_state.is_orm_statement:     result = orm_execute_state.invoke_statement()     rdbm_events.run_created()     return result On Tue, Apr 27, 2021, at 12:35 PM, Mike Bernson wrote: I am moving from version 1.0.14 to version 1.4.11 of sqlalchemy. I need to get a callback whe

[sqlalchemy] Callback for when orm data is load

2021-04-27 Thread Mike Bernson
I am moving from version 1.0.14 to version 1.4.11 of sqlalchemy. I need to get a callback when all of the data from orm query is loaded not just single instance. In the 1.0 version I created the session using query_cls: self.session = Session(bind=engine, autoflush=False,   

Re: [sqlalchemy] Problem build a query using just core

2014-09-16 Thread Mike Bernson
, subq.c.cost_center == m.c.cost_center, m.c.current_balance 0 ) ) ) print stmt On Sep 15, 2014, at 7:49 PM, Mike Bernson m...@mlb.org wrote: Here is simple table def from sqlalchemy import * db = create_engine('sqlite:///test.db') metadata = MetaData(db) trs_transaction = Table

[sqlalchemy] Problem build a query using just core

2014-09-15 Thread Mike Bernson
Given the table below I am trying to get the where statement built using just core. I have tried a number of thing and am not able to get the query built. I can get the query close but not correct. I must be missing something simple. The database is Mysql and SQLAchemy is 9.7 The query does

Re: [sqlalchemy] Problem build a query using just core

2014-09-15 Thread Mike Bernson
to send (simplified, succinct) table defs i can show you how to get that in core. On Sep 15, 2014, at 6:39 PM, Mike Bernson m...@mlb.org wrote: Given the table below I am trying to get the where statement built using just core. I have tried a number of thing and am not able to get the query built

[sqlalchemy] Problem going from 0.7.10 to 0.8.7

2014-07-29 Thread Mike Bernson
I have started moving my code base from 0.7.10 to 0.8.7 as first step to getting to current version. (There code changes for me to get to 0.9.x where there are no code changes to run under 0.8.x) I have found a problem with a query that worked on 0.7.10 and now fails with a raise. The code is

[sqlalchemy] difference for type BigInteger between 0.6.6 and 0. 7.0b2

2011-03-07 Thread Mike Bernson
from sqlalchemy import * meta = MetaData() stx_setup = Table(stx_setup, meta, Column('id', BigInteger(display_width=20), primary_key=True, autoincrement=T rue), Column('cost_center', Integer(display_width=1), index=True, nullable=True), Column('AdministratorLicense',

[sqlalchemy] moving from mapper extension to events

2010-12-29 Thread Mike Bernson
Looking at the events for instances. The on_expire passes a list of attributes being expired but the on_refresh does not have a list of attribute being refresh. Can the list of attribute being refreshed be add to on_refresh event ? I am looking to move from using mapperextension to instance

[sqlalchemy] Look for the best way to undelete a model

2010-11-04 Thread Mike Bernson
I have a transaction started with begin I then delete a record in the transaction. I then commit and the commit fails. I now want to continue by undelete the record but leave record in the session. I want to leave the record in the session because session is doing caching. The session is

Re: [sqlalchemy] Having case problem with column name in postgresql

2010-06-10 Thread Mike Bernson
Michael Bayer wrote: On Jun 10, 2010, at 12:06 AM, Mike Bernson wrote: I am trying to access a postgres database with mixed case column names. I am using reflection to get the table. Here is my connect string: 'postgresql://:mike@/cedar_senior_services' The error message

[sqlalchemy] Having case problem with column name in postgresql

2010-06-09 Thread Mike Bernson
I am trying to access a postgres database with mixed case column names. I am using reflection to get the table. Here is my connect string: 'postgresql://:mike@/cedar_senior_services' The error message: (ProgrammingError) column active does not exist LINE 1: select * from license where

Re: [sqlalchemy] restoring the TINYINT(1) to Boolean

2010-06-01 Thread Mike Bernson
Thanks Setting column.type worked like a charm for me. Michael Bayer wrote: On May 31, 2010, at 10:01 PM, Mike Bernson wrote: I would like to restore the TINYINT(1) for all tables. I am using reflection to get the tables. The docs talk about passing in override value for the columns that I

[sqlalchemy] restoring the TINYINT(1) to Boolean

2010-05-31 Thread Mike Bernson
I would like to restore the TINYINT(1) for all tables. I am using reflection to get the tables. The docs talk about passing in override value for the columns that I to want change from the database as parameters to the table object on when reflecting. Since I have no idea what columns are

Re: [sqlalchemy] restoring the TINYINT(1) to Boolean

2010-05-31 Thread Mike Bernson
will try just setting column.type I have not thought about doing that. Setting the dialect.ischema_names will not work because I only want to get tinyint(1) not all tinyint. Michael Bayer wrote: On May 31, 2010, at 10:01 PM, Mike Bernson wrote: I would like to restore the TINYINT(1) for all

[sqlalchemy] problem with warning on reflection

2010-04-03 Thread Mike Bernson
I am getting warning using 0.6beta2. The database is mysql. I get the following warning: /usr/local/ltcd/lib/SQLAlchemy-0.6beta2-py2.6.egg/sqlalchemy/dialects/mysql/base.py:2241: SADeprecationWarning: Manually quoting ENUM value literals is deprecated. Supply unquoted values and use the

[sqlalchemy] Attribute events

2009-02-11 Thread Mike Bernson
I am trying to move from 0.5beta4 to 0.5.2 The attribute events are giving me a problem The code worked in 0.5beta4 and now is broken. class base(object): __sa_instrumentation_manager__ = SetListener listener = ReceiveEvents() class SetListener(InstrumentationManager): def

[sqlalchemy] Re: Attribute events

2009-02-11 Thread Mike Bernson
is assembled. Mike Bernson wrote: I am trying to move from 0.5beta4 to 0.5.2 The attribute events are giving me a problem The code worked in 0.5beta4 and now is broken. class base(object): __sa_instrumentation_manager__ = SetListener listener = ReceiveEvents() class

[sqlalchemy] How to handle using master and number of slaves

2008-11-08 Thread Mike Bernson
I am looking at how to have 2 engines a session. I want to be able to switch between engine used based on if any writes will be happening to the data being read. I can tell if any data will be modify by if the transaction started by issues a begin. I want to setup a number of server doing

[sqlalchemy] Re: How to handle using master and number of slaves

2008-11-08 Thread Mike Bernson
Glad to known that it that simple. Thanks Michael Bayer wrote: On Nov 8, 2008, at 3:07 PM, Mike Bernson wrote: I am looking at how to have 2 engines a session. I want to be able to switch between engine used based on if any writes will be happening to the data being read. I can tell

[sqlalchemy] Re: Problem with query and lazyload

2008-09-28 Thread Mike Bernson
. On Sep 27, 2008, at 1:52 PM, Mike Bernson wrote: I have a problem with row coming back form mapped class that has relations. The session is created with: self.session = Session(bind=self._engine, autoflush=False, _enable_transaction_accounting=False

[sqlalchemy] Attribute extension in 0.5rc1

2008-09-28 Thread Mike Bernson
The set method has changed from 0.5b3 to 0.5rc1. The old set method set the value before it called the set method in attribute extension. The new method set the value after the set method is called. This is cause me problems because the methods that I am dispatching to think the attribute is

[sqlalchemy] Re: Attribute extension in 0.5rc1

2008-09-28 Thread Mike Bernson
Michael Bayer wrote: On Sep 28, 2008, at 8:23 PM, Mike Bernson wrote: The set method has changed from 0.5b3 to 0.5rc1. The old set method set the value before it called the set method in attribute extension. The new method set the value after the set method is called. This is cause

[sqlalchemy] Problem with query and lazyload

2008-09-27 Thread Mike Bernson
I have a problem with row coming back form mapped class that has relations. The session is created with: self.session = Session(bind=self._engine, autoflush=False, _enable_transaction_accounting=False, autocommit=True, weak_identity_map=True) The problem occurs with

[sqlalchemy] Re: Problem with query and lazyload

2008-09-27 Thread Mike Bernson
, at 1:52 PM, Mike Bernson wrote: I have a problem with row coming back form mapped class that has relations. The session is created with: self.session = Session(bind=self._engine, autoflush=False, _enable_transaction_accounting=False, autocommit=True

[sqlalchemy] mapper extension

2008-05-20 Thread Mike Bernson
I am looking for a hook after a instance has been created, attribute populated and any initialization done. I have found populate_instance in the MapperExtension. It look like to close thing. Adding a hook to MapperExtension for after instance is created, populated, and any initialization by the

[sqlalchemy] Re: trunk is now on 0.5

2008-05-10 Thread Mike Bernson
Is the stuff from user_defined_state branch merge in ? If so is the __sa_instrument_class__ stuff the same ? Michael Bayer wrote: hey list - as you might have noticed we've merged 0.5 into the trunk. this version is already spectacular and I encourage everyone to start poking

[sqlalchemy] using a model inherits from dict

2008-03-29 Thread Mike Bernson
I am trying to use models that inherit from dict. The models use attribute access for the sqlachemy attributes and dict style access for gui stuff. This allow me to do things like model[column_name].editable for gui to see if item should be grayed out and model.column_name for access the

[sqlalchemy] Re: using a model inherits from dict

2008-03-29 Thread Mike Bernson
dict. On Sat, Mar 29, 2008 at 3:08 PM, Mike Bernson [EMAIL PROTECTED] wrote: I am trying to use models that inherit from dict. The models use attribute access for the sqlachemy attributes and dict style access for gui stuff. This allow me to do things like model[column_name].editable

[sqlalchemy] I am having a problem inserting records and getting a exception

2008-02-18 Thread Mike Bernson
I have attached the code doing the write to the database and a traceback with local variable being display for each frame. I am also attaching a run with nothing catching the error so you can see the simple traceback with the exception. Here is output from mysql show this has gone a long way

[sqlalchemy] Re: I am having a problem inserting records and getting a exception

2008-02-18 Thread Mike Bernson
You are correct. Sorry I some how skipped over the last entry. Thanks jason kirtland wrote: Mike Bernson wrote: I have attached the code doing the write to the database and a traceback with local variable being display for each frame. I am also attaching a run with nothing catching

[sqlalchemy] how to role back a delete from the session.

2008-02-08 Thread Mike Bernson
I have a case where a delete was requested and on the commit to the transaction the delete fails with a integrity error. Problem is a foreign key constraint will not let the record be delete. Now I have a session which tries to delete this record any time I flush things. I have rolled back the

[sqlalchemy] Re: how to role back a delete from the session.

2008-02-08 Thread Mike Bernson
Michael Bayer wrote: On Feb 8, 2008, at 1:06 PM, Mike Bernson wrote: I have a case where a delete was requested and on the commit to the transaction the delete fails with a integrity error. Problem is a foreign key constraint will not let the record be delete. Now I have a session

[sqlalchemy] Unicode data into Binary type

2008-01-07 Thread Mike Bernson
Database is mysql I am having a problem with unicode and binary type. I am using an XML parse the return Unicode strings. I have a table in mysql with the default character set as utf8 I set the charset to utf8 in the connect string to charset=utf8 I am trying to send a unicode string to the

[sqlalchemy] Re: SQLAlchemy 0.4.2b released

2008-01-07 Thread Mike Bernson
Mike You just need pick letter that are after release. Thing like p1 is greater then release from the egg docs. (A note about versions: the egg runtime system understands typical version numbering schemes, so it knows that versions like 1.2a1 and 1.2rc5 are actually older than the plain

[sqlalchemy] doing replaces

2008-01-04 Thread Mike Bernson
I have code that need to do a mysql replace instead of an insert. The quick hack to just create a string and execute has problems with quoting things, sql injection ... If a table.replace() is not easy to do is there a way to create a statement that works that way. If I could do a

[sqlalchemy] Re: doing replaces

2008-01-04 Thread Mike Bernson
].type) for key in keys]) trans = conn.begin() conn.execute(replace(mytable, ['one', 'two', 'three']), [{'one':1, 'two':2, 'three':3}, {...}, {...}, ...]) trans.commit() On Jan 4, 2008, at 1:27 PM, Mike Bernson wrote: I have code that need to do a mysql replace instead of an insert

[sqlalchemy] Re: Weak Referencing Session

2007-09-11 Thread Mike Bernson
Is there any chance of making it an option to not have a weak reference ? How about something on the session level with sessionmaker ? Having it the session level would help me but not sure if make sense there. I have things in the model object that depend on the object not going away. I have

[sqlalchemy] Re: looking to make

2007-07-18 Thread Mike Bernson
can it also be added to 3.9 ? jason kirtland wrote: [this one seems to have been lost in googlegroups too, resending...] Mike wrote: I started looking to what is happen to get table information from mysql. I found that the following is issued for every table that is reflected:

[sqlalchemy] Re: looking to make

2007-07-18 Thread Mike Bernson
sounds good. Looking forward to see it in 3.10dev jason kirtland wrote: Mike wrote: can it also be added to 3.9 ? Sure, if there's another release in the 0.3 line the case-check cache can go in. But the only use SHOW CREATE change will be likely be a 0.4-only thing. -j

[sqlalchemy] looking to make

2007-07-17 Thread Mike Bernson
I started looking to what is happen to get table information from mysql. I found that the following is issued for every table that is reflected: 2007-07-18 00:29:08,158 INFO sqlalchemy.engine.base.Engine.0x..cc show variables like 'character_set%%' 2007-07-18 00:29:08,158 INFO

[sqlalchemy] Re: Exception raised on insert blob.

2007-05-25 Thread Mike Bernson
of mysqldb. Thanks for the help Michael Bayer wrote: On May 24, 2007, at 10:12 PM, Mike Bernson wrote: It give me an error attaching output well that tests passes for everyone else AFAIK, so maybe something is up with either the way youre connecting to MySQL (are you turning

[sqlalchemy] Re: Exception raised on insert blob.

2007-05-24 Thread Mike Bernson
: On May 24, 2007, at 10:12 PM, Mike Bernson wrote: It give me an error attaching output well that tests passes for everyone else AFAIK, so maybe something is up with either the way youre connecting to MySQL (are you turning on the use_unicode flag? ) or maybe your version of MySQLDB