Skip to content

Commit fb6b97f

Browse files
will.kwill.k
will.k
authored and
will.k
committed
Fix serialization issues where column type is temporal or JSON
1 parent 4d27faf commit fb6b97f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

examples/mysql_to_rabbitmq.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ def main():
5555

5656
properties = pika.BasicProperties(content_type='application/json',
5757
delivery_mode=DeliveryMode.Transient)
58-
59-
channel.basic_publish(exchange='direct', routing_key=routing_key,
60-
body=json.dumps(dict(message_body)), properties=properties)
58+
channel.basic_publish(
59+
exchange='direct',
60+
routing_key=routing_key,
61+
body=json.dumps(message_body, default=lambda x: str(x)),
62+
properties=properties
63+
)
6164

6265
stream.close()
6366
conn.close()

0 commit comments

Comments
 (0)