From the course: Data Science on Google Cloud Platform: Building Data Pipelines

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Python SDK

Python SDK

- In this video, I will show you how to build a publisher and subscriber, using python, and show them running side by side. Make sure that the Pub/Sub API has already been turned on in the APIs list. Next, go to Pub/Sub page, and note down the full path of the topic name, as well as the subscriber name, and you will need to use them later in your code. We now need to set up python. We have already created virtual environments, so we're gonna use them, and before you run this command, you want to activate the virtual environment, also. Then install Pub/Sub library, using the following command 'pip install --upgrade google-cloud-pubsub' Please note that installing Google Cloud Pub/Sub and Google Cloud data flow, in the same environment, might cause issues with libraries, so I recommend you install them on totally different VMs. Let's run this command, and now you will have the Pub/Sub library installed for you. Let us now look at the sample code for publishing data from python. So this…

Contents