Comments (3)
Michael Bayer (@zzzeek) wrote:
OK, well at first I was thinking, "you dont have to do that...." but yes, since a class is a global declaration, which points to its mapper, which points to tables, the same table would have to talk to different DBs per "request". I would say right off that building such an app, i.e. one that context-switches all over the place, is generally a huge pain in the ass and takes away from one of the original reasons people like Python, that its easy! Also I was surprised that Paste has this requirement, but it rings a bell, but I would guess that nothing is seriously going to make usage of it....its just too easy to start separate servers for different applications or use something like mod_python which has PythonInterpPerXXXX functionality....also would perform better.
But yes the need will exist regardless. But, I think this need is going to be an exception case, so that if an application is not using the proxy engine, it should not have to pay any price. Placing the burden on "context-switching" and "caching" of attributes within the Table implies that the ProxyEngine doesnt worry about it, and also that anything else which wants to hold onto ProxyEngine values has to worry about the same thing. Additionally, its code overhead on a per-attribute-access, no matter what engine is being used.
So why not have ProxyEngine do more of the work, and have it return proxying versions of TypeEngine, TableImpl, ColumnImpl, and whatever else as well ? That way ProxyEngine can define some high-performing and cache-aware scheme to quickly return thread-local/context-local attributes in only one place, instead of sprinkled about Table and whatever else in the sql.* package that might need it, and no external code has to worry about it. if ProxyEngine is not used, as I think will be more common, then the additional per-attribute overhead is gone. It also means if you do something like repr(table), or table.c.col1.type == table2.c.col2.type, it will work consistently since its the same object instances being returned.
from sqlalchemy.
Michael Bayer (@zzzeek) wrote:
new proxy engine merged in changeset:884. thanks jason !
from sqlalchemy.
Changes by Michael Bayer (@zzzeek):
- changed status to closed
from sqlalchemy.
Related Issues (20)
- Parameter substitution fails when statement has a postgres style cast HOT 5
- reflecting oracle synonym of synonym over dblink HOT 4
- Changing decimal separator to comma using locale.setlocale causes crash on MSSQL columns of decimal type HOT 3
- Generated syntax error when using funcs in server_default in MySQL
- NoForeignKeysError and AmbiguousForeignKeysError after upgrade to 2.x HOT 5
- selectin_polymorphic does not work for multiple level joined inheritance HOT 2
- ColumnCollection.get(col, default) types as Optional even with default HOT 2
- bulk_save_objects() w/ return defaults writes incorrect identity key HOT 4
- `sqlalchemy.utils.langhelpers.TypingOnly` too rigidly prevents special dunders from appearing HOT 5
- func.count argument typing issue HOT 1
- Bundle labels are wrong for new style select only (query works ?!) HOT 9
- Use of `raise NotImplementedError` instead of `NotImplemented` HOT 1
- Design a Repository pattern with sqlalchemy HOT 1
- Add `name` to `with_polymorphic ` HOT 2
- _JoinedListener can sneak into a metadata collection if Enum adapts itself, which can happen now, prohibiting serialization HOT 2
- TypeAlias cannot be found in type_annotation_map HOT 2
- Typing: of_type method not properly generic. HOT 1
- Add `insert_default` param to `Column` HOT 2
- many to many loaded relation instances partially missing reverse relation
- Add additional information to the `ReflectedColumn`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlalchemy.