on ‎2019 Mar 18 3:52 PM
Hello,
I would like to execute queries in Python 2 (and 3 if possible) to ASE and IQ Sybase servers.
What are the most performant implementations in Python 2/3 ?
Best regards,
Request clarification before answering.
Hi Joe,
We just finished a feature request of Python for ASE. We support Python 3.7 with ASE/SDK 16.0 SP02 PL09, will be out in the next month or so, and 16.0 SP03 PL07, which dropped in June 2019.
Thanks,
Dawn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ASE 16.0 SP03 PL07 just introduced support for Python 3.7, which is quite an improvement over 3.4.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes, we support Python 2 and 3 for ASE.
$ pwd
/sybase/ase/syb157sp140/OCS-15_0/python
$ ls
python26_64r python26ucs4_64r python31_64r
Versions supported with these modules. Python 2.6.x and 3.1.x on 15.7.
16.0 Sp03 Pl06 includes:
python34_64r Python 3.4.x
You can use SDK 16.0 on ASE 15.7 as well.
Regards,
Ryan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Richard,
For ASE we don't have any information about performance about Python version.
Please check the product manual about Programmer's guide for Python
Regards,
Jongun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also, I've tried using SQL Alchemy to execute queries seemsly on IQ and ASE but it works only for IQ:
import sqlalchemy
from sqlalchemy.dialects import registry
registry.register('sqlalchemy_sqlany', 'sqlalchemy_sqlany.base', 'SQLAnyDialect')
engine = sqlalchemy.create_engine("sqlalchemy_sqlany://{}:{}@{}:{}".format(usr, pwd, host, port), echo=True)
engine.connect()
metadata = sqlalchemy.MetaData()
table = sqlalchemy.Table("MY_TABLE", metadata, autoload=True, autoload_with=engine)
result = sqlalchemy.select([table]).where(table.columns.MY_COLUMN == "MY_VALUE")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello joe.woodhouse, where can I download CPython driver to execute queries ? I've read https://help.sap.com/doc/4c40a79c93f4485ca2a01c5ba806c2f5/16.0.3.6/en-US/Adaptive_Server_Enterprise_... but it seems only Python 2 (released in 2012) is available on SourceForge.
I'm looking for a driver that will run on Python 3, GNU/Linux, Windows, IQ and ASE. Does that driver exist ? 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Richard,
Here is the setup using the SAP driver.
SDK 16.0 SP03 PL07:
$ source
$SYBASE/SYBASE.csh
$ setenv PYTHONPATH
$SYBASE/$SYBASE_OCS/python/python37_64r/lib
$ setenv PATH
/pse/hansenr/python37/bin:$PATH
$ cat firstapp.py
import sybpydb
conn =
sybpydb.connect(user='DBA', password='sql')
cur = conn.cursor()
cur.execute("select
* from mytable")
while True:
row = cur.fetchone()
if (not row):
break
print("%s: %s" % (row[0],
row[1]))
cur.close()
conn.close()
$ cat
$SYBASE/interfaces
ASE
query tcp ether ASEHOST ASEPORT
IQ
query tcp ether IQHOST IQPORT
isql -UDBA -Psql
-SIQ
1>create table
mytable (c1 int, c2 varchar(50))
2>go
1> insert into
mytable values (1, "test")
2> go
(1 row affected)
isql -Usa -Ppassword
-SASE
1> create table
mytable (c1 int, c2 varchar(50))
2> go
1> insert into
mytable values (2, "test2")
2> go
(1 row affected)
$ setenv DSQUERY ASE
$ python3
firstapp.py
2: test2
$ setenv DSQUERY IQ
Modify username and
password
$ python3
firstapp.py
1: test
Hope this helps,
Ryan
Hello ryan.hansen, Python 3.1 is pretty old and deprecated. 3.4 is better but still out of date 😞
Any chance to get a Python 3.7 compatible SAP SDK ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.