Conversation
python/tests/test_wireframes.py
Outdated
| "auto.offset.reset": "earliest", | ||
| } | ||
|
|
||
| kafka_format = JSONFormat().with_update_format(UpdateFormat.InsertDelete).with_array(False) |
There was a problem hiding this comment.
It could also be a class with default values for its instantiation JSONFormat(update_format=UpdateFormat.Raw, array=False), and then the user supplies arguments to change any of the defaults. Either works though.
There was a problem hiding this comment.
I am split between having a default and requiring explicit configuration.
Having a default might mean that people just use the default and might have issues when the format doesn't match the data.
There was a problem hiding this comment.
Better to not have defaults for this, given we don't have data on what the typical format might be.
|
This is a user-facing change and needs a changelog. |
| :param table_name: The name of the table. | ||
| :param connector_name: The unique name for this connector. | ||
| :param config: The configuration for the kafka connector. | ||
| :param fmt: The format of the data in the kafka topic. |
There was a problem hiding this comment.
can you provide a reference to the format descriptions?
There was a problem hiding this comment.
Format takes an instance of JSONFormat or CSVFormat.
python/feldera/sql_context.py
Outdated
| fmt = fmt.to_dict() | ||
|
|
||
| if fmt.get("config").get("update_format") is None: | ||
| raise ValueError("update_format not set in the format config try using method: .with_update_format()") |
python/feldera/sql_context.py
Outdated
| """ | ||
| Tells Feldera to write the data to the specified kafka topic. | ||
|
|
||
| :param view_name: The name of the view whose output is sent to kafka topic. |
There was a problem hiding this comment.
it is really the view changes that are sent
python/tests/test_wireframes.py
Outdated
| ]) | ||
| print("Topics ready") | ||
|
|
||
| # Produce of rows into the input topic |
| sql.connect_source_kafka(TABLE_NAME, "kafka_conn_in", source_config, kafka_format) | ||
| sql.connect_sink_kafka(VIEW_NAME, "kafka_conn_out", sink_config, kafka_format) | ||
|
|
||
| out = sql.listen(VIEW_NAME) |
There was a problem hiding this comment.
why so many empty lines?
python/feldera/formats.py
Outdated
|
|
||
| InsertDelete = 1 | ||
| """ | ||
| InsertDelete: When used, the data is inside a key either "insert" or "delete". This is used to represent changes. |
There was a problem hiding this comment.
I have trouble parsing this phrase
There was a problem hiding this comment.
Me too. I am not sure how to word this properly.
python/feldera/formats.py
Outdated
|
|
||
| InsertDelete = 1 | ||
| """ | ||
| This is a way to represented changes in the data. |
python/feldera/formats.py
Outdated
| InsertDelete = 1 | ||
| """ | ||
| This is a way to represented changes in the data. | ||
| When used, the actual JSON data is expected to be inside one of the keys "insert" or "delete". |
There was a problem hiding this comment.
I think that the example is clearer than this text, which can be removed.
There was a problem hiding this comment.
just explain that 'id' and 'name' below are the columns of the table where the insertion and deletion happen.
python/feldera/formats.py
Outdated
|
|
||
| Raw = 2 | ||
| """ | ||
| This format represents an individual row in a SQL table or view. |
There was a problem hiding this comment.
It is really the same as an insertion, I presume
python/docs/examples.rst
Outdated
| To setup Kafka as the source use :meth:`.SQLContext.connect_source_kafka` and as the sink use | ||
| :meth:`.SQLContext.connect_sink_kafka`. | ||
|
|
||
| Both of these methods require a ``config`` which is a key-value pair. |
There was a problem hiding this comment.
| Both of these methods require a ``config`` which is a key-value pair. | |
| Both of these methods require a ``config`` which is a dictionary. |
python/docs/examples.rst
Outdated
| "auto.offset.reset": "earliest", | ||
| } | ||
|
|
||
| kafka_format = JSONFormat().with_update_format(UpdateFormat.InsertDelete).with_array(False) |
There was a problem hiding this comment.
| kafka_format = JSONFormat().with_update_format(UpdateFormat.InsertDelete).with_array(False) | |
| format = JSONFormat().with_update_format(UpdateFormat.InsertDelete).with_array(False) |
python/docs/examples.rst
Outdated
| "auto.offset.reset": "earliest", | ||
| } | ||
|
|
||
| kafka_format = JSONFormat().with_update_format(UpdateFormat.InsertDelete).with_array(False) |
There was a problem hiding this comment.
Mention that in addition to Kafka config, the Kafka connector also requires data format config and point to data format docs.
python/feldera/formats.py
Outdated
| "array": False, | ||
| } | ||
|
|
||
| def with_update_format(self, update_format: UpdateFormat) -> Self: |
|
Please also add links to Python docs from connector documentation pages (maybe it has to be a separate PR). |
* also rename `Client` to `FelderaClient` Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com> py: update the kafka test Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com> py: update documentation * include an example for Kafka connector in the python docs * refactor `Client` to `FelderaClient` * add an entry in the changelog Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com> py: update documentation Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
* py: HTTP GET input connector Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com> * py: refactor: common function to check format to create connector Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com> * py: update docs, rename `UpdateFormat` to `JSONUpdateFormat` Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com> --------- Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
ClienttoFelderaClientIs this a user-visible change (yes/no): yes
In a follow up PR, add builders for Connectors.