I am trying to create a datastream stream using the python client library:
stream = datastream_v1.Stream(
display_name="TEST_STREAM",
source_config=datastream_v1.SourceConfig(
source_connection_profile="projects/{PROJECT_NUMBER}/locations/europe-west9/connectionProfiles/{CONNECTION_PROFILE_NAME}",
mysql_source_config=datastream_v1.MysqlSourceConfig(
include_objects=datastream_v1.MysqlRdbms(
mysql_databases=[
datastream_v1.MysqlDatabase(
database="DB1",
mysql_tables=[
datastream_v1.MysqlTable(table="TABLE1")
],
)
]
)
),
),
destination_config=datastream_v1.DestinationConfig(
destination_connection_profile="projects/{PROJECT_NUMBER}/locations/europe-west9/connectionProfiles/{CONNECTION_PROFILE_NAME}",
gcs_destination_config=datastream_v1.GcsDestinationConfig(
file_rotation_mb=50,
file_rotation_interval=Duration(seconds=60),
json_file_format=datastream_v1.JsonFileFormat(
schema_file_format=datastream_v1.JsonFileFormat.SchemaFileFormat.NO_SCHEMA_FILE,
compression=datastream_v1.JsonFileFormat.JsonCompression.GZIP,
),
),
),
backfill_none=datastream_v1.Stream.BackfillNoneStrategy(),
)
request = datastream_v1.CreateStreamRequest(
parent=f"projects/{PROJECT_NAME}/locations/europe-west9",
stream_id="TEST_STREAM",
stream=stream,
validate_only=False,
)
response = self._client.create_stream(request=request)
print(response.result())
But when it runs it creates a stream without a name and in an “unspecified” state.
![]()
The response result printed above ends with:
File “/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/google/api_core/future/polling.py”, line 261, in result
raise self._exception
google.api_core.exceptions.FailedPrecondition: 400 We failed to execute the command. 9: We failed to execute the command.
Does anyone have any thoughts/advice on how I can approach this problem?