Title: Class-typed fields are required when inserting a new document · Issue #1851 · docarray/docarray · GitHub
Open Graph Title: Class-typed fields are required when inserting a new document · Issue #1851 · docarray/docarray
X Title: Class-typed fields are required when inserting a new document · Issue #1851 · docarray/docarray
Description: Initial Checks I have read and followed the docs and still think this is a bug Description I have this dataclass: class QuoteFile(BaseDoc): quote_file_id: int = None extracted_data: Optional[ExtractedDocumentData] = None When indexing a ...
Open Graph Description: Initial Checks I have read and followed the docs and still think this is a bug Description I have this dataclass: class QuoteFile(BaseDoc): quote_file_id: int = None extracted_data: Optional[Extrac...
X Description: Initial Checks I have read and followed the docs and still think this is a bug Description I have this dataclass: class QuoteFile(BaseDoc): quote_file_id: int = None extracted_data: Optional[Extrac...
Opengraph URL: https://github.com/docarray/docarray/issues/1851
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Class-typed fields are required when inserting a new document","articleBody":"### Initial Checks\n\n- [X] I have read and followed [the docs](https://docs.docarray.org/) and still think this is a bug\n\n### Description\n\nI have this dataclass:\r\n```python\r\nclass QuoteFile(BaseDoc):\r\n quote_file_id: int = None\r\n extracted_data: Optional[ExtractedDocumentData] = None\r\n```\r\n\r\nWhen indexing a new document, `extracted_data` is always required no matter what I do (type it with `Optional` etc). This is especially caused by `BaseDocIndex._get_values_by_column()`. \r\n\r\nI have finally forked `docarray`, will send a PR for various minor fixes like this one:\r\n\r\n\u003cimg width=\"729\" alt=\"image\" src=\"https://github.com/docarray/docarray/assets/656635/3c97aebf-a386-4cda-ada1-959b3a5a8fe9\"\u003e\r\n\r\nYou can see my changes here, the highlighted line returns None when the field object is optional and not given for a new document during indexing.\n\n### Example Code\n\n_No response_\n\n### Python, DocArray \u0026 OS Version\n\n```Text\nPython 3.8.12\r\ndocarray==0.40.0\n```\n\n\n### Affected Components\n\n- [X] [Vector Database / Index](https://docs.docarray.org/user_guide/storing/docindex/)\n- [ ] [Representing](https://docs.docarray.org/user_guide/representing/first_step)\n- [ ] [Sending](https://docs.docarray.org/user_guide/sending/first_step/)\n- [X] [storing](https://docs.docarray.org/user_guide/storing/first_step/)\n- [ ] [multi modal data type](https://docs.docarray.org/data_types/first_steps/)","author":{"url":"https://github.com/oytuntez","@type":"Person","name":"oytuntez"},"datePublished":"2024-02-08T14:42:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1851/docarray/issues/1851"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:28483661-00d3-0879-bb5f-aa22e4c0a4ea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D906:4D4DF:C62265:10495F7:6982D72F |
| html-safe-nonce | de5c5992e20b63dd36d8acc275436937fcd2e94949c1a6285f14ddb483f335bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTA2OjRENERGOkM2MjI2NToxMDQ5NUY3OjY5ODJENzJGIiwidmlzaXRvcl9pZCI6IjkxMTgxMTg4ODcxNjkzODIxOTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3c3768e9101b5dd5f32626cefbdecc2e480ba61a0aeba29dba0c3fe72439282e |
| hovercard-subject-tag | issue:2125341192 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/docarray/docarray/1851/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f399d35d69707575a2e867a8ee5170f1171a5cf7002d803ef698182a75442a5/docarray/docarray/issues/1851 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f399d35d69707575a2e867a8ee5170f1171a5cf7002d803ef698182a75442a5/docarray/docarray/issues/1851 |
| og:image:alt | Initial Checks I have read and followed the docs and still think this is a bug Description I have this dataclass: class QuoteFile(BaseDoc): quote_file_id: int = None extracted_data: Optional[Extrac... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | oytuntez |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6741528aa4d4ba81c57bbff8f8cc0de0e9115cb2993431dc9dac8d489f7b4ee |
| turbo-cache-control | no-preview |
| go-import | github.com/docarray/docarray git https://github.com/docarray/docarray.git |
| octolytics-dimension-user_id | 117445116 |
| octolytics-dimension-user_login | docarray |
| octolytics-dimension-repository_id | 438303578 |
| octolytics-dimension-repository_nwo | docarray/docarray |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 438303578 |
| octolytics-dimension-repository_network_root_nwo | docarray/docarray |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | df2a3cea9cc9adaf422cd462f5351935c407af4d |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width