1

I want to write a GAE application that gets the data fom my MSSQL server, that will be converted and stored in GAEs cloud db, and used for some other processes.

Is there any possibility for that? I could not find any info about connecting form gae to mssql and query data.

I found Bulk Loader but dont think it has any use for me. And also this page killed my hopes about this, looks like it has no windows support.

Sarge
  • 388
  • 1
  • 4
  • 22
  • I am not familiar with GAE, but to work with python and sql-server take a look at the pymssql library: https://code.google.com/p/pymssql/ To install in a Windows environment: http://stackoverflow.com/questions/4666290/how-to-install-pymssql-on-windows-with-python-2-7 – Miquel Aug 29 '13 at 09:44
  • One approach is use the remote_api shell, the script run on your local environment in can connect to your local mysql server and to the remote appengine datastore at the same time. However you are asking fairly basic questions which suggests you need to do some reading before embarking on anything. – Tim Hoffman Aug 29 '13 at 09:57
  • Dear, @TimHoffman remote_api shell is not the solution I am looking for. I have no issue with manipulating GAE datastore from my local enviroment using python scripts. The thing is I want to connect mysql server **over my GAE application**, and retrieve data from it to store in datastore. If remote_api shell has that ability and i missed it while I was doing my readings, I would like you to guide me a little more. It has been just 2 days I started using GAE, I have read a lot and still learning. Let me ask some questions where I stuck and save your judgements.I am no pro yet. – Sarge Aug 29 '13 at 10:52
  • I don't believe you'll have access to do this, plus your database access rights would have to be wide open world-wide based on which instance of your GAE app is trying to connect to the database. The only way I was able to access remote databases was by putting a REST interface in front of it and using the remote api access tools, but you only get so many of those per day before you start in curring billing. – iandouglas Aug 31 '13 at 01:20

1 Answers1

1

I used pyodbc to connect my MSSQL server, using this code lines;

con = pyodbc.connect("DRIVER={SQL Server}; SERVER=my_server_ip; DATABASE=db_name; UID=user_id; PWD=password; CHARSET=UNICODE")
cur = con.cursor()

(First I wrote some more code to convert database tables into CSV files then uploaded them.)

Afterwards I used bulkloader to upload and download from tables. Bulkloader documentation is lack of examples tho. I wrote this code to upload and download via os library that provides dos commands to work in script. Provided CSV files to upload from the file I stored them after conversion.

Upload:

os.system("appcfg.py upload_data --config_file=bulkloader.yaml --log_file=/logs --url=http://my_app_name.appspot.com/_ah/remote_api --kind=kind --filename=CSV_files/table_name.csv --email=my_email_adress)

Download:

os.system("bulkloader.py --download --config_file=bulkloader.yaml --kind=kind --url=http://my_app_name.appspot.com/_ah/remote_api --filename=CSV_files/table_name.csv")
Sarge
  • 388
  • 1
  • 4
  • 22