How can use Google App Engine with MS-SQL - python

I use
python 2.7
pyodbc module
google app engine 1.7.1
I can use pydobc with python but the Google App Engine can't load the module. I get a no module named pydobc error.
How can I fix this error or how can use MS-SQL database with my local Google App Engine.

The Google App Engine does not support access to your own SQL server, and does not support loading C-API libraries of your own.
You can use the Google Cloud SQL storage, which is implemented with MySQL databases, which you can access via their Cloud SQL API for Python.
Note that the rdbms module Google provides implements the PEP 249 Python database API 2.0 specification, just like the pyodbc module, so you should have no problems using it:
from google.appengine.api import rdbms
conn = rdbms.connect(instance=INSTANCE_NAME, database=DATABASE)
cursor = conn.cursor()
cursor.execute('SELECT * FROM sometable')

You could, at least in theory, replicate your data from the MS-SQL to the Google Cloud SQL database. It is possible create triggers in the MS-SQL database so that every transaction is reflected on your App Engine application via a REST API you will have to build.

Related

How to access Google Cloud SQL by Python in Google Compute Engine

I am new to programming and Google service. I have read this document and set up Cloud SQL access by IP address.
However for access from Python, the documentation is only for App Engine and using Proxy instead. How can I access from Python in Google Compute Engine? Thanks
Credit #Mangu
Depending upon the application and the requirements, you can configure to connect to the Cloud SQL from python in compute engine using external IP of the Cloud SQL instances or use Cloud SQL Proxy with python (The Cloud SQL Proxy is available only for Second Generation instances.)
Here is another complete example tutorial of using Cloud SQL with Python Bookshelf application.

How to create SQL Server on Azure Using Python SDK?

I want to create SQL Server and SQL Database using python sdk on Azure.
Does Azure Provides Support for that?
Azure support two ways for creating Azure SQL Database.
Using Azure Service Management(ASM) to create a classic SQL Database (REST API).
Using Azure Resource Manage(ARM) to create a SQL Database (REST API).
For the process of creating Azure SQL Database, you can refer to the document for C# SDK https://azure.microsoft.com/en-us/documentation/articles/sql-database-client-library/.
To create SQL Database using Python SDK, according to the api document, it seems to only support ASM mode, please see the sql database managementservice module at http://azure-sdk-for-python.readthedocs.org/en/latest/ref/azure.servicemanagement.sqldatabasemanagementservice.html?highlight=sql%20database.
If you want to create sql database via ARM mode, I think you can try to use the REST API Create or Update Database that need to be authenticated by using Python SDK for Resource Management Authentication.
You can check the python sdk for azure, I find that the azure.servicemanagement.sqldatabasemanagementservice module which provides the function to create a new SQL Server and SQL Database, please check the detail in this article. So the answer to your question would be yes. Hope this help you.

Can Django, Google App Engine and Postgres work together?

I'm trying to transfer an Openshift-hosted Django website to Google App Engine. I wanted to connect it to an existing PostgreSQL database. However, I found this in Google's documentation:
A small percentage of native C python modules, and subsets of native C python modules are not available with Google App Engine. The disabled modules fall in to the following categories: (...)
Please keep in mind that third party packages which use any of the above features will not function with Google App Engine (packages such as PostgreSQL, etc).
My local GAE server produced the following error:
ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2._psycopg
Further research seems to indicate that this error was raised due to the limitations of GAE, rather than due to a configuration error. Surely there must be some reasonable way to connect my Django website with the externally hosted PostgreSQL server. What are my options?
Edit: so to clarify, I think I need a pure-Python replacement for psycopg2 that works with Django. In other words, it should also implement a Django database backend I can use.
You might be able to use pg8000.

How to link NDB with Google App Engine?

I'm developing a storage system, and I'm using NDB Python Datastore.
I need to link it with the Database created in Google App Engine to store all the info I get there.
How can I achieve that?
In addition, I have not already create the database in Google App Engine, is it better to do in a terminal or using the Google Developers Console?

is it possible to use PyMongo in Google App Engine?

I'm trying to use a MongoDB Database from a Google App Engine service is that possible? How do I install the PyMongo driver on Google App Engine? Thanks
No, it is not possible. Read the Runtime Environment section. On App Engine you'll have to use the datastore, or a 'database service' you can access using HTTP calls.
You might want to check out TyphoonAE.
It's not possible because you don't have access to networks sockets in App Engine. As long as you cannot access the database via HTTP, it's impossible.
The new runtime environment section says:
an app cannot write data to the local file system or make arbitrary network connections.
I am not sure to which level this is still being enforced (seeing that it's 7 years since the question was asked and answered), but we at Tam have successfully used the PyMongo driver in the standard Google App Engine Python runtime without issues. We simply followed the official PyMongo tutorial and it worked out.

Categories