Книг по алгоритмам и структурам данных множество, но почти все они (о ужас!) довольно сложные.
with updated as
( update table_name surname='surname' WHERE name='name' returning name )
select name from from_excel where name not in ( select name from updated );
>>> new_list = [1, 2, 3, 4, 5, 6]
>>> new_list == sorted(new_list)
True
>>> new_list = [1, 2, 3, 4, 8, 6, 5]
>>> new_list == sorted(new_list)
False
try:
self.cursor.execute('GRANT SELECT, INSERT ON TABLE log_fields TO manager;')
except psycopg2.Error as e:
print(e.pgerror)
print(e.diag.message_primary)
print(psycopg2.errorcodes.lookup(e.pgcode))