Skip to content

Instantly share code, notes, and snippets.

@codingjoe
Created September 3, 2019 08:24
Show Gist options
  • Save codingjoe/8dae34df9fc2c9aa1c315ae1596f2599 to your computer and use it in GitHub Desktop.
Save codingjoe/8dae34df9fc2c9aa1c315ae1596f2599 to your computer and use it in GitHub Desktop.

Hi Jose, that is a very good question. Many people tend to make the discussion about durability or performance, when in fact most people don't have performance issues. I believe if you want to figure out, what database to use, you need to first figure out what our application's requirements are. If you are building a browser based application that is running locally and you don't need anything but integers, floats and chars. Go with SQLite. If you run a more sophisticated application, maybe follow a SOA based architecture or want to use JSON, UUID, HStore or Arrays; different indices, stemming and database triggers; not to forget PostGIS. Use PostgreSQL. If you have a BI team that needs to build ETL processes, definitely use PostgreSQL.

Bottom line, if you need a simple structured ACID conform data store, use SQLite. If you need a database with plenty features and umpf, use PostgreSQL. BUT ultimately it comes down to what you are most comfortable with. I have been using PostgreSQL for almost a decade and am so comfortable in a psql shell, I wouldn't trade it for anything. It makes me more productive.

@joseberlines
Copy link

Hi there. My botton line is way more prosaic. I am absolute beginner. I created a copple os sites following tutorials. Now I started this 2 scoops of Django that it's said to be still one of the best books for Django. It's nevertheless a bit old (Django 1.1). And my first question was that if sqllite would be clearly worse why Django is not implemented directly with postgress (or whatever else). From what you said it's clear that I need postgress. My app will have two main I put fields to enter text. (between 1 to 60 pages text) this text will be sent to the server which will do nlp stuff analysis with the text and will render websites with information about the text like for instance features, classification,., conceps... (i.e. Json need). This Jason would be the basis for rendering a website. For instance creating buttons for every concept detected when user clicks a button the paragraphs of the text are filtered accordingly (to see where those concepts appear in the text). Thbaks for your extensive answer. Jose

@codingjoe
Copy link
Author

@joseberlines thanks for taking the time to write such a long and detailed response. Let me try to explain things in a bit more detail.

You see, Django supports many databases, not only PostgreSQL or SQLite. It also supports MySQL, MariaDB, Oracle built in as well as DB2, MS SQL Server and other via 3rd party packages. There are also NoSQL backends, for databases like MongoDB.

Django uses a strategy pattern to implement the database backends. Database backends are interchangeable, because they all implement the same API. The major upside is, that everyone can use their database of choice, that they might be familiar with form path non-Django projects.

This last bit, is an important point. When Django was initially created, PHP was ruling the marked, and since Django was new, a lot of people were switching from other frameworks. So Django developers invested a lot of effort to make everyone how jumped ship as comfortable as possible. You yourself however, are a good example of a new generation of developers. Developers that use Django as their first web framework. For those Django uses SQLite as a default, to make sure people can write a simple app before diving into the worlds of databases. Must people, just like you, mature to a different database in time. And the recommended database is usually PostgreSQL.

But there is a reason why it's PostgreSQL and not MySQL or Oracle. That is simply put features. The database backend API can only support features that are implemented across all supported databases and part of standard SQL. More progressive databases like PostgeSQL support plenty features that are not standardized. Especially PostGIS introduces whole new universe of functionalities.

I hope this little excursion helps you better understand where Django is coming from and why things are as they are. Bottom line, you are doing everything right. Study hard and give it some time and you'll fall in love with Django, just like me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment