SAP Knowledge Base Article - Preview

3236952 - Unable to run a query with sybpydb python3 - SDK for ASE

Symptom

  • Tried to write a python script to get the same results as:
    declare @numpgsmb int
    select @numpgsmb = (1048576. / @@maxpagesize)
    select s.name, sum(size/@numpgsmb), sum(size/@numpgsmb) - sum(curunreservedpgs(db_id("master"), lstart, unreservedpgs)/@numpgsmb)
    from master..sysusages u, syssegments s
    where u.dbid = db_id("master")
    and (segmap & power(2, segment)) = power(2, segment)
    group by s.name
    go
    (1 row affected)
    name
    -----------------------------------------------   ----------   -----------
    default                                               18            10
    system                                                18            10
    logsegment                                            18            10

(3 rows affected)

  • The code used does not work, but unsure how to fix.

    import sybpydb
    username = "*******"
    password = "******"
    dataserver = "*********"
    conn = sybpydb.connect(user=username, password=password, servername=dataserver)
    cur = conn.cursor()
    cur.execute('QUERY_WAS_HERE’)
    rows=cur.fetchall()
    print rows





Read more...

Environment

SAP Adaptive Server Enterprise 16.0

Product

SAP Adaptive Server Enterprise 16.0 ; SAP Adaptive Server Enterprise SDK 16.0

Keywords

KBA , BC-SYB-SDK , SDK , BC-SYB-ASE , Sybase ASE Database Platform (non Business Suite) , How To

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.