I have reviewed the 2019 code and it still works, but, I will refactor it.
import easymacro as app
from zazplus.peewee import *
from zazplus import easyplus
database_proxy = DatabaseProxy()
class BaseModel(Model):
class Meta:
database = database_proxy
class Person(BaseModel):
id = IdentityField()
name = CharField()
last_name = CharField()
def main():
PATH_DB = '/home/mau/people.odb'
db = easyplus.LODocBase(PATH_DB)
db.initialize(database_proxy, [Person])
p = Person(name='Teresa', last_name='Salgueiro')
p.save()
Person.insert(name='Naomi', last_name='Watts').execute()
db.close()
app.debug('ok')
return
Work fine.
soffice --calc
22/05/2022 23:17:09 - DEBUG - CREATE TABLE "person" ("id" INT GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "last_name" VARCHAR(255) NOT NULL) []
22/05/2022 23:17:09 - DEBUG - INSERT INTO "person" ("name", "last_name") VALUES (?, ?) ['Teresa', 'Salgueiro']
22/05/2022 23:17:09 - DEBUG - INSERT INTO "person" ("name", "last_name") VALUES (?, ?) ['Naomi', 'Watts']
22/05/2022 23:17:09 - DEBUG - ok
Result.
PLEASE. Do not attempt to use until fully documented, thank you.