Commit 421d5fee by Juan

psql pruebas

0 parents
import psycopg2
class BaseDatos():
def __init__(self):
self.HOST = "192.168.10.59"
self.PORT = 5432
self.USER = "administrador"
self.PASS = "administrador"
self.DB = "isvareporte"
self.SELECT = ""
def __conectarr__(self):
self.conn = psycopg2.connect(host=self.HOST, port=self.PORT,
database=self.DB, user=self.USER, password=self.PASS)
self.cur = self.conn.cursor()
self.resultado = ""
def __desconectar__(self):
self.conn.close()
self.cur.close()
def __leer__(self):
self.cur.execute(self.SELECT)
self.resultado = self.cur.fetchall()
def __ValidarComando__(self):
return(True)
def Leer(self):
if self.__ValidarComando__():
self.__conectarr__()
self.__leer__()
self.__desconectar__()
File mode changed
from Libmod.psql import BaseDatos
db = BaseDatos()
db.SELECT = """SELECT dom.name as dominio, pf.create_date, pf.pfs_fecha, cli.name, cli.street, cli.street2, loc.name AS localidad, prov.name AS provincia, cli.zip AS codigo_postal, pais.name AS pais, pf.domicilio AS domicilio_pf FROM
(
(koozo_planillafosa AS pf LEFT JOIN account_invoice AS comp ON pf.pfs_acc_inv = comp.id)
LEFT JOIN
res_partner AS cli ON comp.partner_id = cli.id
LEFT JOIN
res_country_state AS prov ON prov.id = cli.state_id
LEFT JOIN
res_country AS pais ON pais.id = cli.country_id
LEFT JOIN
koozo_dominios AS dom ON dom.id = comp.ain_dom_id
LEFT JOIN
koozo_localidad AS loc ON loc.id = cli.par_loc_id OR loc.id = pf.pfs_loc_id
) WHERE pf."tws_Tipo" = 'cent' AND pf.create_date >= '01/01/2019 12:00:00 AM' AND pf.create_date <= '01/02/2019 12:00:00 AM'"""
print(db.resultado)
db.Leer()
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!