On Jan 27, 2012, at 6:28 PM, Anthony Scopatz wrote:

> Hi Davide, 
> 
> From the createTable() doc string you'll see that you are not confined to the 
> IsDescription class for creating table descriptions.  In fact, you can use 
> dictionaries of Col instances or numpy dtypes as descriptions.   I have found 
> that both of these are much easier and better to use in the long run than the 
> declarative IDescription class.  For example, 
> 

Great! Thanks!

d

> desc = {'a': Float64Col(pos=1), 'b': Int32Col(pos=2)}
> 
> Be Well
> Anthony
> 
> On Fri, Jan 27, 2012 at 3:25 AM, Davide Cittaro <daweonl...@gmail.com> wrote:
> Hi all, I'm trying to store some data into pytables. Most of these are 
> strings, their length varies in two values.
> I can of course create a class with StringCol elements sized at the maximum 
> value, to accommodate both. I was thinking, instead, to create two separate 
> tables and insert values in this or that, depending on the string length.
> In case of two values it's easy to implement two classes, unfortunately in 
> real data these two values vary too (i.e. in my data can be 27 and 39, in 
> other 16 and 24...), so I would like to have a template class, which I can 
> instantiate with proper values depending on what I found.
> Problem is that I don't think I can safely override __init__() method for 
> tables.IsDescription...
> In the end, two classes like
> 
> class MyEntry_long(tables.IsDescription):
>  stream = tables.StringCol(39)
> 
> class MyEntry_short(tables.IsDescription):
>  stream = tables.StringCol(26)
> 
> class MyEntry(tables.IsDescription):
>  def __init__(self, par = 39):
>    stream = tables.StringCol(par)
> 
> In other words, can I instantiate my entries passing parameters? maybe this 
> is already possible in a more clean way :-)
> 
> Thanks
> 
> d
> 
> 
> 
> 
> ---
> Davide Cittaro
> daweonl...@gmail.com
> http://sites.google.com/site/davidecittaro/
> 
> 
> -----BEGIN PGP SIGNATURE-----
> 
> iQEcBAEBAgAGBQJPIm17AAoJEJBeDal0zRx/6C4IAJ6ZJYV5xoqGiC2BZ9A808zV
> h09DTQj3vnWUFVqnXlfe5tST3jG58yZ3Zj7BCQq0JBbvZb+In02s+yyrPle/ug+/
> KNPQVc/3HtZcpPEewUSiJj8wmKX9wPJoNjythl/HtlT5B1+J4mxjJfqNQdlKd7sl
> eqDCwYv9yUeWDicHmwwjwg+hRDsxmu1FSIfCIUS4gFwMZM/2PLFXzzdJmsbjSMZt
> t/COIyq08J21IoYympqWrEk7GWrjwJtyC5Q0UOdikNyhPcSeQyeaOjIEqB2UCNho
> 2lnsPA/JQ8nTMeRiDL6sfHtG0Y3PLCsTjWGfRi+dhmG7Yx4yZ5zL5HOjVLmmZQo=
> =JdYz
> -----END PGP SIGNATURE-----
> 
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users
> 
> 
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2_______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users

---
Davide Cittaro
daweonl...@gmail.com
http://sites.google.com/site/davidecittaro/

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to