Re: [sqlalchemy] connected using pyodbc; how to hook that to SA?

2016-02-19 Thread Simon King
rectly? Thanks! > > You can pass a "creator" argument to create_engine if you want to create the connection yourself: http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#custom-dbapi-connect-arguments http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#sqlalchemy.create_engin

Re: [sqlalchemy] Padding columns to a query

2016-02-17 Thread Simon King
but alas. > > I think you can use literal_column for this, something like: import sqlalchemy as sa print sa.select([sa.literal_column("'stuph'").label('attribute')]) output: SELECT 'stuph' AS attribute Beware that literal_column doesn't use bind parameters or do an

Re: [sqlalchemy] Where to use and vs and_()

2016-02-17 Thread Simon King
nce than the comparison operators, so this probably wouldn't do what you expect: expr1 == expr2 & expr3 == expr4 You'd need to write that as: (expr1 == expr2) & (expr3 == expr4) Simon -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] Pyodbc.Connection has no attribute 'dbms_ver'?

2016-02-15 Thread Simon King
://pypi.python.org/pypi/pyodbc) ibm_db (https://pypi.python.org/pypi/ibm_db/) ibm_db_sa (https://pypi.python.org/pypi/ibm_db_sa) What versions do you have of each of them? Note that https://github.com/ibmdb/python-ibmdbsa/tree/master/ibm_db_sa says that pyodbc support is experimental. Simon

Re: [sqlalchemy] Best practice for restricting input to columns?

2016-02-05 Thread Simon King
ke in the setter you posted above. > > Cheers, > > Michal > > There are also lots of general-purpose Python validation libraries. I happen to like Colander (http://colander.readthedocs.org/en/latest/). There's a library that purports to generate Colander schemas from SQLAlchemy m

Re: [sqlalchemy] Modifying records across multiple modules?

2016-02-04 Thread Simon King
stomer class instead. Can you get the Customer class into your self.choices array, either instead of the table, or as well as? Where are you getting the object that you are putting in the first element of each of the self.choices list? Simon On Thu, Feb 4, 2016 at 11:34 AM, Alex Hall <ah...@autod

Re: [sqlalchemy] Itterating over database row?

2016-02-04 Thread Simon King
> On 4 Feb 2016, at 18:19, Alex Hall <ah...@autodist.com> wrote: > > Hello all, > I'm setting my application up the way Simon suggested. I still use the > table object so I can get its name for displaying in one list, but the > other list (which holds the actual ro

Re: [sqlalchemy] Modifying records across multiple modules?

2016-02-04 Thread Simon King
. Hope that makes sense, Simon On Thu, Feb 4, 2016 at 2:07 PM, Alex Hall <ah...@autodist.com> wrote: > This is where sqlalchemy gets murky for me. If I return all classes, > I'm not returning all *instances* of those classes. How, then, would I > update a given customer's record?

Re: [sqlalchemy] Modifying records across multiple modules?

2016-02-04 Thread Simon King
there) Simon On Thu, Feb 4, 2016 at 12:32 PM, Alex Hall <ah...@autodist.com> wrote: > Yes, I'm using Declarative. I was following a great tutorial, then > realized it was way out of date. The one recommended on the forum I > found said to use Declarative, so I did. > > In DBInterfac

Re: [sqlalchemy] Modifying records across multiple modules?

2016-02-03 Thread Simon King
, …)” instead. Simon > On 3 Feb 2016, at 17:43, Alex Hall <ah...@autodist.com> wrote: > > I'm on the Gmail site, so am not sure I can reply in-line. Sorry. > > This is a basic table class, like > class Customer(base): > __tablename__ = "customers" > name = Col

Re: [sqlalchemy] Modifying records across multiple modules?

2016-02-03 Thread Simon King
ed to provide more > code or context. > > Is your query against a single mapped class, or is it against some set of columns? What do you get if you write: print type(self.records[self.selectedRecordIndex]) print repr(self.records[self.selectedRecordIndex]) ...at the point where you are

Re: [sqlalchemy] Stand-alone Sequences are not created by create_all

2016-01-27 Thread Simon King
ta “”” Additionally, the appropriate CREATE SEQUENCE/ DROP SEQUENCE DDL commands will be emitted corresponding to this Sequence when MetaData.create_all() andMetaData.drop_all() are invoked. “”” For this to work, the Sequence needs to be attached to the Metadata, which you can access as Base.metadata.

Re: [sqlalchemy] hybrid property / expression returns entire table

2016-01-15 Thread Simon King
f __name__ == '__main__': sm = saorm.sessionmaker() session = sm() print session.query(Sample.pk).filter(Sample.nsa_logmstar < 9) And here's the output: SELECT sample.pk AS sample_pk FROM sample WHERE log(sample.nsa_mstar) < :log_1 Simon On Fri, Jan 15, 2016 at 2:23 PM, Brian

Re: [sqlalchemy] hybrid property / expression returns entire table

2016-01-15 Thread Simon King
Does my test script produce the right output for you in your installation? What does the print statement immediately after the class definition produce? Simon > On 15 Jan 2016, at 19:10, Brian Cherinka <havok2...@gmail.com> wrote: > > Actually, the class definition is entirel

Re: [sqlalchemy] hybrid property / expression returns entire table

2016-01-15 Thread Simon King
table already have a nsa_logmstar column? (I don’t think that should matter, but it would be worth checking) Simon > On 15 Jan 2016, at 22:27, Brian Cherinka <havok2...@gmail.com> wrote: > > It looks like I needed to define the columns inside my class. That's the > only differ

Re: [sqlalchemy] hybrid property / expression returns entire table

2016-01-15 Thread Simon King
roperty in your query. What happens if you "print Sample.nsa_logmstar" just before the query? Otherwise, please provide a small runnable script that demonstrates the problem. Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy&quo

Re: [sqlalchemy] association proxy and eager loading

2015-12-18 Thread Simon King
').joinedload('item')) http://docs.sqlalchemy.org/en/rel_1_0/orm/loading_relationships.html#loading-along-paths Hope that helps. Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop re

Re: [sqlalchemy] Table object to mapped class (model)

2015-12-10 Thread Simon King
h involves using the sqlalchemy.orm.mapper function to associate a Table with a class: http://docs.sqlalchemy.org/en/rel_1_0/orm/mapping_styles.html#classical-mappings Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. T

Re: [sqlalchemy] Re: Creating a derived class object without inserting into base class table

2015-12-01 Thread Simon King
, or if you are trying to share state between and A and a B instance then you probably don't want inheritance at all, but a shared relationship instead. If you can tell us what you are trying to do, we might be able to suggest an approach. Simon On Mon, Nov 30, 2015 at 4:46 PM, amit geron <amit

Re: [sqlalchemy] event.listen questions

2015-12-01 Thread Simon King
re level, so it may not be possible to inspect the class associated with the table at that point (I don't know). If you can't, perhaps you could use one of the ORM events to install a listener on the specific table. Hope that helps, Simon -- You received this message because you are subscribed to th

Re: [sqlalchemy] Re: Creating a derived class object without inserting into base class table

2015-12-01 Thread Simon King
ample, when creating a new Patient, you'd need to explicitly create the associated User object as well. Hope that helps, Simon On Tue, Dec 1, 2015 at 10:34 AM, amit geron <amit.ge...@gmail.com> wrote: > Hi Simon, > > Thanks for the reply. > > I will try to better explain what

Re: [sqlalchemy] Re: Creating a derived class object without inserting into base class table

2015-12-01 Thread Simon King
nly the way you were choosing to model that information in Python that was causing the problem. Simon On Tue, Dec 1, 2015 at 3:55 PM, amit geron <amit.ge...@gmail.com> wrote: > Thanks again for your answers. > > Although this seems like an elegant solution, I would still w

Re: [sqlalchemy] new object using a dictionary as the parameter

2015-11-23 Thread Simon King
nitial values as keyword arguments, so you can write something like: call_record = CallRecord(a=123, b=456) In Python, you can call a function with keyword arguments from a dictionary using the “**” syntax: args = {‘a’: 123, ‘b’: 456} call_record = CallRecord(**args) Hope that helps,

Re: [sqlalchemy] Domain models and "leaky abstractions"

2015-11-13 Thread Simon King
ort. > > I would appreciate any ideas. > > I'm probably suffering from a lack of imagination here, but this seems like an impossible task. How could SQLAlchemy know ahead of time whether you are going to access the "city" property on any given user? And whether you're going to a

Re: [sqlalchemy] Problem with hybrid_property

2015-10-14 Thread Simon King
> c = se.query(Caja).get(1) >>> c <Caja('1', Cond. None Ent:Eprueba Fch:None Grup:grp', Ent: 50' Sal: 10 Imp:40.00)> >>> c.imp 40.0 >>> sa.__version__ ‘1.0.8' Have you tried printing out the things I suggested earlier? Simon > On 14 Oct 2015, at 08:58, Cecili

Re: [sqlalchemy] Problem with hybrid_property

2015-10-13 Thread Simon King
and poke around at the object interactively? Otherwise, you’re going to have to send us a complete script that demonstrates the problem. Simon > On 13 Oct 2015, at 22:37, Cecilio Ruiz <cecili...@gmail.com> wrote: > > The error message says: : "AttributeError: 'Caja' obj

Re: [sqlalchemy] Problem with hybrid_property

2015-10-13 Thread Simon King
ad, self.Fecha, > self.Grupo, self.Entrada, self.Salida, self.imp) > Can you share the full traceback? Caja.Imp doesn’t exist, but Caja.imp (note lower case “i”) should, so assuming that was a typo in your email, there must be some other problem. Simon -- You received this message becau

Re: [sqlalchemy] sqlite problem with datetime format YYYY-MM-DDTHH:mm:ss

2015-09-03 Thread Simon King
html#sqlalchemy.dialects.sqlite.DATETIME Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To p

Re: [sqlalchemy] UnicodeDecode error on sqlalchemy select query

2015-08-26 Thread Simon King
in the application it has changed.) There's some information about that in the docs at http://docs.sqlalchemy.org/en/rel_1_0/orm/session_basics.html#flushing Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

Re: [sqlalchemy] Session.merge() use case (possible) ambiguity

2015-08-13 Thread Simon King
dictates which existing database rows you are trying to merge with. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

Re: [sqlalchemy] [alembic] how do I add a many-to-many relation with add_column()

2015-08-12 Thread Simon King
: subs = sao.relationship(Sub, secondary=model_sub_relation, backref=model) Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

Re: [sqlalchemy] How to enter value for foriegn key field via sqlalchemy

2015-06-22 Thread Simon King
'_sa_instance_state' Please help The columns that you set up on your Comment class (including the post_id foreign key column) can be used directly. ie. Comment(body=form.post.data, post_id=form.p_id.data) Hope that helps, Simon -- You received this message because you are subscribed

Re: [sqlalchemy] NameError: name 'Index' is not defined

2015-06-19 Thread Simon King
and so on. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email

Re: [sqlalchemy] how to return an array of dicts

2015-06-01 Thread Simon King
. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy

Re: [sqlalchemy] restrict child count?

2015-05-19 Thread Simon King
validators. I don't know enough Postgres, but I suspect you could also enforce it at the database level. Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy

Re: [sqlalchemy] contains_eager limited by .first()?

2015-05-05 Thread Simon King
to retrieve users that lived in a certain city). http://docs.sqlalchemy.org/en/improve_toc/orm/loading_relationships.html#the-zen-of-eager-loading Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group

Re: [sqlalchemy] Documentation for SQLAlchemy 0.4.5?

2015-04-16 Thread Simon King
/a83d216ab6e8d064013107ba981e910b04986e8d/doc/build/?at=rel_0_4_5 Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post

Re: [sqlalchemy] How to add custom attribute to the session?

2015-03-30 Thread Simon King
define a subclass of the sqlalchemy Session, and ask sessionmaker to return instances of that class by passing the class_ parameter to sessionmaker(): http://docs.sqlalchemy.org/en/rel_0_9/orm/session_api.html#session-and-sessionmaker Would that do what you wanted? Simon -- You received this message

Re: [sqlalchemy] is True vs ==True

2015-03-30 Thread Simon King
expressions define an __eq__ method to enable expression == value-style constructs. There is no equivalent hook in Python for the is operator, so there is no way SQLAlchemy could use it. Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe

Re: [sqlalchemy] How to add custom attribute to the session?

2015-03-30 Thread Simon King
Can't you write it like this (untested)? # class CRUDSession(sqlalchemy.orm.Session): def sacrud(self, cls): return CRUD(self, cls) Session = scoped_session(sessionmaker(class_=CRUDSession)) # Simon On Mon, Mar 30, 2015 at 3:15 PM, uralbash svintso...@gmail.com wrote: More

Re: [sqlalchemy] sqlalchemy (0.9.7) double quoting python list items when used in where in statement

2015-03-23 Thread Simon King
your preferences table, you can use its sql-building constructs, something like: q = sqlsession.query(Preferences).filter(Preferences.recipient.in_(message.recipients)) ...otherwise you probably need to build a list of bind parameters yourself. Hope that helps. Simon -- You received

Re: [sqlalchemy] Is there any potential problem to store datetime as strings in one column?

2015-03-23 Thread Simon King
, if you're never going to query based on that column, and you're not storing so many rows that saving a few bytes per row matters, then I can't see any problems with storing the value as a string. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] Sqlalchemy, Flask-User scoped_session

2015-03-16 Thread Simon King
like flask-user assumes that you are using Flask-SQLAlchemy's special declarative_base class. I think that as long as you use Flask-SQLAlchemy's session (which is a scoped_session) and declarative_base everywhere, you will probably be fine. Hope that helps, Simon -- You received this message

Re: [sqlalchemy] core integrity error

2015-03-13 Thread Simon King
MySQL might truncate strings if they are too long for the column, so 2 strings that you thought were unique might end up being duplicates due to truncation. Simon On Fri, Mar 13, 2015 at 5:21 PM, Adam Watson adamcwatso...@gmail.com wrote: I spoke way too soon, using the setup you suggested Simon

Re: [sqlalchemy] core integrity error

2015-03-13 Thread Simon King
= insert.values({{'obj_id' : attr['obj_id'], ...}) self.engine.execute(stmt) Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

Re: [sqlalchemy] Can I make an update over a table that comes from sqlalchemy.MetaData(...).reflect()?

2015-03-12 Thread Simon King
this is shown at http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/declarative/table_config.html#using-reflection-with-declarative), then use something like this: user = session.query(MyUserClass).get(id_user) user.name = ed session.flush() Hope that helps, Simon -- You received

Re: [sqlalchemy] Re: many-to-many relation: unexpected count of rows

2015-03-05 Thread Simon King
, uk.user And the output was: __main__.UserKeyword object at 0x11235910 __main__.User object at 0x11227f50 __main__.UserKeyword object at 0x11235a90 __main__.User object at 0x11227f50 ie. the UserKeyword objects were associated with the user. Simon On Thu, Mar 5, 2015 at 2:30 PM, Pavel S pa

Re: [sqlalchemy] Re: many-to-many relation: unexpected count of rows

2015-03-05 Thread Simon King
= UserKeyword(kw) user.user_keywords.append(uk) In this code, the UserKeyword's user property is not set explicitly, but because of the backref on User.user_keywords, appending to the list will cause the user property to be assigned. Simon On Thu, Mar 5, 2015 at 11:46 AM, Pavel S pa

Re: [sqlalchemy] Re: many-to-many relation: unexpected count of rows

2015-03-05 Thread Simon King
extension: http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/associationproxy.html#simplifying-association-objects Hope that helps, Simon On Thu, Mar 5, 2015 at 10:43 AM, Pavel S pa...@schon.cz wrote: Hi, Adding viewonly=True on User.groups relationship solved the issue. cheers! Dne čtvrtek

Re: [sqlalchemy] Advice on multiple ORM classes in multiple files and imports

2015-03-02 Thread Simon King
that your imports are structured as simply as possible and avoid circular dependencies. Hope that helps, Simon On Mon, Mar 2, 2015 at 11:57 AM, Martino Io martino8...@gmail.com wrote: Hi Simon, definitely multiple imports is the issue here, however I don't know how to get rid of it, let's say I

Re: [sqlalchemy] Advice on multiple ORM classes in multiple files and imports

2015-03-02 Thread Simon King
than once. Try putting print 'importing module %s' % __name__ before your class definition. If you see the output more than once, then the module is being imported multiple times under different names. Hope that helps, Simon -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] How do we define a relationship in sqlalchemy for a innodb file without actually creating the FK

2015-02-24 Thread Simon King
that helps, Simon On Tue, Feb 24, 2015 at 7:56 AM, eli rashlin eli.rash...@gmail.com wrote: Thanks Simon for your replay. when I'm removing the FK definition from the Column - The tables are being built as they should - the ptoblem is when i try to perform a join I'm getting the following error

Re: [sqlalchemy] How do we define a relationship in sqlalchemy for a innodb file without actually creating the FK

2015-02-24 Thread Simon King
Simon - wrong query... This is the query that gives me the error query_obj = engine.query(signals_table.Signals.sig_value, signals_table.Signals.exist_in_frames, signals_table.Signals.local_frames, clips_table.Clips.clip_name

Re: [sqlalchemy] Re: Deleting from relationship

2015-02-23 Thread Simon King
at https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/UniqueObject. Hope that helps, Simon On Sun, Feb 22, 2015 at 9:27 PM, Asad Dhamani dhamania...@gmail.com wrote: I looked at my code some more, and found a now obvious mistake. I changed my code to: def edit(id, tags=None

Re: [sqlalchemy] How do we define a relationship in sqlalchemy for a innodb file without actually creating the FK

2015-02-23 Thread Simon King
a relationship(), but since you are already explicitly specifying the primaryjoin conditions, the ForeignKey() calls are unnecessary. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop

Re: [sqlalchemy] Seamlessly combining data from multiple tables into a single SQLalchemy object

2015-02-11 Thread Simon King
On Wed, Feb 11, 2015 at 4:10 PM, Jonathan Vanasco jonat...@findmeon.com wrote: Simon, why not use the association_proxy? You just described this: from sqlalchemy.ext.associationproxy import association_proxy class Foo(Base): _bar = relationship(Bar, uselist=False, lazy='joined') qux

Re: [sqlalchemy] Seamlessly combining data from multiple tables into a single SQLalchemy object

2015-02-11 Thread Simon King
: qux = proxyproperty('_bar.qux') Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post

Re: [sqlalchemy] Why is assignment of a transient parent object does not automatically add this parent object into the session?

2015-02-10 Thread Simon King
print(john in s) # should be True print(it_department in s) # should be True, however this is not true. I don’t know if this is the problem, but you appear to have a typo: john.departments = it_department ...but the relationship is called “department”, not “departments” HTH, Simon

Re: [sqlalchemy] Handling of differences between a table and its mapped class

2015-01-23 Thread Simon King
in the database after they've been created), the new default will be used, but SQLAlchemy won't care. Is it occasionally appropriate to use different column properties by the mapped Python classes? Maybe? *shrug* Simon -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] Difficulties with parallel data insertion into the same table

2015-01-23 Thread Simon King
will work in a high-concurrency context? Yes. How many database implementations support the simultaneous table creation according to the rules from transaction management? No idea. You'd need to ask the makers of all the databases you are interested in. Simon -- You received this message

Re: [sqlalchemy] SQL join between two tables from two databases

2015-01-21 Thread Simon King
/en/rel_0_9/core/metadata.html#sqlalchemy.schema.MetaData http://docs.sqlalchemy.org/en/rel_0_9/core/metadata.html#metadata-describing Hope that helps, Simon On Wed, Jan 21, 2015 at 9:09 AM, Brian Glogower bglogo...@ifwe.co wrote: Hi Michael, Do I need to redefined mapped class ssh_host_keys

Re: [sqlalchemy] session query and column names

2015-01-13 Thread Simon King
= getattr(myModel, columnname) condition = operators[operator](col, value) Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy

Re: [sqlalchemy] loop over two large tables to join them

2015-01-04 Thread Simon King
= M.b_id If you still need to do this in batches, or need to run it repeatedly as new data arrives, you’ll probably want to add a “WHERE A.b_id IS NULL” and possibly a LIMIT to the inner query. Hope that helps, Simon On 3 Jan 2015, at 08:07, Mehdi mese1...@gmail.com wrote: It did help me

Re: [sqlalchemy] loop over two large tables to join them

2015-01-01 Thread Simon King
) .limit(batch_size) .all()) if not batch: break for a_row, b_row in batch: a_row.b_id = b_row.id session.commit() Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe

