Skip to content

Commit 2c3d80d

Browse files
committed
Initial submission of sqlalchemy-sqlany files
1 parent 05fbe03 commit 2c3d80d

12 files changed

+1006
-8
lines changed

LICENSE

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Apache License
1+
2+
Apache License
23
Version 2.0, January 2004
34
http://www.apache.org/licenses/
45

@@ -178,15 +179,15 @@ Apache License
178179
APPENDIX: How to apply the Apache License to your work.
179180

180181
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "{}"
182+
boilerplate notice, with the fields enclosed by brackets "[]"
182183
replaced with your own identifying information. (Don't include
183184
the brackets!) The text should be enclosed in the appropriate
184185
comment syntax for the file format. We also recommend that a
185186
file or class name and description of purpose be included on the
186187
same "printed page" as the copyright notice for easier
187188
identification within third-party archives.
188189

189-
Copyright {yyyy} {name of copyright owner}
190+
Copyright [yyyy] [name of copyright owner]
190191

191192
Licensed under the Apache License, Version 2.0 (the "License");
192193
you may not use this file except in compliance with the License.
@@ -199,4 +200,3 @@ Apache License
199200
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200201
See the License for the specific language governing permissions and
201202
limitations under the License.
202-

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include LICENSE README.rst

README.md

-4
This file was deleted.

README.rst

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
.. ***************************************************************************
2+
.. Copyright (c) 2013 SAP AG or an SAP affiliate company. All rights reserved.
3+
.. ***************************************************************************
4+
5+
sqlalchemy-sqlany
6+
=================
7+
This project provides a SQLAlchemy dialect for communicating with a SQL Anywhere
8+
database server. It is built upon the Python SQL Anywhere Database Interface.
9+
10+
Requirements
11+
------------
12+
The following software is required to use the SQL Anywhere dialect for SQLAlchemy:
13+
14+
* SQL Anywhere 11.0.1 or higher
15+
* Python 2.4, 2.5, 2.6, or 2.7
16+
* The Python SQL Anywhere Database Interface version 1.0.4 or later
17+
* SQLAlchemy version 0.8.0 or higher
18+
19+
Installing the required software
20+
--------------------------------
21+
22+
The dialect uses the SQL Anywhere Python driver, which must also be installed.
23+
If you are using pip to install the sqlalchemy-sqlany dialect, you can skip
24+
this step since the SQL Anywhere Python driver will be installed as part of
25+
that step.
26+
27+
The SQL Anywhere Database Interface for Python provides a Database API v2
28+
compliant driver (see Python PEP 249) for accessing SQL Anywhere
29+
databases from Python. The SQL Anywhere backend for Django is built on
30+
top of this interface so installing it is required.
31+
32+
You can use pip to make this easy::
33+
34+
$ pip install sqlanydb
35+
36+
Alternatively, you can obtain the Python SQL Anywhere Database Interface
37+
from https://github.com/sqlanywhere/sqlanydb. Install the driver by
38+
downloading the source and running the following command::
39+
40+
$ python setup.py install
41+
42+
Installing the sqlalchemy-sqlany dialect
43+
----------------------------------------
44+
45+
Again, use pip to install this easily::
46+
47+
$ pip install sqlalchemy-sqlany
48+
49+
This will install the SQL Anywhere python driver if it was not already installed.
50+
51+
Or you can obtain the dialect from
52+
https://github.com/sqlanywhere/sqlalchemy-sqlany/. Install the dialect by
53+
downloading the source and running the following command::
54+
55+
$ python setup.py install
56+
57+
58+
Testing the dialect
59+
-------------------
60+
61+
Once the Python SQL Anywhere Database Interface driver and the sqlalchemy-sqlany
62+
dialect are installed, you can run the standard SQLAlchemy tests by executing::
63+
64+
$ python run_tests.py
65+
66+
License
67+
-------
68+
This package is licensed under the terms of the Apache License, Version 2.0. See
69+
the LICENSE file for details.
70+
71+
Feedback and Questions
72+
----------------------
73+
For feedback on this project, or for general questions about using SQL Anywhere
74+
please use the SQL Anywhere Forum at http://sqlanywhere-forum.sybase.com/

