Hey guys i have a question when i use ignore in

db which one is correct

query_insert_users_settings = (
f"INSERT OR IGNORE INTO users_settings\
(chat_id, {query_insert_users_settings_str_fields}) \
VALUES (?, {query_insert_users_settings_str_input})"
)

or

query_insert_users_settings = (
f"INSERT OR IGNORE INTO users_settings\
(chat_id, {query_insert_or_ignore_users_settings_str_fields}) \
VALUES (?, {query_insert_users_settings_str_input})"
)

23 ответов

85 просмотров

This is not really related to bot development

Палубный-Омлет Автор вопроса
Простой Чай
This is not really related to bot development

You can just ignore it, let the admins decide what to do

Палубный Омлет
I am saving users id to my db

I have a unity game that can be controller from Telegram bot. That doesn't mean I should ask unity questions here

Палубный-Омлет Автор вопроса
Палубный-Омлет Автор вопроса

Can anyone help?

Палубный Омлет
Can anyone help?

Tip: ChatGPT can help you for small doubts like this one and save time 😉

What do you want to insert and into which columns? Because I can see the first col chat_id, but the second column is not clear to me

Плутонианское Взморье
What do you want to insert and into which columns?...

That's what I was talking about: feels like second column is just being placed from a variable, which name he can't choose

This is the general syntax, you can modify according to your needs: - Using F-Strings: table_name = "your_table_name" column1 = "value1" column2 = "value2" sql_query = f"INSERT OR IGNORE INTO {table_name} (column1, column2) VALUES ('{column1}', '{column2}')" - Using the % formatting: table_name = "your_table_name" column1 = "value1" column2 = "value2" sql_query = "INSERT OR IGNORE INTO %s (column1, column2) VALUES ('%s', '%s')" % (table_name, column1, column2) - Paramentrized (?) Queries (works for SQLite, use the above methods for MySQL): import sqlite3 conn = sqlite3.connect('your_database.db') cursor = conn.cursor() table_name = "your_table_name" column1 = "value1" column2 = "value2" sql_query = "INSERT OR IGNORE INTO {} (column1, column2) VALUES (?, ?)".format(table_name) # values need to be a tuple cursor.execute(sql_query, (column1, column2)) conn.commit() conn.close()

Палубный-Омлет Автор вопроса
Плутонианское Взморье
What do you want to insert and into which columns?...

Its the same but sometimes i get issues when users just send message instead of using /start and then uses /start command (i think this is the issue), and the database gets locked after so i want to know which one is correct to ignore if users is already available on db

Палубный Омлет
Its the same but sometimes i get issues when users...

Are you using SQLite? In my experience, SQLite tends to get db locks more frequently than MySQL

Плутонианское Взморье
10 prompts / day on the free plan

restriction is for normal users, it can be easily bypassed xD

It is way easier to get openai account rather than bypassing anything

Простой Чай
It is way easier to get openai account rather than...

you're in a normal person's list & it's nice but you can't feel how pentesters enjoy their work at that moment to bypass something

Похожие вопросы

Обсуждают сегодня

Он в одиночку это дело запилил или была какая-то команда?
Фотографический Ёж
12
Вообще кстати бывают такие тулкиты чтобы вот разработал под ОС X, всё оттестировал работает А потом собрал под ОС Y - и там просто без вообще любых изменений заработало?
Пятнистый Ветер
14
всем привет, кто знает нормальный гайд как настроить отладчик в Intelij на Windows?
Ванильный Глухарь
6
А тут все сообщения из матрикс сервера видны будут?
Пятнистый Ветер
2
а телега разве проприетарная?
Пятнистый Ветер
2
А, вообще, знает кто-нить альтернативы D в области безопасных, читабельных ОО-языков?
Новое Лукошко
14
И его забанить админ если что сможет потом?
Пятнистый Ветер
1
А в чем прикол этого матрикса? @quantumde1
Пятнистый Ветер
1
моста? это теперь так гейт называют?
Дневная Трясогузка
1
Работа над эдишенами там какая-то ведется? Или пока что тишина?
Пятнистый Ветер
1
Карта сайта