I agree with you Shai, that's why I proposed a command that makes use of
migrations internals (not to use a migration per se) to do the job.

Thanks for the feedback Marc, I know having the migration to use django orm
is a much slower process than importing it from a textual source, but the
main objective is the correctness of the data. Using django orm would
guarantee that all the tables are created the way django expects it and the
data is inserted into the database as well as the way django does it.

My concern is migrate without having to change anything on the models or
get an unexpected behavior.

Thanks for all your feedback, I'm gonna try to have some PoC and see if
it's doable.

On Tue, Jun 14, 2016 at 8:43 AM, Shai Berger <[email protected]> wrote:

> Hi Bruno,
>
> I think that putting such an operation in a migration doesn't make much
> sense. If it's part of the project migrations, it means that the canonical
> way to set up the database is to start up on MySQL and move to PG later.
> This is almost surely not what you intend.
>
> Copying data across is usually a one-time thing, not something you want as
> part of your living history. A management command fits much better than a
> migration.
>
> My 2 cents,
> Shai
>
> On 10 ביוני 2016 20:47:51 GMT+03:00, Bruno Ribeiro da Silva <
> [email protected]> wrote:
>>
>> Hey guys, I'm not sure if I should be asking this here, but it's related
>> to django internals.
>>
>> I have this idea to create a command that uses the migrations api to
>> migrate all the data from one database (eg. MySQL) to another database
>> (PostgreSQL).
>>
>> So I would run the migrations in the new target database, then flush all
>> the tables there, and model by model do a bunch of bulk_create into the new
>> database using the result queryset from the source database.
>>
>>
>> The questions are: do you think it is feasible to make all of this inside
>> a command? If I have to change the migrations api to make it happen, do you
>> think this could be a nice feature to have in Django?
>>
>>
>> Thanks in advance!
>>
>>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/9B1A79E7-E458-4DA5-BC94-C1838DA4908E%40platonix.com
> <https://groups.google.com/d/msgid/django-developers/9B1A79E7-E458-4DA5-BC94-C1838DA4908E%40platonix.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Bruno Ribeiro da Silva
Python Dev and Homebrewer!

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAE-2%3DJyeqJMwkh%3Dw-VA9b1ou4nz-juE9kwYvG5HJB5-AfRcKZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to