lakeFS
lakeFS copied to clipboard
[Bug]: Can't pass `read_only` to the Python wrapper's repository creation API
What happened?
The Python wrapper is not familiar with the read_only
optional argument that can be passed to the createRepository
API (this is the operation id in swagger.yml
).
Steps to Reproduce:
- Write a Python file:
import lakefs
from lakefs.client import Client
clt = Client(
username="<username>",
password="<password>",
host="<host>",
)
repo = lakefs.Repository(repository_id="<repo id>", client=clt).create(
storage_namespace="<namespace>",
read_only=True,
)
- Run it:
python <filename>.py
- Expect the following result:
...
raise ApiTypeError(
lakefs_sdk.exceptions.ApiTypeError: Got an unexpected keyword argument 'read_only' to method create_repository
Expected behavior
This should work. For example, the following equivalent code works using the Rust client:
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = Configuration {
base_path: "<url>".to_string(),
basic_auth: Some((
"<user>".to_string(),
Some("<password>".to_string()),
)),
..Configuration::default()
};
lakefs_sdk::apis::repositories_api::create_repository(
&config,
RepositoryCreation {
name: "<repo>".to_string(),
storage_namespace: "<namespace>"
.to_string(),
read_only: Some(true),
..RepositoryCreation::default()
},
None,
)
.await
.context("creating repo")?;
Ok(())
}
lakeFS version
No response
How lakeFS is installed
No response
Affected clients
No response
Relevant log output
Here's the full error produced by the Python code:
File "/home/<user>/workspace/playground/lakefs-rs-pg/../pg.py", line 9, in <module>
repo = lakefs.Repository(repository_id="<repo>", client=clt).create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/lakefs/repository.py", line 65, in create
repo = self._client.sdk_client.repositories_api.create_repository(repository_creation, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/pydantic/v1/decorator.py", line 40, in wrapper_function
return vd.call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/pydantic/v1/decorator.py", line 134, in call
return self.execute(m)
^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/pydantic/v1/decorator.py", line 206, in execute
return self.raw_function(**d, **var_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/lakefs_sdk/api/repositories_api.py", line 91, in create_repository
return self.create_repository_with_http_info(repository_creation, bare, **kwargs) # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/pydantic/v1/decorator.py", line 40, in wrapper_function
return vd.call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/pydantic/v1/decorator.py", line 134, in call
return self.execute(m)
^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/pydantic/v1/decorator.py", line 206, in execute
return self.raw_function(**d, **var_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/<user>/workspace/playground/venv/lib/python3.11/site-packages/lakefs_sdk/api/repositories_api.py", line 153, in create_repository_with_http_info
raise ApiTypeError(
lakefs_sdk.exceptions.ApiTypeError: Got an unexpected keyword argument 'read_only' to method create_repository
### Contact details
_No response_