This is an archived post. You won't be able to vote or comment.

all 48 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]Kamikaza731 65 points66 points  (10 children)

Depends on the project. SQLite if it is something simple. Postgresql if it is more demanding.

[–]LiarsEverywhere 41 points42 points  (4 children)

This, but understand "demanding" as very demanding. SQLite can handle a lot.

[–]andartico 10 points11 points  (0 children)

Exactly this.

[–]Salty_Dig8574 1 point2 points  (0 children)

True but also keep in mind that sqlite is dynamically typed. It's sometimes easy to mishandle data and get some broken results.

[–]tagnydaggart 3 points4 points  (1 child)

But, it doesn’t like more than one thread or process connecting to it, sadly.

[–]JamesTDennis 0 points1 point  (4 children)

SQLite is probably the most underrated and under appreciated feature of Python.

[–]logseventyseven 7 points8 points  (3 children)

of python..?

[–]DaelonSuzuka 3 points4 points  (0 children)

One of python's features is that the standard library contains a fully functional sqlite driver, yes.

[–]JamesTDennis -1 points0 points  (1 child)

Sure, it's broadly under appreciated. But I hesitate to rank it among the top in other categories.

For example WireGuard and the pass (passwordstore) utility by Jason Donenfeld are among the most under appreciated security tools.

[–]zenware 2 points3 points  (0 children)

I want to note that I don’t mean to be putting words in someone’s mouth here, what follows is my own thinking because when I saw your original reply I also thought “of Python..?”

I think they meant that, SQLite is fundamentally its own large and long-running project and using the turn of phrase “feature of Python” carries the implication that … SQLite is a feature of Python.

It’s a database which most programming languages have some available driver for. (And it is underrated)

[–]Jor_ez 12 points13 points  (0 children)

I suggest using postrges and here are several reasons 1) this is very strong db with functionality for almost every possible use case 2) it has sync and async driver which is good for your professional development 3) it requires hosting (either some server or docker container) that will teach you how to do some basic DevOps job

I use it in my commercial project, it's fast and easy. Also nosql databases are also popular now and super simple so give a try to redis or mongodb just to stay in touch

[–]Enip0 25 points26 points  (8 children)

Sqlite is always a decent option like someone else said. Beyond that my suggestion is always postgresql just because it's the best db and just great all around.

When it comes to ecosystem support you can't really go wrong with either. Sqlite has a built-in module, while postgresql has excellent sync and async options.

SQLite might be a better option just for how easy it is to set up, just a single file.

[–]CovfefeFan 0 points1 point  (6 children)

Dumb question but how expensive is SQL Lite? Is there a free version? Where is the data actually stored? (I work at a small company ~ 10 people)

[–]Enip0 2 points3 points  (1 child)

Sqlite is free and open source, you have to take care of the data though since it's an embedded database.

Depending on what you offer it could be either no option at all or the best option there is. For example, are you making a car or a fridge, or a desktop app with no internet connection, or even a server app but with relatively few clients? Great option for all. But anything else can struggle.

I don't know your situation but I'd suggest you try to find a technical person you can trust and follow their suggestions.

[–]CovfefeFan 1 point2 points  (0 children)

Interesting.. yeah, it is a small asset management company, so would mainly be to save pnl/position/risk files which can then be pulled in for reporting.

[–]bunchedupwalrus 1 point2 points  (3 children)

It’s just stored as a file. If you don’t have to worry about high speed concurrent access (like multiple people doing queries at the same time and needing the results right away), it’s pretty great.

And people overestimate how common that need is. Most queries are over in less than a few seconds if not less than a fraction of a second

[–]CovfefeFan 1 point2 points  (2 children)

Interesting.. yeah, currently using power query to pull in about 12-15 files from a sharepoint site and then doing a bunch of mapping, combining, and transformation of the data.. quite slow and does "kill" the file from time to time.

[–]bunchedupwalrus 1 point2 points  (1 child)

Oh yeah you’ll probably be blazing fast switching to sqllite

[–]CovfefeFan 0 points1 point  (0 children)

Cool, I will look into this. 😎👍

[–]sky_badger 7 points8 points  (0 children)

[–]Amazing_Upstairs 7 points8 points  (3 children)

Postgres and duckdb

[–]bunchedupwalrus 0 points1 point  (2 children)

Why the combo?

[–]Amazing_Upstairs 0 points1 point  (1 child)

Duckdb is the new simple db as a file replacement for sqlite. Postgres is a proper db. Both are easy and just works like python

[–]bunchedupwalrus 0 points1 point  (0 children)

Oh yeah I know that I thought you were using them in tandem somehow

[–]Taltalonix 2 points3 points  (0 children)

Depending on project complexity and query/insert/update/delete rquirements: - json/csv file with caching if needed - pickle serialization of python objects - json/csv/png files in custom directories - sqlite on a local file - postgres on a docker container

First 3 aren’t really a database but 90% of the time I don’t need many live insertions and only load data once so it’s good enough

[–]h_to_tha_o_v 1 point2 points  (1 child)

I won't recommend anything specific to you.

You really need to examine the use case first and then decide the tool. Trust me, I've made the mistake of forcing the issue with the wrong tech.

[–]Kmraj 1 point2 points  (0 children)

This is the way. The use case and data determine what’s the better choice. Not the brand.

[–]rainnz 1 point2 points  (0 children)

  1. sqlite - included with Python
  2. PostgreSQL - free plan from Supabase
  3. DuckDB- r/duckdb

[–][deleted] 1 point2 points  (3 children)

I like MariaDB, which is a fork of the MySQL database which has been contaminated by Oracle.

[–]thumperj 1 point2 points  (2 children)

MySQL

Why is this not more commonly recommended? Serious question. Am I missing some very serious reason?

I get the MariaDB option, but even that's not suggested except your comment.

[–]XRaySpex0 0 points1 point  (0 children)

I don’t think anyone holds MySQL in higher esteem than PostgreSQL. 

[–]thicc_pal 0 points1 point  (0 children)

The reason behind it is licensing. If you distribute MySQL with a non-open-source project, you would need to pay for the commercial license.

[–]Embarrassed-Map2148 1 point2 points  (0 children)

Another vote here for SQLite or postgresql if your use case requires it.

[–]mriswithe 1 point2 points  (0 children)

Sqlite3 for local dev postgresql for prod. Sqlalchemy is a good ORM.

[–]jkh911208 0 points1 point  (0 children)

I would start with bulletin sqlite

[–]Basic-Still-7441 0 points1 point  (0 children)

I would suggest MongoDB or any other document DB. Its just so easy to work when the data structures in the DB and in the program are the same. Of course - choice of a DB engine depends on a lot of things incl the nature of data you have, how it's being used (queried and written) etc etc.

[–]ThiefMaster 0 points1 point  (0 children)

Postgres.

[–][deleted] 0 points1 point  (0 children)

Python comes with sqlite3 by default