petl-developers/petl

char0 can repalce in the processing of to_csv?

wonb168 opened this issue · 1 comments

sqlserver column contain char(0), if direct to csv, will contain a special char and can't load into postgres db, and todb is also can't,
can replace char(0) in the function fromdb() or in tocsv()?
thanks!

HI @wonb168 ,

The behavior of petl is not handling the data retrieved from the DBApi cursor. It relies on the DBApi driver or the SQLAlchemy to do the job. Also, it doesn't specialize the handling towards any specific driver or database.

Maybe it's possible to investigate if:

  • there is an option for controlling the presence of char(0), the C string terminator, in the driver or SQLAlchemy.
  • the same behavior happens with PostgreSQL
  • the column datatype requires this in SQLServer or the program ingesting the data for this column is doing this.
  • or if you can write a transformation function in the petl code for removing this issue as a temporary solution.