push 0.5 & create 0.6(update)

This commit is contained in:
ada-dmitry
2024-05-09 12:06:44 +03:00
parent eb0bdf5049
commit 76065b7ec2
35 changed files with 615 additions and 26 deletions
+23
View File
@@ -0,0 +1,23 @@
# Таблица персоны и особые действия с ней
from dbtable import *
class PeopleTable(DbTable):
def table_name(self):
return self.dbconn.prefix + "people"
def columns(self):
return {"id": ["serial", "PRIMARY KEY"],
"last_name": ["varchar(32)", "NOT NULL"],
"first_name": ["varchar(32)", "NOT NULL"],
"second_name": ["varchar(32)"]}
def find_by_position(self, num):
sql = "SELECT * FROM " + self.table_name()
sql += " ORDER BY "
sql += ", ".join(self.primary_key())
sql += " LIMIT 1 OFFSET %(offset)s"
cur = self.dbconn.conn.cursor()
cur.execute(sql, {"offset": num - 1})
return cur.fetchone()