Coder Social home page Coder Social logo

Comments (7)

acidjunk avatar acidjunk commented on May 22, 2024

A log with the complete error:
https://dl.dropboxusercontent.com/u/20756661/sqlite2postgres_blob.log

from pgloader.

dimitri avatar dimitri commented on May 22, 2024

I think it's a problem with the unique concept of manifest typing used in SQLite3, wherein I have the following quite strange result:

SQLITE> (let ((statement (sqlite:prepare-statement *sqlite-db*
                                                   "select file_data from files limit 1")))
          (sqlite:step-statement statement)
          (prog1
              (sqlite-ffi:sqlite3-column-type (sqlite::handle statement) 0)
            (sqlite:finalize-statement statement)))
:TEXT

Note that it's not the driver's fault:

sqlite> select typeof(file_data) from files limit 1;
text

I will see later what can be done here, given that SQLite happily returns text rather than blob as soon as the data itself fits into the text datatype rules, or something. Hopefully there's a way to force SQLite into returning blob data without having to parse and copy the text output into a PostgreSQL bytea representation.

That said it might be that just storing the string characters as their ascii bytes into the bytea is all we need to do here.

from pgloader.

dimitri avatar dimitri commented on May 22, 2024

Aha. After some tests, your data is base64 encoded, so returned as text for that reason.

from pgloader.

acidjunk avatar acidjunk commented on May 22, 2024

I tried rebuilding pgloader, with make pgloader: but it seems to need an extra DEP:
Fatal MISSING-DEPENDENCY:
Component #:BASE64 not found, required by #<SYSTEM "pgloader">

from pgloader.

dimitri avatar dimitri commented on May 22, 2024

Sorry about that, went too fast again. Should be ok now (did compile a binary and used it against the new regression test here).

from pgloader.

acidjunk avatar acidjunk commented on May 22, 2024

It works now. But when converting a very big DB (sqlite with 400Mb on Blob in a table) I run into memory shortage issues. Is there a smart way around this? (it's not a big issue for me, I can clean up the table before doing the convert)

from pgloader.

dimitri avatar dimitri commented on May 22, 2024

You can try the batch settings (see Batch behaviour options in the Reference documentation), or even try compiling with CCL (at http://ccl.clozure.com/) if you feel that way.

from pgloader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.