Re: [sqlalchemy] no such table error

2014-12-11 Thread Simon King
sqlalchemy.create_engine to see exactly what file is being used, and I would use the sqlite3 command line tool to inspect the contents of that file. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group

Re: [sqlalchemy] AmbiguousForeignKeysError or CircularDependencyError

2014-12-11 Thread Simon King
defined it will run an ALTER TABLE statement to create the foreign key. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

Re: [sqlalchemy] create a relationship to the latest item (i.e. many-to-one, where the 'one' is ordered)

2014-12-05 Thread Simon King
had from this list at the time) Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group

Re: [sqlalchemy] Re: Generate a column value and store it.

2014-12-01 Thread Simon King
://docs.sqlalchemy.org/en/rel_0_9/orm/events.html#sqlalchemy.orm.events.SessionEvents.before_flush That event would be triggered any time the session was flushed, so you'd need to iterate over the list of instances looking for instances of your MagicItem class. Hope that helps, Simon -- You

Re: [sqlalchemy] Why sqlalchemy (version 0.9.7) can't be imported in python(version 2.7.2) command line

2014-11-19 Thread Simon King
installing setuptools (https://pypi.python.org/pypi/setuptools) first? Simon On Wed, Nov 19, 2014 at 7:58 AM, Xiaohua Zou xiaohua@tieto.com wrote: Hello Simon, Thanks for your reply. But that's all install log. I wonder why SQLAlchemy package is NOT copied to ..\python\Lib\site-packages

Re: [sqlalchemy] Why sqlalchemy (version 0.9.7) can't be imported in python(version 2.7.2) command line

2014-11-18 Thread Simon King
of the install log say? (The bit that is off the bottom of your screenshot) Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post

Re: [sqlalchemy] Re: Problem installing

2014-11-13 Thread Simon King
something like ./SQLAlchemy-0.9.8-py3.4.egg, which would normally cause that directory to be appended to your sys.path. So the first question would be was SQLAlchemy properly added to easy_install.pth?, and the second would be why isn't your Python installation using the .pth file properly? Simon

Re: [sqlalchemy] [Q] Semantic difference in not equal operator

2014-11-03 Thread Simon King
On 3 Nov 2014, at 13:08, Ladislav Lenart lenart...@volny.cz wrote: Hello. On 31.10.2014 18:33, Simon King wrote: At a guess, I would say that the Python code Foo.bar != bar means that you are looking for Foo objects that aren't related to bar. This includes Foos that are related

Re: [sqlalchemy] [Q] Semantic difference in not equal operator

2014-10-31 Thread Simon King
OR foo.bar_id is NULL. Whereas in the other instance, you've asked for something more specific, so that's what SA has given you. Simon On 31 Oct 2014, at 16:36, Ladislav Lenart lenart...@volny.cz wrote: Hello. I have just noticed (by accident) a semantic difference of the not-equal

Re: [sqlalchemy] creating engine in python, No module named 'MySQLdb'

2014-10-28 Thread Simon King
://docs.sqlalchemy.org/en/rel_0_9/core/tutorial.html use sqlite. Which tutorial are you trying to follow? Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send

Re: [sqlalchemy] Child count as an object property

2014-10-16 Thread Simon King
GROUP BY 1 means group by the first column in the select, doesn't it? Which in this case would be parent_id. Simon On Thu, Oct 16, 2014 at 4:34 PM, Michael Bayer mike...@zzzcomputing.com wrote: What's the group_by 1 do? Didn't you mean group_by parent_id? Sent from my iPhone On Oct 16

Re: [sqlalchemy] Any examples of using session events?

2014-10-14 Thread Simon King
into a history table whenever an object changes: https://bitbucket.org/zzzeek/sqlalchemy/src/09e2a15a8052/examples/versioned_history/history_meta.py?at=master#cl-204 Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe

Re: [sqlalchemy] Handling detached instances

2014-09-30 Thread Simon King
Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy

Re: [sqlalchemy] Self-Referential Association Relationship SQLalchemy

2014-09-25 Thread Simon King
=(to_contact_id == Contact.id), backref='from_relations') Hope that helps, Simon On Wed, Sep 24, 2014 at 8:27 PM, Mohammad Reza Kamalifard mr.kamalif...@gmail.com wrote: Thanks, I want to create a relationship between two contact object and add more data like

