Google Certified Professional Data Engineer

Sign Up Free or Log In to participate!

Demo: Stream Data through Cloud Pub/Sub to BigQuery – “Error: Instance of ‘PublisherClient’ has no ‘topic_path’ member”

Below is the code for the transactions/py file I am using and it results in error "Error: Instance of ‘PublisherClient’ has no ‘topic_path’ member"

import json

import csv

from google.cloud import pubsub_v1

project_name = ‘cmrinal_Sandbox’

topic_name = ‘purchases’

file = ‘MOCK_DATA.csv’

publisher = pubsub_v1.PublisherClient()

topic_path = publisher.topic_path(project_name, topic_name)

with open(file) as fh:

rd = csv.DictReader(fh, delimiter=’,’)

for row in rd:

data = json.dumps(dict(row))

publisher.publish(topic_path, data=data.encode(‘utf-8’))

1 Answers

I used pubsub instead of pubsub_v1 and it is working fine

Sarveswara Rao Gudla

Hi Louis, Even I have changed to pubsub instead ofpubsub_v1, I am getting this error "Instance of ‘PublisherClient’ has no ‘topic_path’ memberpylint(no-member)"

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?