Jérémy,

It all depends on the Database which route to take. Is it one table,
multiple tab;es, what are the relationship?

My plan of attack would be:

 1. Create all models in Django as you want them to be. Use the Django
    standards to name your new fields [1].
 2. Let Django handle the field naming, unless you have a really good
    reason to overwrite this behavior. Relationships are setup to other
    models, do not add _id to these fields, Django 
 3. Create the migrations to create the models in Postgres
 4. With Django in mind write your conversion. In other words, use the
    Django ORM to write data to your new DB, while using RAW sql to read
    the old DB.
 5. Write the conversion as management command.
 6. If you have multiple tables start filling the tables that do no have
    any relationship to other tables first and work your way up. No FK
    Tables-> Tables with one or more FK to an already existing table


[1] -
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#model-style


On 1/7/21 1:05 AM, Jérémy Garniaux wrote:
> Hi,
>
> I'm working on my first Django project. Already read the tutorial but
> following along it to be sure not to miss anything.
>
> I've been asked to rebuild a pre-existing website. It's basic in
> functionality: various users create complete descriptions of heritage
> items in the admin area, and the public page display the description,
> mostly in text format, sometimes with images too. The final user can
> navigate the items on the public page.
>
> The data model contains many different classes and variables - it's
> well structured and doesn't need to change.
>
> The data is stored into a MS SQL Server database. The new website will
> use PostgreSQL, so I need to convert the MSQSQL database and import it
> into PostgreSQL. I'm aware of inspectdb but I decided to manually
> write models.py from the ground to get acquainted both with the data
> and with django models.
>
> What I'd like to know is:
>
> - Should I work on the conversion and import of the MSSQL database
> into PosgreSQL without thinking about Django at this stage?
>
> - I read that Django will add "_id" at the end of the field names.
> Should I worry about that? Or should I leave in PgSQL the same field
> names there was in MSSQL? How should I name my variables in models.py
> then?
>
> - Any other advice will be very welcome :)
>
> Thanks a lot for your help,
>
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8f0a8220-a05e-d81f-781c-c30c1f4ba0c2%40oneilinteractive.com.

Reply via email to