Google Cloud, Server For Database - python

I'm trying to use Google Cloud to store a MySQL database online which I can make requests to from my device in Python. I've established the connection with the database but I'm not sure where to go from here? Is it now 'saved' on the server, how would I go about accessing it from, say, a normal python module? Beginner in case it wasn't obvious.

Related

How do I route an ODBC connection through a Proxy to get around a company firewall? (Python)

I am trying to access an external Amazon Redshift DB. I am using psycopg2 to access the external postgres db. As far as I know, I cannot include a proxy list as a connection parameter. The below code works when I am not connected to my company VPN.
Is there a way to do this strictly in python? I will be running this code on an on-prem Caas/VM so I would like to avoid machine level solutions such as Putty.
I have tried setting http/https proxies explicitly within my python code but this does not solve my problem. Is this because they are only useful for web API requests?
Sample Code
I am open to using alternative libraries.

Pythonanywhere Database Configurations

I have a remote database server in godaddy. I want to use that for database connectivity for my Django Project. Because, I want to access the data stored in pythonanywhere database and it is said that, it is accessible unless you have the SSH keys which is provided only if you have paid account.
Is there a way to configure the settings.py database values to access it remotely from a java program?
Thank you!
First of all, are you trying to access GoDaddy database from within PythonAnywhere? (if so, you will have to deal with GoDaddy security restrictions/rules on their database) Or are you trying to access a PythonAnywhere database from GoDaddy/somewhere else? (In which case, you would have to deal with PythonAnywhere security rules- which means that you will have to use ssh tunnelling for this use case)
In any case, if the database you need to access is only available over ssh tunnelling, check out the sshtunnel python package.

How to connect my app with the database server

I made a program with using sqlite3 and pyqt modules. The program can be used by different persons simultaneously. Actually I searched but I did not know and understand the concept of server. How can i connect this program with a server. Or just the computers that have connections with the server is enough to run the program simultaneously?
Do u want to connect to sqlite database server? SQLite Is Serverless. It stores your data in a file.
U should use maria db for db server. Or u can store your sqlite database file in a network shared drive or cloud or...

How to efficiently save data to a remote server database (python)

Currently in my code, there are a few client machines doing processing and one server machine with a database. After an individual client machine finishes processing some data, it saves the data to a .txt file and sftp's it over to the server.
The server has a job that just waits for these txt files and stores the data into a database.
I wanted to know of any other efficient processes for this, kinda a python beginner. Is there a way to remotely save data into the database of the server? How to do so securely, etc?
To be more specific, this project is a webapp hosted in django. I know how to use django's standalone scripts to save data into a db, just preferably need to know how to do so remotely.
Thank you.
Django databases can be remote - there is no requirement they be on the same host at the django server. Just set an appropriate HOST and PORT. See: https://docs.djangoproject.com/en/dev/ref/databases/#id10
Update: Based on your comment, I understand that you want to write python/django code that will run in the browser, and connect to a remote database. There is no practical way of doing this. Have the data sent back to your server, and forward it on from there.
Update 2: If you are able to distribute software outside of the browser, you could have a small django deployment on each client computer, which the user connects to through their browser, which could connect directly to the database. Obviously, security considerations apply.

Using MongoLab Database service vs Custom web service with MongoDB running on AWS

I am looking for feasible solutions for my Application to be backed with MongoDB. I am looking to host the MongoDB on the cloud with a python based server to interact with the DB and my app (either mobile/web). I am trying to understand how the architecture should look like.
Either i can host a mongoDB on the AWS cloud and have the server running there only.
I also tried using MongoLab and seemed to be simple accessing it using HTTP requests. but i am not sure if it exposes all the essential features of MongoDB (what ever i can do using a pymongo driver)? Also, should i go for accessing the MongoLab service directly from my application or still i should build a server in-between?
I would prefer to building an server in either case as i want to do some processing before sending the data back to application. but i am not sure in that case how my DB-server-app interaction design should be
Any suggestions?
One thing to consider is that you don't need to use MongoLab's REST API. You can connect directly via a driver as well.
So, if you need to implement business logic (which it sounds like you do), it makes sense to have a three tier architecture with an app server connecting to your MongoLab database via one of the drivers. In your case it sounds like this would be pymongo.
-will

Categories