•  
Results 1 to 7 of 7

Thread: Loading blob (bytea) data

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Default Loading blob (bytea) data

    Hi,
    I'm loading data from mysql to GP.
    I have this table in mysql:
    CREATE TABLE images
    (id int,
    image blob)

    and would like to load this data into GP.

    CREATE TABLE images
    (id integer,
    image bytea)


    For non-blob tables I usually do:
    export mysql data to csv file --> load to gp from csv file using COPY or EXTERNAL TABLE

    obviously, it doesn't work with binary data.

    Please advise

  2. #2
    Join Date
    Jan 2011
    Posts
    253

    Default

    How does the mysql csv export look like? Still every binary object in a single line?

  3. #3
    Join Date
    Apr 2012
    Posts
    2

    Default

    the csv is messed up - the binary object breaks into multiple lines

  4. #4
    Join Date
    Jan 2011
    Posts
    253

    Default

    Bad. You probably need a small script to transfer the data.

  5. #5

    Default

    Quote Originally Posted by ads View Post
    Bad. You probably need a small script to transfer the data.
    I agree with that.

    Take a look at External Web Tables, they are explained on chapter 12 of the Greenplum Admin Guide.

    Cheers,
    Carlo Ascani - 2ndQuadrant Italy
    PostgreSQL Training, Services and Support
    carlo.ascani@2ndQuadrant.it | www.2ndQuadrant.it

  6. #6

    Default

    FYI: I have written a blog article about Web External Tables:
    http://blog.2ndquadrant.com/en/2012/...eb-tables.html

    That's a very simple example, you would be able to do the same with mysql and BLOBs (...I am thinking about mysqldump...)

    Cheers,
    Carlo Ascani - 2ndQuadrant Italy
    PostgreSQL Training, Services and Support
    carlo.ascani@2ndQuadrant.it | www.2ndQuadrant.it

  7. #7
    Join Date
    Jan 2011
    Posts
    253

    Default

    For inserting binary data (or any kind of data which is not exactly split by lineends) you need to escape the input data, right?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •