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 ответов

14 просмотров

This is not really related to bot development

Yohannes- Автор вопроса
Yohannes- Автор вопроса
s0m31 🇷🇺
This is not really related to bot development

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

Yohannes
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

Yohannes- Автор вопроса
Yohannes- Автор вопроса

Can anyone help?

Yohannes
Can anyone help?

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

Yohannes- Автор вопроса

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

ЅуѕWΟW64
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()

Yohannes- Автор вопроса
ЅуѕWΟW64
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

Yohannes
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

𝒉𝒆𝒂𝒓𝒕𝒍𝒆𝒔𝒔
poe.com

10 prompts / day on the free plan

ЅуѕWΟW64
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

s0m31 🇷🇺
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

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

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

Эх кто-то пришел и весь праздник испортил :( You need complex FBX scene importing setup to change things on import? good luck with that. You need navigation and pathfinding? g...
Serg Gini
5
Кстати @darkhole1 для rich telegram app с поддержкой транзакций p2p через ton - какой язык считается с самой хорошей поддержкой?
Serg Gini
3
есть спецы по гитлабу? нужно решить проблему того, что гитлаб не показывает файлы с расширением txt в артефактах и предлагает их скачать и смотреть локально. а это неудобно. в...
Aleksandr Druzhinin
1
Здравствуйте. Есть спецы на языке D ? Есть проект (торговый бот) нужна долгосрочная поддержка на материальной основе) (достойная оплата) Подробности в лс.
6h123 6h123
1
как работают все эти прокси онлайн, где ты можешь ввести сайт и он зайдет на сайт от своего имени?
Aleksandr Druzhinin
1
День добрый. Стандартная библиотека phobos (std.array) ссылается на внешнюю фунцию _d_newarrayUTrace и при сборке с ключом profile-gc эта ссылка остаётся неопределённой. Никак...
slacker linuxoid
5
на D можно построить абсолютно разный архитект, как объектный, так и нет, оч широкий простор для принятия решений. Однако проблема в том, что большинство книг об айтишной архи...
Constantin_FV
1
Доброго времени суток. Сейчас я работаю над своей архитектурой Component / Systems. Если просто, это то что использовали до дробления на ECS. Потому что ECS это все таки нишев...
Vi
26
Для меня наследование это просто удобство ради удобства. Без множественного наследования, это бесполезная вещь, но удобная. С множественным наследованием, это опасная, но мощн...
Vi
1
string xczhojoxueaflfhhygcc ="xczhojoxueaflfhhygcc"; long xczhojoxueaflfhhygcc_2 =1368962155; import std.conv: text; writeln(text(xczhojoxueaflfhhygcc, " ", xczhojoxueaflfhhyg...
Constantin_FV
6
Карта сайта