Twisted and connection to SQL Server - python

I have a Twisted application that runs in an x86 64bit machine with Win 2008 server.
It needs to be connected to a SQL Server database that runs in another machine (in a cloud actually but I have IP, port, db name, credentials).
Do I need to install anything more that Twisted to my machine?
And which API should be used?

twisted.enterprise.adbapi will help you use any DB-API 2.0 module without blocking. It gives you a non-blocking, Deferred-based API by running database operations in a thread pool. python-mssql appears to be a DB-API 2.0 compliant module for MSSQL (I've never used it myself though).

If you want to have portable mssql server library, you can try the module from www.pytds.com.
It works with 2.5+ and 3.1, have a good stored procedure support. It's api is more "functional", and has some good features you won't find anywhere else.

Related

CassandraDB and Python: using the UnixSocketEndPoint?

I'm using cassandradb with the datastax python driver on a linux system. Typically when using other databases, I've found that that on unix-compatible systems there's usually a way to establish a connection to the database via a unix socket, instead of using the loopback interface. By connecting via socket, you can bypass the OS networking stack altogether, and the result is usually better performance.
I'm pretty sure that cassandra supports this, not in the least because there is a UnixSocketEndPoint class in the cassandra.connection module of the cassandra pip package. This class is implemented in the github repo, but there's no documentation whatsoever about how to use it. Is anybody using this? How do I go about configuring a unix-socket connection to cassandra with the python API?
I've managed to find the following code snippet, from the cassandra python driver tests on github:
lbp = UnixSocketWhiteListRoundRobinPolicy([UNIX_SOCKET_PATH])
ep = ExecutionProfile(load_balancing_policy=lbp)
endpoint = UnixSocketEndPoint(UNIX_SOCKET_PATH)
cls.cluster = TestCluster(contact_points=[endpoint], execution_profiles={EXEC_PROFILE_DEFAULT: ep})
Which actually is most of what I'm looking for. I'm just confused about how to configure cassandra to listen via socket instead of TCP. Or does cassandra have a default socket path?
Many thanks in advance.

Firebird x32-x64 bits

I have developed a Python executable programm (with PyInstaller).
This executable use Firebird.
My computer is 64bits, so as my Python and my libraires then.
My executable works perfectly with Firebird 64bits.
The issue is that I want my executable to work on other computers that have only Firebird 32bits installed.
For now, when I try on an other computers the log tells me that (Sorry I have only the picture because my client only send me this and not the 'text' error) :
Is there a way to make it work with Firebird x32 ?
Thanks
You application need client libraries of Firebird.
[Application] <--> [Firebird client libraries] <==> (local or remote connection) <==> [Firebird client libraries] <-> [Firebird server]
If your application is Win64, then it needs Win64 client libraries of Firebird to make connection to ANY Firebird server.
So you need to distribute and install client libraries of Firebird matching your application architecture together with your app. Or you may require users to download and install client part of Firebird with the required architecture, before installing your app.
See also:
connecting to firebird server from client
https://firebirdsql.org/manual/qsg10-client-only-install.html
https://firebirdsql.org/file/documentation/reference_manuals/driver_manuals/odbc/html/fbodbc205-download-fbclient.html
https://firebirdsql.org/file/documentation/reference_manuals/user_manuals/html/qsg3-installing.html
If your app is 32bit than you need 32bit fb client dll/so to load, even on 64bit platform. You can connect on any compatible fbserver(regardless 64 or 32bit). So fb client lib(dll) issues are those you need to resolve. If you use fb as embedded library you need only one dll, and it must be compatible with your app binary interface and on 32bit system you need 32bit fbclient.dll to load. I hope this helps.

Encrypted database connection from SQLAlchemy

What are the steps required to configure SQLAlchemy with SSL support on RedHat Linux so I can connect to a MS SQL Server instance that requires an encrypted connection?
If you really want to use pymssql (as suggested by the tag on your question) then you'll need to build it from source in order for it to support SSL connections. The process will be similar to the one described in the answers to this question.
Alternatively, you may find it easier to use pyodbc along with Microsoft's SQL Server ODBC Driver for Linux.

pymssql: How to use windows authentication when running on a non-windows box

Is there a way for python to connect to MS SQL Server using Windows Authentication, even when not running the python app on a windows box?
I'm trying to do this with pymssql, but the examples mostly seem to assume that you're running on windows.
If there is a way to make this connection using some other library, please feel free to suggest, but I do like how pymssql is simple to install and deploy via pip.
I want to connect to 2005/2008 databases, and I'm running Ubuntu 13.04 (but I can upgrade to a later Ubuntu if it makes a difference)
SOLUTION:
It turns out that pymssql can connect to my database via my windows username and password. But to do so, I need to pass the actual username/password like this:
pymssql.connect(host, 'THEDOMAIN\\theusername', 'thepassword', db)
The solution EkoostikMartin provided is still good though (if you do not want to store a password somewhere, which is probably the point to windows auth anyway)
You can use the SQL Server ODBC driver for linux, and set up Kerberos.
See this article - http://technet.microsoft.com/en-us/library/hh568450.aspx

Install MYSQLdb python module without MYSQL local install

I'm trying to install MYSQLdb on a windows client. The goal is, from the Windows client, run a python script that connects to a MySQL server on a LINUX client. Looking at the setup code (and based on the errors I am getting when I try to run setup.py for mysqldb, it appears that I have to have my own version of MySQL on the windows box. Is there a way (perhaps another module) that will let me accomplish this? I need to have people on multiple boxes run a script that will interact with a MySQL database on a central server.
you could use a pure python implementation of the mysql client like
pymysql
(can be used as a dropin-replacement for MySQLdb by calling pymysql.install_as_MySQLdb())
MySql-Connector
You don't need the entire MySQL database server, only the MySQL client libraries.
It's been a long time since I wrote python db code for windows...but I think something like this should still work.
If you're running the client only on windows machines, install the pywin32 package. This should have an odbc module in it.
Using the windows control / management tools, create an odbc entry for either the user or the system. In that entry, you'll give the connection parameter set a unique name, then select the driver (in this case MySQL), and populate the connection parameters (e.g. host name, etc.) See PyWin32 Documentation for some notes on the odbc module in pywin32.
Also, see this post: Common ways to connect to odbc from python on windows.

Categories

Resources