Answer the question
In order to leave comments, you need to log in
How to use regular expressions in database queries?
Is it possible to use regular expressions in queries in postgresql from python3(sqlalchemy)? If so, can you give an example?
For example, we have a number column in which there are 10 values: 111, 211, 110, 560, 400, 101, 201, 207, 900, 105
and we need to display all 2[1-4] and 1[0-2]
Thanks in advance
Answer the question
In order to leave comments, you need to log in
in postgres it's done like this. In alchemy also, only through alchemical classes. Python has a library called re. Whether to use python or alchemy/postgres is up to you, depending on the load on the server and the requirements of the request itself. For example, if your CPU is full to capacity, and the channel is idle, there is nothing wrong with giving 100 text fields, which you will then work with in python through re. On the other hand, if this is intermediate data that is then used exclusively in queries, it’s not good to drive information back and forth, immediately use postgres regulars. But this is all speculation, test and choose a convenient path. Since you are a lover of alchemy, most likely you will do it through it. Then read the postgres manual for erudition, and then look for a similar manual for alchemy, where you will already know for sure
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question