On Sep 25, 2008, at 2:51 PM, Michael Bayer wrote:

>
>
> On Sep 25, 2008, at 2:37 PM, MHC wrote:
>
>>
>> Perhaps someone can comment on this question about Oracle BFILE's.
>> (Oracle BFILE's are like BLOB's but the data is kept outside the
>> database tables, in regular files on disk.  Each BFILE has a  
>> directory
>> and filename entry in the table that points to the file on disk).
>>
>> SQLAlchemy handles BFILE's in the same way as BLOB's, and they work
>> nicely, with one exception.  BFILE's have several methods that can be
>> called on the LOB handle, and there doesn't appear to be a way in
>> SQLAlchemy that one can call these methods.  In particular it would  
>> be
>> very useful to be able to call getfilename() and fileexists().  These
>> are implemented in cx_Oracle, so the underlying facility is  
>> available.
>> SQLAlchemy always gets the data with read() and returns  the  data.
>>
>> In the particular application I'm working on the user can upload
>> various files to a database and these are stored as BFILE's.  The  
>> user
>> can also browse through the database in various ways, and what he
>> wants to see at first is the name of the file he uploaded (that is,
>> from lob.getfilename()), rather than the contents of the file.
>>
>> Is there a way to call getfilename() on a BFILE column currently, or
>> could that be implemented?

sigh...I just checked the source, and i didn't quite finish the  
story.  The OracleBinary type is whats actually calling LOB.read()  
here.  auto_convert_lobs is the part which is invoking OracleBinary  
for all result sets, whether OracleBinary was specified or not.  But  
if you are in fact reading from a column that you've stated has a  
Binary type (either directly or via table reflection), its still going  
to LOB.read().   So you'd additionally have to forego the usage of the  
Binary type and use an agnostic type such as NullType to get the "raw"  
cx_oracle LOB object in those cases.

putting on my thinking cap to see if theres a way to smooth this out,  
given that the unicode question from earlier in the day has some  
overlap here.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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