Ticket #39 (closed enhancement: fixed)

Opened 3 months ago

Last modified 2 months ago

Migrate model code to a declarative layer

Reported by: glezos Owned by: stephane
Priority: major Milestone: 0.4
Component: Core Version:
Keywords: Cc: ctrochalakis

Description

Declarative layers on top of SQLAlchemy are a trend, and produce much smaller code in the model. The two approaches are Elixir and the declarative plugin of SQLA.

We should migrate the transifex/model.py to one of the two (probably Elixir).

See also the related thread.

Attachments

transifex-model.py (23.7 KB) - added by stephane 3 months ago.
Rewriting of the current model with the SA declarative plugin (tested)

Change History

Changed 3 months ago by glezos

  • keywords easy_task removed

Changed 3 months ago by stephane

  • owner changed from Dimitris Glezos to stephane
  • status changed from new to assigned
  • type changed from defect to enhancement

I don't like to add yet another dependency (Elixir) but I find the code is clearer with Elixir 0.6 than SA declarative plugin (micro-layer) 0.5.

The best thing to do is certainly to write the most complex part of our data model (polymorphic associations) with SA and Elixir and take a decision about the one to choose (trade off between dependency/intermediary layer/performance/maintenance).

I'm going to work few hours on this task tomorrow but I will be away for 2 days after, if you're free to work on this task, keep me posted.

1 - for the fun, I will migrate the current model.py to SA plugin in the transifex branch
2 - I will test SA and Elixir on the new data model in the model2 branch.

Changed 3 months ago by glezos

  • cc ctrochalakis added

Good stuff.

I think the model2 branch is ready to be used as a base for such work. The new tables won't change much, and the Elixir-equivalent models for User, Group etc (basic TG tables) should already exist on the web, so they might not need migration -- just copy-pasting.

We could develop the polymorphic feature as a second step, after migrating the existing code to the new layer. This way we can test it and then go on with the more advanced stuff.

For anyone interested in this, we'll be on #transifex on Freenode.

Changed 3 months ago by stephane

The Elixir-equivalent models for User, Group, etc are available with:

tg-admin quickstart -e

Changed 3 months ago by stephane

Rewriting of the current model with the SA declarative plugin (tested)

Changed 2 months ago by ctrochalakis

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in r374 by Stephane

Note: See TracTickets for help on using tickets.