Hacker News new | past | comments | ask | show | jobs | submit login

Another bit of "FUD" I have is that I always consider the database (pgsql say) to be the one thing that won't change, so I create tables in SQL and would keep that even if the service changed from say Python to Go.

With Django, would I be able and would it make sense to keep the SQL schema if I changed languages?




I've not used SQLAlchemy much, but I assume it can be configured to map onto the DB tables that Django has created.

Django has the concept of `apps`, where each app gets its own namespace. So for model `foo` in app `app1`, you get a table `app1_foo`. Inside that table it's just the standard SQL columns that you'd expect. So you might need to override the default table name if your new ORM provides one, but no more than that.

The only other piece that might give you grief is the ContentType machinery; there's a content_type table that has a row for each model class, which lets you do generic foreign key lookups. It might be some work to duplicate that, if you start depending on it. But it's not super-complex; it's just <id, app_label, model> in that table.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: