Answer the question
In order to leave comments, you need to log in
Transferring data between databases with different schemas
Probably a dumb question, I'm a complete newbie to ruby. It seems to me that there must be some very simple solution on rails, but I can't google it point-blank.
Imagine the following problem:
1) There is a desktop program with a GUI written in qt.
2) The program is designed to compile special dictionaries, written in a stump-deck due to very tight deadlines and has the following unpleasant moments:
a) all data is stored in a set of sqlite3 databases
b) each dictionary is a separate database
c) alas (yes-yes , they don't, but in this case it was necessary), but blobs are also stored directly in sqlite3. The content type is also encoded there, i.e. all data is easily recoverable
d) the database schema was originally compiled taking into account some features that are not essential from the point of view of the question
3) Right now I am writing a web application to represent all these dictionaries
4) In this application, all databases are supposed to be merged into one
5) The table schema has changed quite significantly, but in general, data models are easily mapped to one another in both directions.
The initial idea was to write a special converter web application that would take an sqlite file (a completed dictionary) as input, sequentially bypass all the contents of the database with links, make an intermediate representation and upload the received data directly through the controller into main base.
List of problems:
1) I don’t understand if it’s possible in some way in ruby-on-rails to dynamically cling to two databases (i.e. keep a connection from one constantly, and connect to the second - flooded with sqlite database - connect on the fly, read everything from it and upload to the main one)
2) If it is impossible to do it on the fly, how to do it statically?
3) In general, it would be possible to write a converter in pure SQL, but then it may turn out to be a separate hemorrhoids to transfer files from blobs to paperclip (well, or carrierwave). It is so?
I would love to hear advice on how to do it right. Yes, I know that I am a woodpecker and an evil pinocchio to myself, but still
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question