I heard a lot about different types of database from SimpleBD (in one file), to MySQL, Postgresql. I understand how they work (as a whole from the outside) at the user level. But here is the language of communication with them (sql queries for me is almost a dark forest). I want to have a simple database configuration / administration, which is easy to write queries from the python script, receive data, load data. All this is necessary for training, personal / working use, not directed to mass-use (high-load sites).

Question: Share your experience with which of the databases and the library in python the easiest way to interact with the data for a beginner, that would not get out 10-20 errors, due to the complex query syntax in which you need to understand a very long time. Do I understand correctly that the most common is MySQL and you can find more examples of video lessons for it?

Closed due to the fact that it is necessary to reformulate the question so that the participants can give an objectively correct answer Vladimir Martyanov , Vartlok , user194374, aleksandr barakin , zRrr 2 Apr '16 at 14:38 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

    2 answers 2

    Actually everything you need to know to work with SQLite:

    ### SQL QUERIES ### selAll = "SELECT * FROM tasks" createCommand = """ # Создать таблицу CREATE TABLE tasks ( id INTEGER PRIMARY KEY, 'Задача' NVARCHAR(1000), 'Подзадача' NVARCHAR(1000), 'Сотрудник' NVARCHAR(50), 'Дата' DATE, 'Статус' NVARCHAR(200), 'Коммент' NVARCHAR(1000), 'Тек статус' NVARCHAR(30), 'Осталось' INTEGER );""" searchText = """ # Искать в таблице SELECT * FROM tasks WHERE Задача like "%{kword}%" OR Подзадача like "%{kword}%" OR Сотрудник like "%{kword}%";""" insertText = """ # Внести новые данные в таблицу INSERT INTO tasks (ID, 'Задача', 'Подзадача', 'Сотрудник', 'Дата', 'Статус', 'Коммент', 'Тек статус' ) VALUES (NULL, "{tsk}", "{stsk}", "{prsn}", "{dt}", "{stts}", "{cmt}", "{crsts}" );""" deleteText = "DELETE FROM tasks WHERE ID = {key}" # Удалить некоторые данные updateText = """UPDATE tasks # Отредактировать данные SET 'Задача'="{tsk}", 'Подзадача'="{stsk}", 'Сотрудник'="{prsn}", 'Дата'="{dt}", 'Статус'="{stts}", 'Коммент'="{cmt}", 'Тек статус'="{crsts}" WHERE ID = {key};""" 

    Use in Python. Creating a table:

     connection = sqlite3.connect(dbfile) cursor = connection.cursor() try: cursor.execute(createCommand) except sqlite3.OperationalError: pass 

    Inserting data from the dictionary (newRecordDict) into the table:

     insertCommand = insertText.format( tsk=newRecordDict["Задача"], stsk=newRecordDict["Подзадача"], prsn=newRecordDict["Сотрудник"], dt=newRecordDict["Дата"], stts=newRecordDict["Статус"], cmt=newRecordDict["Коммент"], crsts=newRecordDict["Тек статус"] ) cursor.execute(insertCommand) connection.commit() 

      The easiest way for you is to use SQLite . A good system for a beginner, does not require knowledge of administration, is easy to install and use. You need to know SQL anyway, so be patient and learn as you go along. Even having moved under the ORM of Jhangi, knowledge of the SQL kitchen will be useful to you.

      MySQL is one of the most common databases, as well as Postgresql and there are many lessons for these bases. The choice of base for the project is determined by the requirement for reliability of storage, speed of work, etc. Now it makes no sense to hammer in the head. Gradually, an understanding of what is needed will come by itself.

      • I asked a question - I think I hurried, I think it will be harder to figure out the new base. It seems like there are some ideas about MySQL and quite a bit of experience, and even in Python there is a small script and library for interaction. I will accept as a suitable answer! Thanks - Amaroc