Re: [sqlalchemy] Self-Referential Association Relationship SQLalchemy

2014-09-24 Thread Simon King
Could you show the whole model and table definition? I've lost track of exactly what you've written. Thanks, Simon On Wed, Sep 24, 2014 at 11:15 AM, Mohammad Reza Kamalifard mr.kamalif...@gmail.com wrote: thanks Mike with new to_contacts relationship i have new error ArgumentError: Could

Re: [sqlalchemy] Self-Referential Association Relationship SQLalchemy

2014-09-24 Thread Simon King
relationships, then use an association proxy to hide the ContactRelation when you don't need it explicitly: http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/associationproxy.html Hope that helps, Simon On Wed, Sep 24, 2014 at 2:15 PM, Mohammad Reza Kamalifard mr.kamalif...@gmail.com wrote: Here

Re: [sqlalchemy] Re: Specify Protected keywords in new SQL Dialect

2014-09-19 Thread Simon King
/master/lib/sqlalchemy/dialects/postgresql/base.py#cl-1631 Hope that helps, Simon On Fri, Sep 19, 2014 at 11:33 AM, Matthew Rocklin mrock...@gmail.com wrote: Alternatively if someone can point me to the appropriate docs on this I'd be much obliged. A cursory view of the docs and Google didn't

Re: [sqlalchemy] simple relationship join ends up in 1 s

2014-09-11 Thread Simon King
the itemsbought property, it issues a new query for each order. Try starting with something like this: customerorders = (sqlsession.query(Customerorder) .options(saorm.joinedload(itemsbought)) .all()) Hope that helps, Simon On 11 Sep 2014, at 20:54

Re: [sqlalchemy] selecting from a relationship

2014-09-04 Thread Simon King
Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy

Re: [sqlalchemy] selecting from a relationship

2014-09-04 Thread Simon King
of examples at: http://docs.sqlalchemy.org/en/latest/orm/loading.html Hope that helps, Simon On 4 Sep 2014, at 19:17, Ofir Herzas herz...@gmail.com wrote: Nevertheless, is there a way to achieve what I want? (which is to selectively load several columns and this 'jobs' property from Employee

Re: [sqlalchemy] How do I join a subquery using labels for columns that represent aggregate functions?

2014-08-29 Thread Simon King
.) What alternative querying strategy would you recommend in the absence of a solution to 1.)? I'm not certain, but you might be able to use: func.max(Run.start_time).label('max_start_time') and refer to it as: sub_query.c.max_start_time Hope that helps, Simon -- You received

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

2014-08-28 Thread Simon King
a bit more information, such as the exact error message and stack trace? Thanks, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

Re: [sqlalchemy] PyDev throwing errors in the SQLAlchemy Library

