Python sql anywhere connect

sqlalchemy-sqlany 1.0.4

This project provides a SQLAlchemy dialect for communicating with a SQL Anywhere database server. It is built upon the Python SQL Anywhere Database Interface.

Requirements

The following software is required to use the SQL Anywhere dialect for SQLAlchemy:

  • SQL Anywhere 11.0.1 or higher
  • Python 2.4, 2.5, 2.6, 2.7, or 3.4
  • The Python SQL Anywhere Database Interface version 1.0.6 or later
  • SQLAlchemy version 0.8.0 or higher

Installing the required software

The dialect uses the SQL Anywhere Python driver, which must also be installed. If you are using pip to install the sqlalchemy-sqlany dialect, you can skip this step since the SQL Anywhere Python driver will be installed as part of that step.

The SQL Anywhere Database Interface for Python provides a Database API v2 compliant driver (see Python PEP 249) for accessing SQL Anywhere databases from Python. The SQL Anywhere backend for Django is built on top of this interface so installing it is required.

You can use pip to make this easy:

Alternatively, you can obtain the Python SQL Anywhere Database Interface from https://github.com/sqlanywhere/sqlanydb. Install the driver by downloading the source and running the following command:

Installing the sqlalchemy-sqlany dialect

Again, use pip to install this easily:

$ pip install sqlalchemy-sqlany

This will install the SQL Anywhere python driver if it was not already installed.

Читайте также:  Кнопка php с ссылкой

Or you can obtain the dialect from https://github.com/sqlanywhere/sqlalchemy-sqlany/. Install the dialect by downloading the source and running the following command:

Testing the dialect

Once the Python SQL Anywhere Database Interface driver and the sqlalchemy-sqlany dialect are installed, you can run the standard SQLAlchemy tests by following the following instructions:

  1. Create an empty database.
  2. Start a SQL Anywhere server on that database. Make sure the server is listening for TCP/IP connections on the default port (2638) using -x “tcpip(port=2638)”.
  3. Execute

License

This package is licensed under the terms of the Apache License, Version 2.0. See the LICENSE file for details.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

SQLAlchemy driver for SAP Sybase SQL Anywhere

License

sqlanywhere/sqlalchemy-sqlany

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.rst

This project provides a SQLAlchemy dialect for communicating with a SQL Anywhere database server. It is built upon the Python SQL Anywhere Database Interface.

The following software is required to use the SQL Anywhere dialect for SQLAlchemy:

  • SQL Anywhere 11.0.1 or higher
  • Python 2.4, 2.5, 2.6, 2.7, or 3.4
  • The Python SQL Anywhere Database Interface version 1.0.6 or later
  • SQLAlchemy version 0.8.0 or higher

Installing the required software

The dialect uses the SQL Anywhere Python driver, which must also be installed. If you are using pip to install the sqlalchemy-sqlany dialect, you can skip this step since the SQL Anywhere Python driver will be installed as part of that step.

The SQL Anywhere Database Interface for Python provides a Database API v2 compliant driver (see Python PEP 249) for accessing SQL Anywhere databases from Python. The SQL Anywhere backend for Django is built on top of this interface so installing it is required.

You can use pip to make this easy:

Alternatively, you can obtain the Python SQL Anywhere Database Interface from https://github.com/sqlanywhere/sqlanydb. Install the driver by downloading the source and running the following command:

Installing the sqlalchemy-sqlany dialect

Again, use pip to install this easily:

$ pip install sqlalchemy-sqlany

This will install the SQL Anywhere python driver if it was not already installed.

Or you can obtain the dialect from https://github.com/sqlanywhere/sqlalchemy-sqlany/. Install the dialect by downloading the source and running the following command:

Once the Python SQL Anywhere Database Interface driver and the sqlalchemy-sqlany dialect are installed, you can run the standard SQLAlchemy tests by following the following instructions:

  1. Create an empty database.
  2. Start a SQL Anywhere server on that database. Make sure the server is listening for TCP/IP connections on the default port (2638) using -x «tcpip(port=2638)».
  3. Execute

This package is licensed under the terms of the Apache License, Version 2.0. See the LICENSE file for details.

For feedback on this project, or for general questions about using SQL Anywhere please use the SQL Anywhere Forum at http://sqlanywhere-forum.sap.com/

About

SQLAlchemy driver for SAP Sybase SQL Anywhere

Источник

connecting to SQL17 from python

File «C:\Python38\lib\site-packages\sqlanydb.py», line 522, in connect

File «C:\Python38\lib\site-packages\sqlanydb.py», line 538, in init parent = Connection.cls_parent = Root(«PYTHON»)

self.api = load_library(os.getenv( ‘SQLANY_API_DLL’, None ), ‘dbcapi.dll’, ‘libdbcapi_r.so’,

raise InterfaceError(«Could not load dbcapi. Tried: » + ‘,’.join(map(str, names))) sqlanydb.InterfaceError: (‘Could not load dbcapi. Tried: None,dbcapi.dll,libdbcapi_r.so,libdbcapi_r.dylib’, 0)

asked 05 Oct ’20, 14:31

Baron
1.9k ● 124 ● 135 ● 159
accept rate: 46%

Can you simply tell us, what answer you have found, and what you have tried before you raised the question?

Thanks for the reply, yes Google didn’t help me before raising the question:

I reinstalled my SQLAnywhere17, and now I have both 32/64, and I see the file dbcapi.dll is located under C:\Program Files (x86)\SQL Anywhere 17\BIN32, but I still get the same error

Well, when your are running on Windows, links to Unix issues (like «sourcing» scripts) won’t help, methinks.

Have you followed these steps, and have they proved successful?

Yes, I did the steps before.

import ctypes doesn’t return any error.

I installed sqlanydb using pip install sqlanydb

@vlad does it work on your windows machine?

«Now it works with the help of PYODBC». here’s how to do a DSN-less connection. Not too hard.

Assume> dbsrv17 -n demo17 «C:\Users\Public\Documents\SQL Anywhere 17\Samples\demo.db» -n demo

. Code starts. import pyodbc connection_string = "Driver=SQL Anywhere 17;Server=demo17;UID=dba;PWD=sql;DBN=demo" connection_object = pyodbc.connect(connection_string) cursor = connection_object.cursor() sql_string = "select count(*) from Employees" result = cursor.execute(sql_string) counter = result.fetchone()[0] print(counter) connection_object.close() . Code ends

BTW how do you put a code block in these answer boxes? I tried pre and code tags as per help and it previewed OK but when posted looked horrid. I then had to cut out all my enlightning comments!

answered 10 Oct ’20, 19:31

Источник

Оцените статью