On Dec 17, 2009, at 1:13 PM, Shuaib Osman wrote:

> Hi Guys,
> 
> I'm busy with Sybase ASE and things are somewhat unpleasant. I've had
> to modify the default Sybase.py driver as it was not targeted
> specifically for ASE. I've got a barely working version (the reflect
> code returns all tables and columns but not foreign keys or other
> constaints). The big problem with Sybase ASE is the really bad join
> clause implementation.

its true, the dialect was never written for ASE.   It also hasn't been used by 
anyone I'm aware of since the original author submitted it against version 0.3 
of SQLA.  I'm surprised its usable at all at this point.

If you'd like to help us with a real Sybase dialect, it would be targeted 
towards 0.6, which is the current SQLAlchemy trunk.   It needs a significant 
amount of work.

As for the "*=" syntax, which I'm going to have to disagree with you is 
"nicer", you'll have to duplicate the approach in the Oracle driver.   Is it 
true that no versions of Sybase support LEFT OUTER JOIN ?



> 
> If I manually query something like :
> 
> SELECT yield_curve_1.yield_curve_name, yield_curve_2.reference_day,
> yield_curve_2.yield_curve_name
> FROM yield_curve AS yield_curve_2 LEFT OUTER JOIN yield_curve AS
> yield_curve_1 ON yield_curve_2.underlying_yield_curve_seqnbr =
> yield_curve_1.seqnbr, yield_curve AS yield_curve_3 LEFT OUTER JOIN
> yield_curve AS yield_curve_2 ON
> yield_curve_3.underlying_yield_curve_seqnbr = yield_curve_2.seqnbr
> WHERE yield_curve_3.reference_day >= '2009-12-15' OR
> yield_curve_3.yield_curve_name IN ('CURVE1', 'CURVE2')
> 
> I get the following error message:
> <eb1>Tables 'yield_curve' and 'yield_curve' have same exposed names.
> Use correlation names to distinguish them.
> 
> which, of course, is bs as I am using aliases.
> 
> However if I rewrite the above query as:
> 
> SELECT yield_curve_1.yield_curve_name,
>       yield_curve_2.reference_day,
>       yield_curve_2.yield_curve_name
> FROM yield_curve AS yield_curve_2, yield_curve AS yield_curve_1,
> yield_curve AS yield_curve_3
> WHERE yield_curve_3.underlying_yield_curve_seqnbr *=
> yield_curve_2.seqnbr
> AND yield_curve_2.underlying_yield_curve_seqnbr *=
> yield_curve_1.seqnbr
> AND yield_curve_3.reference_day >= '2009-12-15' OR
> yield_curve_3.yield_curve_name IN ('CURVE1', 'CURVE2')
> 
> It works perfectly - it's the exact same thing as the ANSI - compliant
> query but Sybase is quite happy to accept this syntax ( truth be told,
> it's actually a lot nicer )
> 
> So, apart from getting Sybase to fix this, how do I go about creating
> a join dialect for Sybase? I see Oracle's implementation and it seems
> fairly involved. Is there a simple way to add T-SQL join syntax to the
> Sybase driver ?
> 
> Thanks.
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 
> 

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to