Title: Docs Update: Clarify sublassing DiffSyncModels for different backends · Issue #52 · networktocode/diffsync · GitHub
Open Graph Title: Docs Update: Clarify sublassing DiffSyncModels for different backends · Issue #52 · networktocode/diffsync
X Title: Docs Update: Clarify sublassing DiffSyncModels for different backends · Issue #52 · networktocode/diffsync
Description: Environment DiffSync version: 1.3.0 Proposed Functionality The README makes mention of extending a "base" DiffSyncModel for handling CRUD actions in a backend, but doesn't do a great job of visualizing this concept. you need to extend yo...
Open Graph Description: Environment DiffSync version: 1.3.0 Proposed Functionality The README makes mention of extending a "base" DiffSyncModel for handling CRUD actions in a backend, but doesn't do a great job of visuali...
X Description: Environment DiffSync version: 1.3.0 Proposed Functionality The README makes mention of extending a "base" DiffSyncModel for handling CRUD actions in a backend, but doesn't do a great ...
Opengraph URL: https://github.com/networktocode/diffsync/issues/52
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Docs Update: Clarify sublassing DiffSyncModels for different backends","articleBody":"### Environment\r\n* DiffSync version: 1.3.0\u003c!-- Example: 1.0.0 --\u003e\r\n\r\n\u003c!--\r\n Describe in detail the new functionality you are proposing.\r\n--\u003e\r\n### Proposed Functionality\r\nThe README makes mention of extending a \"base\" DiffSyncModel for handling CRUD actions in a backend, but doesn't do a great job of visualizing this concept.\r\n\r\n\u003e you need to extend your DiffSyncModel class(es) to define your own create, update and/or delete methods for each model.\r\n\r\nI think extending the example out a little more would go a long way to showing how to build your models and adapters.\r\n\r\n```python\r\nclass Device(DiffSyncModel):\r\n \"\"\"Example model of a network Device.\"\"\"\r\n\r\n _modelname = \"device\"\r\n _identifiers = (\"name\",)\r\n _attributes = ()\r\n _children = {\"interface\": \"interfaces\"}\r\n\r\n name: str\r\n site_name: Optional[str] # note that this attribute is NOT included in _attributes\r\n role: Optional[str] # note that this attribute is NOT included in _attributes\r\n interfaces: List = list()\r\n\r\n\r\nclass SystemADevice(Device):\r\n\r\n system_A_unique_field: Optional[str] = None\r\n \r\n @classmethod\r\n def create(cls, diffsync, ids, attrs):\r\n \"\"\"Talk to SystemA to create device\"\"\"\r\n pass\r\n\r\nclass SystemBDevice(Device):\r\n \r\n system_B_unique_field: Optional[str] = None\r\n\r\n @classmethod\r\n def create(cls, diffsync, ids, attrs):\r\n \"\"\"Talk to SystemB to create device\"\"\"\r\n pass\r\n```\r\n\r\n\u003c!--\r\n Convey an example use case for your proposed feature. Write from the\r\n perspective of a user who would benefit from the proposed\r\n functionality and describe how.\r\n--\u003e\r\n### Use Case\r\n\r\nThis should help newbies (like myself) to get a better idea of how to architect a diffsync-based integration.\r\n","author":{"url":"https://github.com/tyler-8","@type":"Person","name":"tyler-8"},"datePublished":"2021-06-03T04:42:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/52/diffsync/issues/52"}
| 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:a6f738e1-4f93-7e05-e50a-e1a9f2bc0849 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D022:EB239:1944A35:1FF0A45:69917A9D |
| html-safe-nonce | 7035c380eb0fda4ea4bafade184c1d5a4521acc451db6a0478349d467e50d47e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDIyOkVCMjM5OjE5NDRBMzU6MUZGMEE0NTo2OTkxN0E5RCIsInZpc2l0b3JfaWQiOiIyNDM5MjQ4NzcxMTIyNTU5NjQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 34b9f1d1186f52948bd456e3904b93b6b8552ff43310dcb57244cb6eaaab4daf |
| hovercard-subject-tag | issue:910089561 |
| github-keyboard-shortcuts | repository,issues,network-graph,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/networktocode/diffsync/52/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b172d555ed7f744f8bb4e8ee7599a8895aa1d72b2f96b2dfa1cce982ef28898b/networktocode/diffsync/issues/52 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b172d555ed7f744f8bb4e8ee7599a8895aa1d72b2f96b2dfa1cce982ef28898b/networktocode/diffsync/issues/52 |
| og:image:alt | Environment DiffSync version: 1.3.0 Proposed Functionality The README makes mention of extending a "base" DiffSyncModel for handling CRUD actions in a backend, but doesn't do a great job of visuali... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tyler-8 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/networktocode/diffsync git https://github.com/networktocode/diffsync.git |
| octolytics-dimension-user_id | 13106404 |
| octolytics-dimension-user_login | networktocode |
| octolytics-dimension-repository_id | 292296974 |
| octolytics-dimension-repository_nwo | networktocode/diffsync |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 292296974 |
| octolytics-dimension-repository_network_root_nwo | networktocode/diffsync |
| 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 | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width