urn self unchanged. So "eq_(tablenames[0].upper(),
tablenames[0].lower())" should succeed.
I guess the intention of the test is to check that the inspection routines
return a quoted_name with quote=True.
Hope that helps,
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Rel
return self._money
return None
Hope that helps,
Simon
--
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.
ook at the
original instance, rather than the one inside the loop, isn't it?
Again, thanks a lot for sharing,
Simon
--
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
On Mon, Apr 24, 2017 at 10:26 PM, Jonathan Vanasco
wrote:
>
> On Monday, April 24, 2017 at 4:28:22 PM UTC-4, Mike Bayer wrote:
>>
>> yeah just load the object again w/ the eagerloads option you want.
>
>
>
> Thanks. I was hoping there was a way to just say
) for name in col_names]
q = session.query(*cols).limit(100)
for row in q:
print row
Simon
On Wed, Apr 5, 2017 at 1:20 PM, Mayank Soni <mayank.so...@gmail.com> wrote:
> Thanks Simon for response.
> Actually column names I am getting from user interface based on user
> selection that i
t '['dise_code_01', 'district_name_02',
> 'block_name_03', 'cluster_name_04', 'village_name_05']
>
> Please help me out from this error.
>
add_columns expects each column to be supplied as a separate argument,
so you at least need:
q = session.query(AAA).add_columns(*col_list)
...to unpack
On Mon, Mar 13, 2017 at 1:50 PM, mike bayer <mike...@zzzcomputing.com> wrote:
>
>
> On 03/13/2017 08:34 AM, Simon King wrote:
>>
>> Hi,
>>
>> I'm not sure if the problem I've got is a bug or intended behaviour.
>> Here's a test script:
>>
>&g
vent from which it
> can get the state of the objects and their history before the rollback.
>
Could you collect the necessary data using the before_attach or
after_attach events, rather than before_flush?
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sql
kes sense if the same ID exists in both child tables.
Simon
--
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 for a fu
nts, but I haven't tried it. You could investigate the
mapper_configured event:
http://docs.sqlalchemy.org/en/latest/orm/events.html#sqlalchemy.orm.events.MapperEvents.mapper_configured
The code would look something like:
@event.listens_for(TreeNode, 'mapper_configured', propagate=True)
def receive_mapper_configure
Nice,I feel really stupid now but thank you very much, will verify this
later.
Best, Simon..
Am 16.12.2016 6:42 nachm. schrieb "Jonathan Vanasco" <jonat...@findmeon.com
>:
>
>
> On Friday, December 16, 2016 at 12:14:11 PM UTC-5, Simon Moon wrote:
>>
>>
>
class Machine(Base):
__tablename__='machine'
id = Column(Integer, primary_key=True)
name = Column(String(250), nullable=False)
comment= Column(String(250))
tags = Column(String(250), nullable=True)
class GeneralMeasurementData(Base):
..
session.add(gData)
session.commit()
gData has a foreign key on Machine.id.
It seems m is not a Machine object. I think it should be clear what I want
to do, but I can't figure what the
SQLAlchemy way would be to do it
Is there a way to do this???
Best
Simon
--
SQL
On Thu, Dec 15, 2016 at 10:00 AM, Simon King <si...@simonking.org.uk> wrote:
> On Thu, Dec 15, 2016 at 2:07 AM, Matt <m...@ramwise.com> wrote:
>>
>>
>> On Wednesday, December 14, 2016 at 3:58:19 PM UTC+1, Mike Bayer wrote:
>>>
>>>
>&
y/blob/master/flask_sqlalchemy/__init__.py#L747
It looks like you should be able to override the create_session method
(which actually returns a session *factory*) to return your custom
factory instead.
Hope that helps,
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Map
to use any of these packages if you don't want to.
You can create your own SQLAlchemy session at the beginning of each
request, and commit or roll it back at the end.
Simon
On Tue, Nov 29, 2016 at 3:04 AM, Srikanth Bemineni
<bemineni.srika...@gmail.com> wrote:
> Hi Mike,
>
> I am using pyramid_
call to mark_changed after creating your
tables.Search for "mark_changed" on this page:
https://pypi.python.org/pypi/zope.sqlalchemy
Hope that helps,
Simon
On Sun, Nov 27, 2016 at 2:24 PM, Srikanth Bemineni
<bemineni.srika...@gmail.com> wrote:
> Hi Mike,
>
> I even
-sensitive-default-functions
I haven't tested this at all, but perhaps you could use something like:
def getdefaultid(context):
return (select([func.max(APIResponse.version) + 1])
.where(APIResponse.id == context.current_parameters['id']))
Hope that helps,
Simon
On Fri, Nov 18, 2016
saction.
>
This section of the docs deals with transactions in SQLAlchemy Core:
http://docs.sqlalchemy.org/en/latest/core/connections.html#using-transactions
You can execute as many statements as you like between starting and
committing the transaction.
Hope that helps,
Simon
--
SQLAlch
won't have a "born" attribute.
Anyway, to answer your original question, would it be sufficient to
update the __name__ attribute of your instance_get function inside
json_property?
ie.
def json_property(json_column, name, type_=None):
def instance_get(self):
return getattr(sel
881 # Raises AttributeError
> since hybrid_property uses instance_get as the name
>
I think your code is basically fine, you've just got a mistake on the
last line. Presumably you meant to query Person, not Person.born?
assert session.query(Person).one().born == 1881
hybrid_property does't care about the name of the
itions:
teacher = relationship(
"Teacher",
foreign_keys=[teacher_id],
back_populates="related_student"
)
related_student = relationship(
"Student",
uselist=False,
foreign_keys=[id] # <-- this is incorrect
don't get it. And I want to add more models such
> as Tag, Project, Progress, Members.
This error is coming from postgres. SQLAlchemy has generated a query
that includes the column "todos.user_id", but postgres is reporting
that the column doesn't exist.
Are you sure that your table def
Whoops, yes, you're right. You should be able to simplify the
relationship definition to a simple "primaryjoin" clause, no need for
any of the "secondary" stuff.
Simon
On Thu, Nov 10, 2016 at 1:41 PM, Dorian Hoxha <dorian.ho...@gmail.com> wrote:
> Note that you'
print ' ', thing.current_user_like
if __name__ == '__main__':
import sys
args = sys.argv[1:]
echo = False
if '-d' in args:
echo = 'debug'
elif '-v' in args:
echo = True
test(echo)
####
Simon
On Thu, Nov 10, 2016 at 11:20 AM, Dorian Hoxha
_like" relationship, or how to populate it
during a query?
In general, if you want a relationship to be populated during a query,
you use one of the loader options such as joinedload or subqueryload:
http://docs.sqlalchemy.org/en/latest/orm/loading_relationships.html#using-loader-strategies-l
If you have an SQLAlchemy session, you would write this:
session.query(Model.array[1]).all()
Assuming your "Model.query" is a shorthand for "session.query(Model)",
you might be able to use:
Model.query.with_entities(Model.array[1]).all()
Simon
On Tue, Nov 8, 2016
rl-C the process, what does the backtrace look like?
Simon
--
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 for a full
Ah, that too looks very interesting, thanks for pointing it out. It
looks like it provides the sort of split that I was talking about.
I'll definitely investigate that one further.
Thanks,
Simon
On Mon, Oct 31, 2016 at 11:17 AM, Thierry Florac <tflo...@gmail.com> wrote:
> Hi,
>
&
On Sun, Oct 30, 2016 at 9:36 PM, Alfred Perlstein
<alfred.perlst...@gmail.com> wrote:
> Hello,
>
> I wanted to start this out with a big thanks to the community, especially
> Mike Bayer, Simon King, and Jonathan Vanasco.
>
> A few weeks ago I asked for help on debugging
> On 28 Oct 2016, at 21:47, Jonathan Vanasco <jvana...@gmail.com> wrote:
>
> oh great! `session.info["request"]` solved all my problems quite nicely. i
> integrated that my pipy sessions manager.
>
> Simon, thanks. Looking at your code, I recall that `dbsessi
ion, 'dbsession', reify=True)
I really ought to be using session.info rather than sticking a new
property directly on the session object...
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Co
be simpler. I don't think you'd need another
"status" column, as your "type" column will already contain either
"verified_user" or "invited_user". To change the class, you'd have to
UPDATE the type column and expunge any instances.
In my opinion, having a sin
ciations/generic_fk.html.
As the comment at the top of that file says, the database schema isn't
ideal because there is no database-level foreign key constraint on the
Address.attached_to column, so ensuring database consistency is more
difficult. If that isn't a concern in your application, you c
oup: http://powa.readthedocs.io/en/latest/support.html.
Try starting the python CLI and typing:
import sqlalchemy
print sqlalchemy.__file__
It should point to an __init__.py file in a directory that also
contains a dialects/postgresql/__init__.py file. If it doesn't, you'd
need to figure out why.
, 'before_cursor_execute', named=True)
def receive_before_cursor_execute(**kw):
if DEBUGGING:
print kw['statement']
Simon
On Wed, Oct 12, 2016 at 8:13 AM, Alfred Perlstein
<alfred.perlst...@gmail.com> wrote:
> Mike,
>
> I'm trying to find a nice way to say that this doesn
o any objects that had already been loaded become detached. Then
the exception handler mechanism takes over and renders the appropriate
exception view. If your exception view tries to access any not-yet-loaded
properties on those detached objects, you’ll get the above error.
Simon
--
You re
On Mon, Oct 3, 2016 at 11:43 AM, Jinghui Niu <niujing...@gmail.com> wrote:
> This really helps. Thank you Simon! I still have a couple of smaller
> questions.
>
>> When you access .fullname, the "self" parameter is now the
>> *class*, so self.firstname an
y, but you'll need to
accept that you can't simply use your currency_exchange_rate_lookup
dictionary as it is. Perhaps if you could give an example of a query
you'd like to write using this property, and the sort of SQL you'd
expect to see generated, we might be able to help with the
implem
the example in the docs you are referring to is this one:
@hybrid_property
def fullname(self):
return self.firstname + " " + self.lastname
In this example, "User.fullname" is precisely equivalent to:
User.firstname + " " + User.lastname
User.firstnam
op = hybrid_property(fget, fset=fset, expr=expr)
# Add the hybrid property to a class under the name "propertyname"
setattr(SomeClass, 'propertyname', prop)
Hope that helps,
Simon
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
h I haven't followed the rest of the thread and I don't know
why it was necessary to specify the metadata specifically in the first
place.
Simon
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop r
n querying, and you
potentially need to aggregate multiple columns, I would have thought
that what you really need is a plain python property, which does the
string->value conversion in the getter and the opposite in the setter.
Simon
--
You received this message because you are subscribed to the
from and saving to
the database.
Simon
On Fri, Sep 16, 2016 at 9:53 AM, Jinghui Niu <niujing...@gmail.com> wrote:
> If I store the as DateTime values and with a second column to indicate
> whether it's a date or datetime, it would look like this for a Date:
> col1: "2016-0
? Is there a reason why you can't store them as proper DateTime
values (perhaps with a second column to indicate whether or not the
time part is valid)?
Simon
On Fri, Sep 16, 2016 at 4:39 AM, Jinghui Niu <niujing...@gmail.com> wrote:
> I have the following code snippet, I marked my question in a com
():
"Convert SQLAlchemy warnings to exceptions"
import sqlalchemy.exc
warnings.simplefilter(
'error',
sqlalchemy.exc.SAWarning
)
Simon
On Thu, Sep 15, 2016 at 3:09 PM, Simon King <si...@simonking.org.uk> wrote:
> According to https://docs.python.org/2
According to https://docs.python.org/2/using/cmdline.html#cmdoption-W,
the full form of -W (and PYTHONWARNINGS) is:
action:message:category:module:line
Empty fields are ignored, and unused trailing fields can be left out,
so maybe "error::SAWarning" would work?
Simon
On Thu, Se
flush hook, check to see if the object has really changed (using
the code from create_version). If it has, save it away in a set somewhere.
2. In a before_commit hook, iterate over that set and create the actual history
entries.
Simon
--
You received this message because you are su
By default, the session is flushed before any query, so that the query
results are consistent with changes you may have made in-memory:
http://docs.sqlalchemy.org/en/latest/orm/session_basics.html#flushing
Hope that helps,
Simon
On Fri, Sep 2, 2016 at 5:12 PM, HP3 <henddher.pedr...@gmail.
thon2.7/site-packages/sqlalchemy/util/_collections.py",
> line 212, in __getattr__
>
> raise AttributeError(key)
>
> AttributeError: hosts
>
>
> On Fri, Aug 26, 2016 at 1:33 AM, Simon King <si...@simonking.org.uk> wrote:
>>
>> On Fri, Aug 26, 201
“a.attribute” has to be evaluated and
substituted into the string before the print statement can run.
If you use the print *function* rather than the print *statement*, all the
arguments will be evaluated before anything is displayed, so this also wouldn’t
happen.
Hope that helps,
Simon
--
def mac_address(self, value):
self._mac_address = encode_mac_address(value)
If you want to be able to query using the decoded values, you could
also try hybrid properties.
Hope that helps,
Simon
--
You received this message because you are subscribed to the Google Groups
"sqlalche
val).filter(Interval.length_property > 5)
But the method would have to be used like this:
session.query(Interval).filter(Interval.length_method() > 5)
It's up to you which you prefer.
Hope that helps,
Simon
--
You received this message because you are subscribed to the Google Group
t__()
> method is not automatically synthesized.
>
You'd probably be best off copying the SQLAlchemy code into your own
project - it's not long:
https://bitbucket.org/zzzeek/sqlalchemy/src/5145f671a4b5eb072e996bc450d2946d4be2a343/lib/sqlalchemy/ext/declarative/base.py?at=master=file-view
understand the question here - it's not clear to me why
get_or_create for the container objects is any different than
get_or_create for any other object, or what that has to do with
flushed-but-not-committed records. Why do you need to treat objects
that have been flushed but not committed any differen
/sqlalchemy/src/3873d7db340835a38e6b191e8466fb42c3a9d3f6/lib/sqlalchemy/engine/base.py?at=master=file-view-default#base.py-1235
Hope that helps,
Simon
On Tue, Aug 2, 2016 at 4:11 AM, Nikhil S Menon <nikhilsme...@gmail.com> wrote:
> If the datatype of in database is Varchar its working fi
class
colname = 'some_column'
column = getattr(Table, colname)
session.query(Table).filter(column == value)
# If Table is an instance of sqlalchemy.Table
colname = 'some_column'
column = Table.c[colname]
session.query(Table).filter(column == value)
Hope that helps,
Simon
--
You received th
Even when using the ORM you ought to be using session.commit() to
commit transactions. If you've been using the ORM against MyISAM
tables you can probably get away without it since MyISAM tables don't
support transactions.
Simon
On Mon, Jul 25, 2016 at 1:31 PM, Rogier Eggers <rogier
...and the reason that it works on the older tables is probably that
they use the MyISAM engine rather than InnoDB.
On Mon, Jul 25, 2016 at 12:05 PM, Mehdi gmira wrote:
> Maybe you forgot to commit ?
>
>
> Le lundi 25 juillet 2016 12:08:17 UTC+2, Rogier Eggers a écrit :
>>
>>
setLevel(logging.DEBUG)
>
> There is no code which change behavior (by filter) of SAWarning to 'error'
> ...
The python warnings system is completely separate from the logging
system. Whether or not a particular warning is turned into an
exception is driven by the "warnings filter"
On Thu, Jul 21, 2016 at 5:58 PM, Jonathan Vanasco <jvana...@gmail.com> wrote:
>
>
> On Thursday, July 21, 2016 at 12:15:40 PM UTC-4, Simon King wrote:
>>
>> There are some hints for keeping references to objects at:
>>
>>
>> http://docs.sqlalchemy.or
There are some hints for keeping references to objects at:
http://docs.sqlalchemy.org/en/latest/orm/session_state_management.html#session-referencing-behavior
Simon
On Thu, Jul 21, 2016 at 5:11 PM, Mehdi gmira <mgm...@wiremind.fr> wrote:
> Yeah I thought of that. I find it awkward be
he question - objects loaded by session.query are
*already* in the identity map for that session.
If you have an object that wasn't loaded from the session originally,
I think the official answer is session.merge(), although that returns
a new object. Would that work in your instance?
Simon
--
You
hat's a different
> discussion.
FWIW, I find alembic's autogeneration feature very handy here. I edit
the Python class definitions then alembic inspects the database and
generates an appropriate migration script:
http://alembic.zzzcomputing.com/en/latest/autogenerate.html
Hope that helps,
Simon
--
You r
/en/latest/_modules/examples/sharding/attribute_shard.html
In the example, the query_chooser function is inspecting the query to
see which backend database the query should be issued against, which I
guess is what your "_analyze_base_query" method does.
Would this work for you?
Simo
Could you describe what you are trying to achieve? There's nothing
about Mike's suggestion that means you need to create a new session -
you can reuse any existing session.
What does your CustomQueryCls do? Perhaps there's another way of doing
what you want?
Simon
On Tue, Jul 12, 2016 at 11:09
On Wed, May 11, 2016 at 10:37 AM, Piotr Dobrogost
<p...@2016.groups.google.dobrogost.net> wrote:
>> On Wednesday, May 11, 2016 at 11:03:57 AM UTC+2, Simon King wrote:
>>> On Wed, May 11, 2016 at 9:39 AM, Piotr Dobrogost
>>>
>>> What's the reaso
column which
> begins with underscore (_acl) but the mock one does not. Oracle treats
> unquoted version as invalid giving the following error:
> ORA-00911: invalid character
>
>
> What's the reason for these differences?
>
At least for the quoting issue, it sounds like you a
le to filter all log messages generated by
> SA by type of SQL (DDL in this case)?
>
Could you use Alembic's offline mode?
http://alembic.readthedocs.io/en/latest/offline.html
Simon
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsu
run_migrations(**kw)
> File "/var/www/
> www.example.org/venv3.4.2/lib/python3.4/site-packages/alembic/runtime/migration.py",
> line 312, in run_migrations
> step.migration_fn(**kw)
> File "/var/www/
> www.example.org/src/crowdwave/alembic/versions/dd9e391f807
emy where, if you define a column as a
foreign key, and you don’t give it an explicit type, it will use the same type
as the referenced column.
As for alternative approaches, perhaps some of the “Generic Associations”
examples might give you some ideas:
http://docs.sqlalchemy.org/en/latest/orm/ex
://docs.sqlalchemy.org/en/rel_1_0/orm/session_events.html#session-persistence-mapper
Simon
On Wed, Mar 23, 2016 at 8:52 PM, sector119 <sector...@gmail.com> wrote:
> Going back to the subject ))
>
> I get error (and no data updated) while using no_autoflush
>
> /Users/sector119/PythonV
It sounds like the transaction for task B is starting before A's
transaction has been committed, but you haven't really given enough
information to debug further. How are you managing your sessions and
transactions? Do B and A actually overlap (ie. does B start before A
finishes)?
Simon
On Tue
For what it's worth, SQLAlchemy usually does add the join condition for
you, based on your relationship definitions. But the second parameter to
query.join() is an optional expression that *replaces* the join condition
that would normally be generated.
Simon
On Mon, Mar 21, 2016 at 5:42 PM
ot;,
> "Person"."LastName"
>
> But result doesn't looks like that it is secondary sorted by first
> persons lastname. See as an example one "Periodical._name" (Bmc
> Geriatrics) and the first persons lastname of 8 References.
>
> Bmc Geria
tables.
Simon
On Mon, Mar 21, 2016 at 3:12 PM, Alex Hall <ah...@autodist.com> wrote:
> Wow, thanks guys, especially for the sample code! I'm trying to use
> the example (and fully understand it at the same time) but am running
> into an error. This is the same error that made me look fo
s index
> field? As you can see in my first post this column doesn't have a
> "name" (in pythonic meaning). It is just a Column("Index", ...).
>
ReferenceAuthor is an instance of sqlalchemy.Table, so you can refer to its
columns as ReferenceAuthor.c.Index.
Simon
--
You receive
On Fri, Mar 18, 2016 at 5:12 AM, Krishnakant <krm...@openmailbox.org> wrote:
>
>
> On Thursday 17 March 2016 03:46 PM, Simon King wrote:
>
> On Thu, Mar 17, 2016 at 7:19 AM, Krishnakant <krm...@openmailbox.org>
> wrote:
>
>> Hello,
>> I wish to search
@> '{"accountcode": 1}'::jsonb
Another would be the ->> operator:
select *
from yourtable
where dramt ->> 'accountcode' = '1'
or cramt ->> 'accountcode' = '1'
In SQLAlchemy, I think these would be expressed as:
YourTable.dramt.contains({'accountcode': '1
('vendor'),
(saorm
.joinedload('assignments')
.joinedload('attachment')
.joinedload('text')),
)
item = q.first()
print item
print item.vendor
for assignment in item.assignments:
print assignment.attachment.att_data
On Wed, Mar 16, 2016 at 3:23 PM, Piotr Dobrogost <
p...@2016.groups.google.dobrogost.net> wrote:
> On Wednesday, March 16, 2016 at 3:51:16 PM UTC+1, Simon King wrote:
>>
>> On Wed, Mar 16, 2016 at 1:43 PM, Piotr Dobrogost <
>> p...@2016.groups.google.dobrogost.net&g
/rel_1_0/core/tutorial.html#executing-multiple-statements
you should be able to write something like this:
con.execute(voucher.insert(), vid=1, vdate=somedate, Cr=somedict)
Simon
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To
l()”, you’ve already loaded all the rows from the database
into Python. “n” is just a Python list at this point.
To load an object given its primary key you can use:
v = session.query(xx).get(5)
This checks the session first to see if the object has already been loaded. If
it hasn’t, it will query th
On Thu, Mar 3, 2016 at 12:01 PM, Krishnakant <krm...@openmailbox.org> wrote:
>
>
> On Thursday 25 February 2016 03:50 PM, Simon King wrote:
>
> On Thu, Feb 25, 2016 at 9:43 AM, Krishnakant <krm...@openmailbox.org>
> wrote:
>
>> Hello,
>> I have a que
"Person.preferred_activities" relationship is one-to-many, and so the
default behaviour when deleting the Person will be to set the foreign keys
pointing to it to NULL. In this case that means setting
PersonActivity.idperson to NULL, but this is impossible since that column
is part o
Out of interest, how are you building your query, and why do you need to be
able to change the values afterwards?
Simon
> On 2 Mar 2016, at 21:59, Brian Cherinka <havok2...@gmail.com> wrote:
>
> Thanks, Mike. This is excellent. That did the trick. That's much easier
I don't understand that error - you're asking it to join along predefined
relationships, so it shouldn't need to search for foreign keys at query
time. "Category.products" is a relationship set up as the backref of
Product.categories.
Here's a working example. I had to add the definition of the
http://docs.sqlalchemy.org/en/rel_1_0/orm/tutorial.html#querying-with-joins
You want something like:
DBSession.query(Category).join(‘products’,
‘brand’).filter(Brand.slug==brand_slug)
Hope that helps,
Simon
> On 1 Mar 2016, at 20:11, sector119 <sector...@gmail.com> wrote:
>
m/dd')
(I may have the syntax wrong - I don't use Oracle)
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.co
or
Notice that neither of the columns selected are labelled "servings", so
when you try to access "s.c.servings" later, you get an AttributeError.
Try moving the ".label('servings')" so that it applies to the result of
coalesce(), not avg().
Simon
--
You
your underlying problem, which is that you
are assigning an unexpected object to your "label" property. I guess
FieldStorage comes from your web framework, and you need to extract the
actual value from that before assigning it to your mapped object.
Simon
On Thu, Feb 25, 2016 at 1:24 PM,
On Thu, Feb 25, 2016 at 12:01 PM, Piotr Dobrogost <
p...@2016.groups.google.dobrogost.net> wrote:
> On Thursday, February 25, 2016 at 11:10:36 AM UTC+1, Simon King wrote
>>
>>
>> I can't think of a way you could do this with objects you've already
>> loaded i
ForeignKey('t.groupcode')),
)
subgroup = t.alias('subgroup')
j = t.join(subgroup, subgroup.c.subgroupof == t.c.groupcode)
print sa.select([t.c.groupcode, subgroup.c.groupcode]).select_from(j)
Output:
SELECT t.groupcode, subgroup.groupcode
FROM t JOIN t AS subgroup ON subgroup.subgroupof = t.group
sion.query(Text).all()
>> texts???values???.update(...)
>>
>
> Any hints?
>
>
I can't think of a way you could do this with objects you've already loaded
into memory. Perhaps you could use Query.update to issue the appropriate
SQL directly to the database?
http://docs.sqlal
r the creation of all "pending" backref attributes, I
think you can call sqlalchemy.orm.configure_mappers:
http://docs.sqlalchemy.org/en/rel_1_0/orm/mapping_api.html#sqlalchemy.orm.configure_mappers
Normally this gets called automatically when you start querying the
database, but in certain i
appen
even without the attribute listener when you called session.flush() or
session.commit(). The attribute listener is just causing the flush to
happen earlier presumably because "target.product" has not yet been loaded
from the database.
Simon
--
You received this message because you are s
that helps,
Simon
On Mon, Feb 22, 2016 at 4:08 PM, Nana Okyere <oky...@gmail.com> wrote:
> Update: I'm on the current version of sqlalchemy and using oracle 12c.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy&quo
. Maybe
you could hack around the problem by setting a "dbms_ver" attribute on the
pyodbc connection that you are creating in your custom creator function.
This is where it gets used:
https://github.com/ibmdb/python-ibmdbsa/blob/master/ibm_db_sa/ibm_db_sa/base.py#L481
Simon
On Fri, Feb 19, 20
> If I don't get that, it's because I used a name that complains about
> there being no attribute dbms_ver or server.version, depending on the
> string.
>
> They don't make it easy, do they?
>
> On 2/19/16, Simon King <si...@simonking.org.uk> wrote:
> > URI prefixes
URI prefixes are defined in the setup.py for the ibm_db_sa package:
https://github.com/ibmdb/python-ibmdbsa/blob/master/ibm_db_sa/setup.py
I would guess that you want to end up with the DB2Dialect_pyodbc class,
which means you should use db2.pyodbc:// or ibm_db_sa.pyodbc://
Simon
On Fri, Feb
301 - 400 of 921 matches
Mail list logo