2014-08-18 Thread Simon King
Simon On Sat, Aug 16, 2014 at 2:41 PM, Zakaria Boulouard zboulou...@gmail.com wrote: Hello Michael and thanks for your help, If there is anyway to make it work in PyDev that would be great because I want to integrate a similar code into a bigger project and PyDev would be more suitable. I guess

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Simon King
not realize this was an option (actually, it is echo=True, but at least I can see the SQL being sent). Hopefully this will lead me to an answer. echo='debug' will show you more information than echo=True (it shows the rows coming back as well as the query that is sent) Simon -- You received

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Simon King
dbo and BASE TABLE, but not getting any results back. I don't know anything about MS-SQL so can't tell you why that is, but perhaps you've got enough information to carry on digging? Hope that helps, Simon On Mon, Aug 18, 2014 at 4:27 PM, Horcle g...@umn.edu wrote: Indeed! Here is the output

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Simon King
It looks like the code that runs the SELECT default_schema_name query has changed since the version you are running: https://bitbucket.org/zzzeek/sqlalchemy/commits/1fb4ad75a38c It might be worth upgrading to the latest release. Simon On Mon, Aug 18, 2014 at 5:22 PM, Horcle g...@umn.edu

Re: [sqlalchemy] Sqlalchmey session memory is never released when used with pyramid.

2014-08-15 Thread Simon King
helpful. (I've also got a memory leak in a pyramid/sqlalchemy application, and I started trying to track it down using this method. So far I haven't found the problem, and the application is not used very much, so it hasn't been high on my priority list.) Hope that helps, Simon -- You received

Re: [sqlalchemy] one to many relationship

2014-07-31 Thread Simon King
the string. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email

Re: [sqlalchemy] Problem going from 0.7.10 to 0.8.7

2014-07-30 Thread Simon King
, earliest_predecessor = klass.start_date, klass.start_date = last) ).order_by('start_date') Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

Re: [sqlalchemy] referencing a `label` in a group by clause ?

2014-07-30 Thread Simon King
: .order_by(sa.desc('counted')) http://docs.sqlalchemy.org/en/rel_0_9/core/sqlelement.html#sqlalchemy.sql.expression.desc) Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: [sqlalchemy] [SQLAlchemy.Flask][2.x] OperationError unable to open databaes

2014-07-24 Thread Simon King
:///forum.db ...would put the database in whatever the current working directory for your flask process is. Hope that helps, Simon On Thu, Jul 24, 2014 at 5:24 PM, Imk Hacked ihacked1...@gmail.com wrote: And I tried just now, I am trying this is here, app.config['SQLALCHEMY_DATABASE_URI

Re: [sqlalchemy] Re: Use relationship,can't do session.add (flask)

2014-07-21 Thread Simon King
On Mon, Jul 21, 2014 at 2:40 AM, 'Frank Liou' via sqlalchemy sqlalchemy@googlegroups.com wrote: there is no error msg or how can i trace the error msg? OK, sorry, I misunderstood. How do you know it isn't working? Simon -- You received this message because you are subscribed

Re: [sqlalchemy] Re: Use relationship,can't do session.add (flask)

2014-07-21 Thread Simon King
the flask application. Simon On Mon, Jul 21, 2014 at 10:57 AM, 'Frank Liou' via sqlalchemy sqlalchemy@googlegroups.com wrote: i use try if do not return Success it mean have not session.add @app.route('/company/business_account_number/address/company_status/company_captial_amount

Re: [sqlalchemy] Re: Mechanism of reconciling for merge method

2014-07-18 Thread Simon King
be sure. Simon On Fri, Jul 18, 2014 at 12:46 AM, Bao Niu niuba...@gmail.com wrote: For example, if I have User class which is mapped to user table. In user table there is a single row, whose id (primary key) equals 1, like this: id | name | gender | address 1 John male second best

Re: [sqlalchemy] Use relationship,can't do session.add (flask)

2014-07-18 Thread Simon King
, CreateDatetime=datetime.now(), ModifyDatetime=None, ModifyBy=None, CompanyName=company_name) self.session.add(new_company) self.session.flush() self.session.commit() What error are you getting? Please send the full stack trace. Thanks, Simon -- You received

Re: [sqlalchemy] Re: Mechanism of reconciling for merge method

2014-07-17 Thread Simon King
deliberately using these events yourself, then you probably won't care very much whether or not those events are emitted as part of session.merge() Hope that helps, Simon On Thu, Jul 17, 2014 at 10:21 AM, Bao Niu niuba...@gmail.com wrote: Probably what is abstruse here is the jargon emitting

<    1   2   3   4   5   6   7   8   9   10   >