+-----------------+----------+----------------+-----------------+
| achievements_id | users_fk | type | date |
+-----------------+----------+----------------+-----------------+
| 1 | 1 | 1 | 2021-10-01 |
| 2 | 2 | 1 | 2021-10-04 |
| 3 | 1 | 2 | 2021-10-08 |
| 4 | 1 | 4 | 2021-10-15 |
+-----------------+----------+----------------+-----------------+
+-----------------+-----------+----------------+-----------------+
| achieve_prop_id | acieve_fk | type | value |
+-----------------+-----------+----------------+-----------------+
| 1 | 1 | 1 | 'abc' |
| 2 | 2 | 1 | '145' |
+-----------------+-----------+-----------------+----------------+
gener=connection.escape(gener)
вы получаете в запросе LIKE "%'blabla'%"
.def escape(self, obj, mapping=None):
"""Escape whatever value is passed.
Non-standard, for internal use; do not use this in your applications.
"""
cursor.execute(script.format(year_from=args.year_from,
year_to=args.year_to,
name="%{}%".format( (args.regexp.translate(str.maketrans({'%': '\%', '_': '\_'})),) ),
gener="%{}%".format( (gener.translate(str.maketrans({'%': '\%', '_': '\_'})),) ),
rating=1,
N=args.N))
SELECT m.title, year, avg(r.rating)
FROM movies AS m
JOIN rating AS r
ON m.movie_id = r.movie_id
WHERE m.year BETWEEN {year_from} and {year_to} AND m.title LIKE {name} AND m.genres LIKE {gener}
GROUP BY r.movie_id, m.title, m.year
HAVING avg(r.rating) > {rating}
ORDER BY avg(r.rating) DESC, m.year DESC, m.title asc
LIMIT {N};
$ctx = stream_context_create(array("ssl" => array("capture_peer_cert" => TRUE)));
$sock = stream_socket_client("ssl://www.google.com:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $ctx);
$cert = stream_context_get_params($sock);
$certinfo = openssl_x509_parse($cert['options']['ssl']['peer_certificate']);
// print_r($certinfo);
print "Valid from: " . date_create_from_format("ymdHise", $certinfo["validFrom"])->format("c")
. "\nValid till: " . date_create_from_format("ymdHise", $certinfo["validTo"])->format("c") . "\n";
И ещё ошибка с from psycopg2 import OperationalError, он просто не находит OperationalError
>>> from psycopg2 import OperationalError
>>> OperationalError
<class 'psycopg2.OperationalError'>
>>> psycopg2.__version__
'2.8.6 (dt dec pq3 ext lo64)'
The error 'FATAL: password authentication failed for user "postgres"
Как этот пароль посмотреть или новый создать?
ALTER ROLE postgres WITH PASSWORD '123';
или в psql \password
class vk_api.longpoll.VkLongPoll(vk, wait=25, mode=234, preload_messages=False, group_id=None)
wait — the waiting period (as most proxy servers terminate the connection after 30 seconds, we recommend indicating wait = 25). Maximum: 90.
lp = VkLongPoll(vk_session, group_id=123456789)
postgres=# select '{"email": "a@example.com", "telegram_token": "", "telegram_user_id":""}'::jsonb - 'email';
?column?
------------------------------------------------
{"telegram_token": "", "telegram_user_id": ""}
(1 row)
UPDATE group_settings
SET group_recepients = jsonb_build_object('email', subquery.email, 'telegram_token', '', 'telegram_user_id', '')
FROM (SELECT id, email from users) AS subquery WHERE group_settings.user_id = subquery.id;