ctree data

John Machin sjmachin at lexicon.net
Sat May 12 20:45:13 EDT 2007


On May 13, 7:05 am, Carl K <c... at personnelware.com> wrote:
> A friend needs to convert c-tree plus data to MySql.  I can to the "to MySql
> part, but need some help with the "from c-tree."  If I just wanted to get this
> done, I would hunt down the ODBC driver and use some MSy thing.  But I am trying
> to hone my Python skills, but right now I am in over my head, thus this post.  I
> think with a little boost I will be able to make it all come together.  (well,
> little boost may be an understatement - I have no clue how close/far I am from
> what I need.)
>
> My searching around has come up with a few ways to use Python to read the data:
>
> 1. pull what I need from some other py code that uses c-tree:
>
> http://oltp-platform.cvs.sourceforge.net/oltp-platform/OLTPP/services...http://oltp-platform.cvs.sourceforge.net/oltp-platform/OLTPP/scripts/...
>
>      12     a,b,c = ZipCode.Get()
>      13     print "Zip code is ", a
>      14     print "State is ", b
>      15     print "City is ", c
>
> I am sure this is what I want.  I just haven't figured out where to start.
>
> 2. "Pyrex"  to create Python bindings to C API with minimal C knowledge.  I took
> C and did a few little utilities on my own in the 90's.  plus I can make a
> tarball.  today I am not sure I even qualify for "minimal."
>
> 3. the C API is present as a shared object (.so), use it from Python with
> ctypes.   I have no idea what that means.
>
> 4. odbc - I am actually not thrilled about using the ctree odbc driver in any
> environment, because someone else who tried to use it on some other data a few
> years ago said it was flaky, and support was next to useless.
>
> 5, get someone who knows perl to do it usinghttp://cpan.uwinnipeg.ca/htdocs/Db-Ctree/Db/Ctree.html- This just shows what
> lengths I am willing to go to.  but I really don't want to start learning perl.
>

Possible option 6: Find out if there is (a) a ctree utility program
that dumps a ctree table to a flat file in documented easily-parsed
format plus (b) a method of getting the metadata for each column
(type, decimal places, etc) if that info is not already available from
(a).

It's entirely possible that SQL "select * from the_table" will do (a)
for you, if the output is given with full precision, and there's a
method of getting the columns delimited properly.

HTH,
John




More information about the Python-list mailing list