matko commented on code in PR #1006: URL: https://github.com/apache/datafusion-python/pull/1006#discussion_r1935305016
########## src/options.rs: ########## @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use datafusion::{dataframe::DataFrameWriteOptions, logical_expr::dml::InsertOp}; +use pyo3::{exceptions::PyValueError, FromPyObject, PyErr, PyResult}; + +use crate::expr::sort_expr::{to_sort_expressions, PySortExpr}; + +#[derive(FromPyObject)] +#[pyo3(from_item_all)] +pub struct PyDataFrameWriteOptions { + insert_operation: Option<String>, Review Comment: Thanks for your comment. I did initially try to do this with an enum. Unfortunately, to use an enum in an object that derives `FromPyObject`, the enum itself has to also derive `FromPyObject`, but tagging a simple enum (no variants, just tags) with `#[derive(FromPyObject)]` results in `error: cannot derive FromPyObject for empty structs and variants`. So this errors: ```rust #[derive(FromPyObject)] pub enum PyInsertOperation { Insert, Overwrite, Replace, } ``` This might be where my pyo3 knowledge is lacking. Can you point me in the right direction on how to do this as an enum properly? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org