Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-9430

MariaDB source doesnt extract JSON columns properly

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • Moderate

      Mariadb stores JSON as LONGTEXT, not JSON. So, when you have a JSON column in mariadb, it just comes out with a string in the schema, rather than io.debezium.data.Json

       

      {     
        "name": "json_col",
        "type": ["null","string"],
        "default": null 
      }

      Here's a blog post from Mariadb on the topic
      Making MariaDB understand MySQL JSON - MariaDB.org

       

      And from their docs;:

      JSON is an alias for LONGTEXT. See JSON Data Type for details.

      In MySQL, JSON is an object and is compared according to json values. In MariaDB JSON strings are normal strings and compared as strings. One exception is when using JSON_EXTRACT() in which case strings are unescaped before comparison. 

       

      So, Its really just a LONGTEXT. 

       

      I think that all that could probably be done is change the docs Debezium connector for MariaDB :: Debezium Documentation to say that JSON is actually LONGTEXT and will output as string, and wont have io.debezium.data.Json

       

              Unassigned Unassigned
              nickchomey Nick Chomey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: