py-mysql2pgsql icon indicating copy to clipboard operation
py-mysql2pgsql copied to clipboard

ValueError: invalid literal for int() with base 10: "b'0'"

Open jmilagroso opened this issue 7 years ago • 4 comments
trafficstars

Using BIT on mysql/mariadb

jmilagroso avatar Jan 17 '18 02:01 jmilagroso

Two suggestions, without seeing the DB that you're using it on.

~~When I've had this in the past it's been because the column setting on the originating database was a CharField (Char/Varchar) rather than an int. Can you supply the schema for the original table, and the full traceback?~~ Ignore this, I didn't read the incredibly short issue properly. :D

Second thought - Are you using Python 2 or 3? You might run into problems if you've used Six to convert code and then using this module - if you're on python three then you might need to do a PR to add handling for that. Afaict and in the docs, it's only tested on 2.6 and 2.7. The bytestream flag should be ignored in Python2 and six won't convert it, which might lead to problems here.

In order to ease the 2.x-to-3.x transition, the b'...' literal syntax was backported to Python 2.6, in order to allow distinguishing binary strings (which should be bytes in 3.x) from text strings (which should be str in 3.x). The b prefix does nothing in 2.x, but tells the 2to3 script not to convert it to a Unicode string in 3.x.

It does look as though it's not picking up the bit field correctly when reading the data types, though.

iamwithnail avatar Jan 17 '18 10:01 iamwithnail

Hi @iamwithnail.

I am using 2.7 version.

I ended up using the nodejs version of this. (1 problem though, it doesn't seem to import the partitions on tables)

Thanks!

jmilagroso avatar Jan 18 '18 03:01 jmilagroso

Any hint to solve this issue, please? Thanks.

tmysik avatar Oct 23 '18 19:10 tmysik

Sorry, I can't try your recomendation because I found other way

Вторник, 23 октября 2018, 22:18 +03:00 от Tomáš Myšík [email protected]:

Any hint to solve this issue, please? Thanks. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or mute the thread .

I wish you be loved

ssu1980 avatar Oct 27 '18 18:10 ssu1980