添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I'm looking to address code using sybpydb to connect to ase 16, I see we need to take a closer look at types returned (univarchar fields need special processing). I see sybpydb's cursor provides cursor.description that (as PEP249 lays out) provides metadata about the columns (name, type_code,display_size,internal_size,precision,call, null_ok).

Would someone be able to provide guidance as to how to interpret type_code or otherwise determine the incoming type ?

PEP249 mentions DBAPITypeObject but I don't see where in sybpydb would support identifying the underlying type... Is there a better reference than ASE Extension Module for Python it simply states:

When debugging I get this

(Pdb) cursor.description
(('Id', <sybpydb.datatyp object at 0x7fb98f73b950>,4, 0 0 0),('Prop2',<sybpydb.datatyp ...

Checking further , the underlying type for cursor.description[n][1] (type_code) doesn't seem to expose any public properties . Comparing to sybpydb.STRING, BINARY, NUMBER seems to work at first glance but varchar and univarchar but matching STRING.

Hi,

You can check the description to see what they are set to:

create table tabsample (c1 int, c2 varchar(10))

import sybpydb

conn = sybpydb.connect(user='sa', password='password')
cur = conn.cursor()
cur.execute("select * from tabsample")
while True:
row = cur.fetchall()
desc = cur.description
if (not row):
break
dt = desc[0][1]
print(dt == sybpydb.NUMBER)
dt = desc[][1]
print(dt == sybpydb.NUMBER)
cur.close()
conn.close()

output:
True
False

Possible Datatype Values in sybpydb :
sybpydb.STRING, sybpydb.NUMBER, sybpydb.BINARY, sybpydb.DATETIME, sybpydb.IMAGE

Regards,
Ryan

When changing text interpretation to HTML Crystal reset the font color to black ONLY in Technology Q&A 10+ ways to reshape your SAP landscape with SAP BTP in Technology Blogs by SAP Cloud Integration: AMQP Adapter, Client Certificate, Solace PubSub+ [2]: Certificate Chain in Technology Blogs by SAP Interpret your SAP BTP Usage Analytics in Technology Blogs by Members Fairness in Machine Learning - A New Feature in SAP HANA Cloud PAL in Technology Blogs by SAP