Hello World!
This is my first foray into python and SQL Alchemy, and I'm spinning my
wheels. I'm running the code below and am able to connect to my DB and
query data without error.
import pyodbc
cnxn = pyodbc.connect('DSN=py_test; Trusted_Connection=Yes')
However, when I try
import sqla
we do this (for PG and SQL Server):
class utcnow(expression.FunctionElement):
key = 'utcnow'
type = DateTime()
@compiles(utcnow, 'postgresql')
def _pg_utcnow(element, compiler, **kw):
return "TIMEZONE('utc', CURRENT_TIMESTAMP)"
@compiles(utcnow, 'mssql')
def _ms_utcnow(element, compi
Was hunting around for how to do this, and couldn't find any examples, but
eventually figured it out.
Goal is to have all dates coming out of Postgres to be in UTC, regardless
of the DBA's timezone configuration.
Key piece of code is as follows:
import sqlalchemy
def set_utc_on_connect(dbapi_c
Am 04.06.2013, 04:57 Uhr, schrieb Rob Green :
Hello,
I'm having some trouble getting my SQL query to work in SQLAlchemy.
In this example, I want to find out the number of meeting rooms and
bathrooms available to a user. The user is part of a userGroup, which is
assigned to one building.
The bui
On 06/04/2013 11:22 PM, Warwick Prince wrote:
On 06/04/2013 10:46 PM, Michael Bayer wrote:
There's a long standing ticket to add support for comments, at least at the DDL
level. I don't think anyone has looked into what level of support we get from
the various backends as far as reflecti
Ok, so yield_per() is useless when subqueryload() is used.
Thank you,
Ladislav Lenart
On 5.6.2013 16:27, Michael Bayer wrote:
> the Query emitted by subqueryload does not use yield_per. so if your total
> result set is 1000 rows, and the total rows represented by all the
> collections is 100
On Jun 5, 2013, at 3:52 AM, Etienne Rouxel wrote:
>
> However, I get confused by SQLAlchemy trying to set taxon_id to NULL or even
> worse,
please keep in mind that this was within an autoflush, in between where the
state of your object graph in memory was complete. If the flush were to
su
the Query emitted by subqueryload does not use yield_per. so if your total
result set is 1000 rows, and the total rows represented by all the collections
is 1, the first time that query is emitted, 1 rows will be fully
loaded and processed into memory at once. This would occur typic
Hello.
One more note. I've just tried the below experiment with joinedload() instead of
subqueryload() and that does NOT work just as you expected. One contact is
returned several times and the first occurrences have incomplete phones.
However my experiments with subqueryload() suggest that it wo
It seems I found the most close solution:
http://stackoverflow.com/a/9119764/383405
I haven’t been aware that secondary can take select() query as well.
Might there be another way to achieve the same by any chance?
On Jun 5, 2013, at 9:27 PM, Hong Minhee wrote:
> Hi,
>
> I have two table
Hi,
I have two tables User and Following, and User has two relationships followings
and followers. It’s so typical, and next I want is readonly relationship to
union of followings and followers. I tried like:
friends = relationship(
'User',
collection_class=set,
pr
Hello.
I've tried an experiment to verify that yield_per() with subqueryload() behaves
as badly as you described, but according to my practical observation, it issues
ONE subqueryload() and everything behaves as I would expect. It emits two
SELECTs, one to fetch the objects and the second one to f
Hello.
I have one more question about my approach to WindowedRangeQuery:
> * Suppose a complex query q with join(...), filter(...) and options(...).
> * I need to create q2 from q such that:
> * It has no options.
>* Can I reset the options with q = q.options(None)?
> * It has select with t
Hello Michael
Sorry for the late reply.
So, below is my full stack trace:
Traceback (most recent call last):
File
"/Users/foobar/Developpement/nursery_project/applications/nurserydb/utils_scripts/test2.py",
line 64, in
plant.taxon = taxon_new # triggers an IntegrityError
File "build
14 matches
Mail list logo