49 lines
2.2 KiB
Python
49 lines
2.2 KiB
Python
from services.dbservice import DbService
|
|
from sqlalchemy.sql import text
|
|
# from flask_sqlalchemy import SQLAlchemy
|
|
# from app import db
|
|
|
|
def testFunction():
|
|
return 10 * 10
|
|
|
|
|
|
def testDBcon():
|
|
# conn = DbService.getDBConnection(DbService)
|
|
myDBservice = DbService();
|
|
conn = myDBservice.getDBConnection();
|
|
# print(conn)
|
|
cursor = conn.cursor()
|
|
# cursor.execute('SELECT * FROM charge_type')
|
|
cursor.execute('SELECT id,BDeatailsID ,MemberReferenceNumber ,EnquiryMemberUserID ,SubjectReturnCode ,EnquiryControlNumber ,DateTimeProcessed ,ConsumerNameField1 ,ConsumerNameField2 ,ConsumerNameField3 ,ConsumerNameField4 ,ConsumerNameField5 ,DateofBirth ,Gender ,DateofEntryforErrorCode ,ErrorSegmentTag ,ErrorCode ,DateofEntryforCIBILRemarksCode ,CIBILRemarks ,DateofEntryforErrorDisputeRemarksCode ,ErrorDisputeRemarksCode ,ErrorDisputeRemarksCode2 ,AccountType ,DateReportedAndCertified ,Occupation ,Income ,NetGrossIncomeIndicator ,MonthlyAnnualIncomeIndicator ,DateOfEntryforErrorCode1 ,ErrorCode1 ,DateOfEntryForCIBILRemarksCode1 ,CIBILRemarksCode ,DateOfEntryForErrorDisputeRemarksCode1 ,ErrorDisputeRemarksCode1 ,ATErrorDisputeRemarksCode1 ,ATErrorDisputeRemarksCode2 ,DateOfEntry ,DisputeRemarksLine ,EMailID ,AccountNumber FROM con_borrower_detail where MemberReferenceNumber = ?',['202201121036280000000'])
|
|
# where MemberReferenceNumber = 202201121036280000000"
|
|
# ,createdAt ,updatedAt ,createdby ,updatedby
|
|
data = [];
|
|
records = cursor.fetchall()
|
|
field_names = [i[0] for i in cursor.description]
|
|
print(field_names)
|
|
# print(records)
|
|
for i in records:
|
|
print('###### START #######')
|
|
print((i))
|
|
print('**************************************')
|
|
print(dict(zip(field_names,i)))
|
|
print('###### END #######')
|
|
data.append(dict(zip(field_names,i)))
|
|
# data.append(dict(i))
|
|
|
|
conn.close();
|
|
return data
|
|
|
|
def testDBRaw():
|
|
# db = SQLAlchemy()
|
|
records = db.engine.execute("SELECT id,charge_type,charge_type_description,created_at,modified_at FROM charge_type")
|
|
data = [];
|
|
field_names = records.keys()
|
|
records = records.fetchall()
|
|
print(field_names)
|
|
for i in records:
|
|
print(i)
|
|
data.append(dict(i))
|
|
# print(result)
|
|
return data
|
|
|