What is the recommended async Oracle driver for SQLAlchemy 2.0? - python

We are developing an asynchronous Python-based server using SQLAlchemy 2. So far, asynchronous access to PostgreSQL, MySQL and SQLite work fine. However, we cannot find an async driver for Oracle.

The async driver for Oracle Database is under development. You can follow discussion at https://github.com/oracle/python-oracledb/issues/6

Related

"python manage.py dbshell" for other DB Command-Line Clients (Django)

I read the documentation about "dbshell".
Then, it says:
Runs the command-line client for the database engine specified in your
ENGINE setting, with the connection parameters specified in your USER,
PASSWORD, etc., settings.
For PostgreSQL, this runs the psql command-line client.
For MySQL, this runs the mysql command-line client.
For SQLite, this runs the sqlite3 command-line client.
For Oracle, this runs the sqlplus command-line client.
So, as the documentation says, with the command below, it's possible to run(open) DB Command-Line Clients for PostgreSQL, MySQL, SQLite and Oracle:
python manage.py dbshell
My question:
With the command below, is it possible to run(open) DB Command-Line Clients for other databases such as MSSQL(SQL Server), MongoDB, etc?
python manage.py dbshell
No. At this moment (24th June, 2022) django doesn't support any other database backend. The source code has only backend for PostgreSQL, MySQL, SQLite and Oracle.
However, there is a MSSQL backend from Microsoft. It has all the bells and whistles.
For MongoDB, I haven't seen any backend that implemented client.py. You might want to request a feature to this project.
As far as I know, Yes, it's possible to run(open) the DB Command-Line Client for MSSQL(SQL Server) when connecting Django and MSSQL with mssql-django.
This is the MSSQL Command-Line Client as shown below:

How to configure Apache Airflow to work with MS SQL Server Windows Authentication

How do I connect MS SQL Server using Windows Authentication using Airflow Web UI or modifying existing SQLAlchemy/pymssql Python modules?
I have SQL Server SSIS packages which can't use this option https://joethebusinessintelligenceguy.wordpress.com/2013/08/14/ssis-2012-using-sql-authentication-with-dont-save-sensitive-successfully/) hence I'm trying to start the SSIS steps by using Windows Authentication.
I have found following links showing that support indeed exists but I don't know how to implement the same on Airflow -installation (which file to modify or where to create new conn_id).
How do I connect to SQL Server via sqlalchemy using Windows Authentication?
Connecting to MS SQL Server with Windows Authentication using Python?
https://www.mail-archive.com/sqlalchemy#googlegroups.com/msg13620.html
To use Windows Authentication, the Apache Airflow will need same windows access that your Sql Server, and that's strongly not recommended.
So probably is better use an User and Password to Connect your SqlDatabase.
Apache Airflow does it have an info in your documentation to make connections in SQL SERVER in this link

How to config Django using pymysql as driver?

I'm new to Django. It wasted me whole afternoon to config the MySQL engine. I am very confused about the database engine and the database driver. Is the engine also the driver? All the tutorial said that the ENGINE should be 'django.db.backends.mysql', but how the ENGINE decide which driver is used to connect MySQL?
Every time it says 'django.db.backends.mysql', sadly I can't install MySQLDb and mysqlclient, but PyMysql and the official mysql connector 2.1.3 has been installed. How could I set the driver to PyMysql or mysql connector?
Many thanks!
OS: OS X Al Capitan
Python: 3.5
Django: 1.9
This question is not yet solved:
Is the ENGINE also the DRIVER?
You can import pymsql so it presents as MySQLdb. You'll need to do this before any django code is run, so put this in your manage.py file
import pymysql
pymysql.install_as_MySQLdb()
The short answer is no they are not the same.
The engine, in a Django context, is in reference to RDBMS technology. The driver is the library developed to facilitate communication to that actual technology when up and running. Letting Django know what engine to use tells it how to translate the ORM functions from a backend perspective. The developer doesn't see a change in ORM code but Django will know how to convert those actions to a language the technology understands. The driver then takes those actions (e.g. selects, updates, deletes) and sends them over to a running instance to facilitate the action.

Is there official MySQL driver for Tornado Framework?

I'm on the point of architecting some socket-based API and i run into problem.
Is there are officially supported MySQL driver for Tornado Framework? I wood use cool and modern async from Python 3.4, but this one don't support MySQL for sure.
And yes, i'm notice couple drivers in https://github.com/tornadoweb/tornado/wiki/Links, but my problem is - this drivers is kind a old and they don't support Python 3.
Thanks!
You can refer to these links. this is git hub link of PyMySQL fork for Tornado: https://github.com/PyMySQL/Tornado-MySQL
this link is a short doc for MySQLdb DB-API connections: https://tornado.readthedocs.org/en/branch2.4/database.html
you can find the supported python version in this link: https://pypi.python.org/pypi/Tornado-MySQL
as mentioned in the comments you can also see MySQL driver for asyncio: https://github.com/aio-libs/aiomysql , http://aiomysql.readthedocs.org/en/latest/

Python & sql server

What is the best way to access sql server from python is it DB-API ?
Also could someone provide a such code using the DB-API how to connect to sql server from python and excute query ?
See pyodbc - Python Database API Specification v2.0 implementation. Works great.
Additionally you can use it with other databases. If using with SQL Server 2008, make sure you use Native Driver if you need to support new DATE data types.
See pymssql It is a DB-API module for MS Sql Server and would be the most pythonic way. The documentation includes examples.
If on a Windows OS you could also use OLEDB through COM which will not require any thing else to be installed on the client.
Also if you use Iron Python you can use the .Net APIs
Also could someone provide a such code using the DB-API
how to connect to sql server from python and excute query ?
This hello world snippet pretty much shows you the common way how to connect with SQL server in Python with an DBI 2.0 database interface module.
Disclaimer: I'm the developer of pypyodbc
ODBC + freetds + a python wrapper library for ODBC.

Categories

Resources