run_tests.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from sqlalchemy.dialects import registry
2+
registry.register('sqlalchemy_sqlany', 'sqlalchemy_sqlany.base', 'SQLAnyDialect')
3+
4+
from sqlalchemy.testing import runner
5+
6+
runner.main()

setup.cfg

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[nosetests]
2+
with-sqla_testing = true
3+
where = test
4+
cover-package = sqlalchemy_sqlany
5+
with-coverage = false
6+
cover-erase = false
7+
stop = false
8+
nocapture = true
9+
exclude=test_((float|numeric)_as|precision)_(float|decimal)
10+
11+
# Some numeric tests are excluded because of the way the SQL Anywhere python
12+
# driver retrieves floating point numbers. The values retrieved are correct, but
13+
# sometimes have more precision than the test expects.
14+
15+
[sqla_testing]
16+
requirement_cls=test.requirements:Requirements
17+
profile_file=.profiles.txt
18+
19+
[db]
20+
default=sqlalchemy_sqlany://dba:sql@localhost:2638/
21+
22+
[wheel]
23+
universal=1

setup.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import os,re
2+
from setuptools import setup, find_packages
3+
4+
with open( os.path.join( os.path.dirname(__file__), 'sqlalchemy_sqlany',
5+
'__init__.py' ) ) as v:
6+
VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
7+
8+
setup(
9+
name = 'sqlalchemy_sqlany'
10+
, version = VERSION
11+
, description='SAP Sybase SQL Anywhere dialect for SQLAlchemy'
12+
, long_description=open( 'README.rst' ).read()
13+
, keywords='SAP Sybase SQLAnywhere SQLAlchemy'
14+
, author='Graeme Perrow'
15+
, author_email='[email protected]'
16+
, install_requires=['sqlanydb >= 1.0.4']
17+
, packages = find_packages()
18+
, url='https://github.com/sqlanywhere/sqlalchemy-sqlany'
19+
, tests_require=['nose >= 0.11']
20+
, test_suite='nose.collector'
21+
, zip_safe = False
22+
, entry_points={
23+
'sqlalchemy.dialects': [
24+
'sqlalchemy_sqlany = sqlalchemy_sqlany:base.dialect'
25+
]
26+
}
27+
, license='Apache 2.0'
28+
, classifiers=[
29+
'Development Status :: 5 - Production/Stable',
30+
'Intended Audience :: Developers',
31+
'License :: OSI Approved :: Apache Software License',
32+
'Natural Language :: English',
33+
'Operating System :: OS Independent',
34+
'Programming Language :: Python :: 2',
35+
'Programming Language :: Python :: 2.4',
36+
'Programming Language :: Python :: 2.5',
37+
'Programming Language :: Python :: 2.6',
38+
'Programming Language :: Python :: 2.7',
39+
'Topic :: Database',
40+
'Topic :: Software Development :: Libraries :: Python Modules'
41+
]
42+
43+
)

sqlalchemy_sqlany/__init__.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2013 SAP AG or an SAP affiliate company.
2+
#
3+
4+
__version__ = '1.0.0'
5+
6+
from sqlalchemy_sqlany import base
7+
8+
# default dialect
9+
base.dialect = base.SQLAnyDialect
10+
11+
from base import CHAR, VARCHAR, TIME, NCHAR, NVARCHAR,\
12+
TEXT, DATE, DATETIME, FLOAT, NUMERIC,\
13+
BIGINT, INT, INTEGER, SMALLINT, BINARY,\
14+
VARBINARY, UNITEXT, UNICHAR, UNIVARCHAR,\
15+
IMAGE, BIT, MONEY, SMALLMONEY, TINYINT,\
16+
dialect
17+
18+
19+
__all__ = (
20+
'CHAR', 'VARCHAR', 'TIME', 'NCHAR', 'NVARCHAR',
21+
'TEXT', 'DATE', 'DATETIME', 'FLOAT', 'NUMERIC',
22+
'BIGINT', 'INT', 'INTEGER', 'SMALLINT', 'BINARY',
23+
'VARBINARY', 'UNITEXT', 'UNICHAR', 'UNIVARCHAR',
24+
'IMAGE', 'BIT', 'MONEY', 'SMALLMONEY', 'TINYINT',
25+
'dialect'
26+
)

0 commit comments

Comments
 (0)