Hi Mike,

A Monday 05 October 2009 21:02:21 Tallhamer, Mike escrigué:
> I am new to pytables and would like to subclass a column type like
> StringCol and tableExtension.Row so that I can have control over what
> tableExtension.Row.__getitem__() returns when it encounters my new
> column type. I have tried to work my way through the code but find
> myself trying to figure out how each of these column types are created
> rather than finding a concrete class to inherit from. I also can't seem
> to find a simple .py file in my distro (installed through python(x,y))
> where tableExtension.Row is implemented (just a .pyd) so that I can see
> how the original  tableExtension.Row.__getitem__() method is
> implemented. I would like to introduce some type checking for my custom
> column type. I have searched the archives with no luck.
>
> What I'm trying to accomplish is to implement a table with custom column
> types that inherit from StringCol() that "point" to anyone of the
> following CArray, EArray and VLArray via an internal path to the actual
> array object in the file. Right now I have to store the path as a string
> then search the table to retrieve the path which I then use to go and
> get the data array. I would simply like to add some type checking in the
> tableExtension.Row.__getitem__() method that checks for a CArrayCol,
> EArrayCol and VLArrayCol type (all just subclasses of StringCol holding
> my text path) and then returns the actual array instead of the path.
> Anyone who could point me in the right direction on where I could either
> get the information I need to start down this road or a quick a dirty
> implementation to start from would be greatly appricieated.

The definitions of the basic column types are in ``tables/atom.py``.  So, you 
should add the new atoms there, and then the corresponding column types will 
be created for you.  Please read carefully the docstrings in both 
`tables/atom.py` and `tables/description.py` for a detailed description of the 
underlying machinery for type description.

Also, for the necessary `Row` modifications, you will need to access the Pyrex 
sources in ``tables/tableExtension.pyx`` available in the tarball (and not in 
binary packages, like that of python(x,y)).

BTW, I like your idea, so if you end with something that is useful, please 
share it with us :)

Cheers,

-- 
Francesc Alted

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to