I started implementing this and it seemed a bit pointless because it 
just moves logic from one method (reflecttable) to several 
(reflect_columns, refelct_primary_keys, etc) without much benefit.  The 
only immediate benefit I can see is that it may eliminate some 
redundancy.   For example, most of the dialects might use 
DefaultDialect.reflect_columns and so on.

So for now, I'll leave that idea alone and move on to refactoring the 
rest of the dialects.

--Randall

Randall Smith wrote:
> I've been working on breaking Dialect.reflecttable into components so 
> that they can be used independently (e.g. get_columns, get_foreign_keys, 
> etc).  One of the original goals was to be able to do away with 
> reflecttable and have the Inspector, engine.reflection.Inspector, 
> construct the table using the more granular methods.  This has proven to 
> be difficult because several dialects do something "special" when 
> creating the table.  Oracle deals with synonyms, MSSQL deals with 
> identity columns, etc.  So was thinking, this could be solved by adding 
> granular table construction methods.
> 
> class SomeDialect:
> 
>      def get_columns( ...
> 
>      def get_foreign_keys( ...
> 
>      def reflect_columns(self, table, columns ...
> 
>      def reflect_foreign_keys(self table, fkeys ...
> 
> So the inspector would build a table with its reflecttable method:
> 
> class Inspector:
> 
>      def get_columns(...
> 
>      def get_foreign_keys(...
> 
>      ...
> 
>      def reflecttable(self, table ...)
> 
>          self.engine.dialect.add_columns(table, connection,
>                                          self.info_cache ...
> 
>          self.engine.dialect.add_foreign_keys(table, connection ...
> 
> 
> For the various reflect_* methods, there would be a default 
> implementation on DefaultDialect.
> 
> What do you think?
> 
> --Randall


--~--~---------~--~----~------------~-------~--~----~
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