Re: ctree data
On May 13, 7:05 am, Carl K <[EMAIL PROTECTED]> 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: ctree data
"Carl K" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |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, | 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/PythonScript/PythonTranslate.h?view=markup | http://oltp-platform.cvs.sourceforge.net/oltp-platform/OLTPP/scripts/TestZipCodes.py?view=markup | | 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. [snip] I personally would start with either 1 or 3, but probably 3 since the skill of using ctypes is transferable to other problems and I want to learn it anyway. Ctypes is a foreign function interface (FFI) module. It is new in the Python stdlib with 2.5 but has been around as a 3rd party module much longer. With a specification of the C API in hand, you should be able to write Python functions that call functions in the shared library. Ctypes handles the interconversion of Python and C datatypes and the calling details. I would start with the simplest thing that you can verify working: open database, get some info that you can print, so you know you really opened it, and close database. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
ctree data
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/PythonScript/PythonTranslate.h?view=markup http://oltp-platform.cvs.sourceforge.net/oltp-platform/OLTPP/scripts/TestZipCodes.py?view=markup 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 using http://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. TIA Carl K -- http://mail.python.org/mailman/listinfo/python-list