python


How do I use SQLalchemy to treat an existing select object as a view?


I have a select object s1 and I would like to treat it as a view, so that I can join other tables onto it. I have tried something like this:
s1 = select([t1], ...)
s2 = s1.join(t2, t1.c.id==t2.c.id)
but I get an error:
sqlalchemy.exc.StatementError: Not an executable clause
I have tried this:
s1 = select([t1], ...)
s2 = select([t1, t2], from_obj=s1.alias().join(t2, t1.c.id==t2.c.id))
but I get this error:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) invalid reference to FROM-clause entry for table "t1"
The reason I need to do this is because s1 is returned from a function that applies a complex where clause and I'd rather not rebuild that where clause when constructing s2.

Related Links

substitute unicode strings using re
Python : Fire off AJAX with feedparser
Python Pandas - Odds Ratio with Scipy (P Value = 0?)
Vim Pymode not working with matplotlib
Downloading Excel files with Django and Angular2
Get length of Azure queue from Python via REST API
window shrinks when label is packed, even though textbox is bigger
How to use random.sample() that it always generate number
CX_Oracle for python, under Anaconda is not installing
Pynput keylogger will record characters in explorer and on desktop but will return backspace in chrome
pygame is not responding after playing an audio file
In Python 2.7, how can I return calculations without defining variables in the constructor?
Python: create a new dictionary getting values from a dictionary of nested list
Values from subroutine not being returned/refreshed python
Proper way to relative import in Python 2.7
How to elegantly create matrix with row and column indices as first row / column?

Categories

HOME
sas
jsviews
cpu-architecture
ruby-on-rails-3
codeeffects
jscript
rocketmq
webdav
ios10
simpy
avl-tree
codeblocks
shader
ng-admin
goutte
google-shopping
event-log
sendkeys
ssms-2016
bootstrap-popover
mule-studio
redux-observable
tree-traversal
device-detection
aws-cognito
sql-update
uiautomator
novnc
onesignal
emv
cep
chrome-native-messaging
reply
getjson
strophe
threshold
hashcat
agent
android-preferences
bayesian-networks
ssh.net
mediawiki-extensions
xbim
google-account
g1gc
scalafx
filepath
estimation
gauss
ruby-on-rails-2
rxvt
iron.io
createobject
svn-merge
sql-server-administration
inject
gradle-script-kotlin
xib
cron-task
soda
django-south
geodjango
optionbutton
enyo
python-winshell
programming-paradigms
viper-architecture
uptodate
belongs-to
proximity
firebug-lite
dalekjs
csplit
valence
sqljdbc
gamepad
windows-mobile-6
.net-cf-3.5
fraud-prevention
domain-calculus
marmalade-edk
android-4.0
moq-3
redirectstandardoutput
getstring
flexicious
nintendo
path-manipulation
shared-objects
django-nose
ruby-debug
pureftpd
loadui
drawtext
osx-leopard
surefire
gwt-2.2-celltable
linfu
multibyte-functions
web-statistics
winsnmp
web-analytics-tools

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App