I'm new to Python and I need to implement a solution that every system user must have a separate database, briefly what I need is something like
db1 = Persistencia('mysql', 'usuario','minhasenha', '192.168.0.1','banco1')
db2 = Persistencia('mysql', 'usuario','minhasenha', '192.168.0.1','banco2')
#mapeia os models para o banco de dados
db1.mapeiaModels([Pessoa, Contato])
db2.mapeiaModels([Pessoa, Contato])
#atualiza a estrutura do banco de acordo com o mapeamento,
#adiciona ou altera colunas NUNCA apaga colunas
db1.sync()
pessoa = Pessoa()
pessoa.nome = 'RODRIGO'
pessoa.telefone = '88888888'
db1.save(pessoa) #salva no banco de dados 1
db2.save(pessoa) #salva no banco de dados 2
I need to have this control at the code level, logically I do not want to develop an ORM, I just want to make a wrapper
of one of the existing ORM frameworks, I took a look at Django, PyPone and SQLAlchemy, but not I am trying to create a new class in my Python class and I want to be able to create a new class in my Python class. p>
Note: I need to use on the same server but on Persistencia
separated as shown in the example, in the case databases
and banco1
and it is crucial to update the schema with minimum effort, ie, the framework that will be used must have this feature