{"action":"opened","issue":{"url":"https://api.github.com/repos/NerdWalletOSS/dynamorm/issues/16","repository_url":"https://api.github.com/repos/NerdWalletOSS/dynamorm","labels_url":"https://api.github.com/repos/NerdWalletOSS/dynamorm/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/NerdWalletOSS/dynamorm/issues/16/comments","events_url":"https://api.github.com/repos/NerdWalletOSS/dynamorm/issues/16/events","html_url":"https://github.com/NerdWalletOSS/dynamorm/issues/16","id":238136937,"number":16,"title":"Separate Model from Schema? ","user":{"login":"bradwood","id":3472045,"avatar_url":"https://avatars1.githubusercontent.com/u/3472045?v=3","gravatar_id":"","url":"https://api.github.com/users/bradwood","html_url":"https://github.com/bradwood","followers_url":"https://api.github.com/users/bradwood/followers","following_url":"https://api.github.com/users/bradwood/following{/other_user}","gists_url":"https://api.github.com/users/bradwood/gists{/gist_id}","starred_url":"https://api.github.com/users/bradwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradwood/subscriptions","organizations_url":"https://api.github.com/users/bradwood/orgs","repos_url":"https://api.github.com/users/bradwood/repos","events_url":"https://api.github.com/users/bradwood/events{/privacy}","received_events_url":"https://api.github.com/users/bradwood/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-23T13:06:06Z","updated_at":"2017-06-23T13:06:06Z","closed_at":null,"body":"In the below snippet, I want to be able to build up my schema using a series of mixins/inheritance, etc in a separate class. Is there a way to do this so that I can cleanly separate the Schemas from the Models? For example, I might want to use those same Schemas for validation on a REST call, for example, and not just on the database-end, using a straightforward marshmallow approach. \r\n\r\nMaybe this is a just a vanilla python question, rather than something specific to dynamorm one, in which case, my apologies...\r\n\r\nThanks for your help.\r\n\r\nBrad\r\n\r\n```\r\nfrom dynamorm import DynaModel\r\n\r\n# In this example we'll use Marshmallow, but you can also use Schematics too!\r\n# You can see that you have to import the schema library yourself, it is not abstracted at all\r\nfrom marshmallow import fields\r\n\r\n# Our objects are defined as DynaModel classes\r\nclass Book(DynaModel):\r\n    # Define our DynamoDB properties\r\n    class Table:\r\n        name = 'prod-books'\r\n        hash_key = 'isbn'\r\n        read = 25\r\n        write = 5\r\n\r\n    # Define our data schema, each property here will become a property on instances of the Book class\r\n    class Schema:\r\n        isbn = fields.String(validate=validate_isbn)\r\n        title = fields.String()\r\n        author = fields.String()\r\n        publisher = fields.String()\r\n        year = fields.Number()\r\n\r\n\r\n```"}}
{"actor":{"display_login":"bradwood"}}