{"action":"created","issue":{"url":"https://api.github.com/repos/IBM-Swift/Swift-Kuery/issues/17","repository_url":"https://api.github.com/repos/IBM-Swift/Swift-Kuery","labels_url":"https://api.github.com/repos/IBM-Swift/Swift-Kuery/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/IBM-Swift/Swift-Kuery/issues/17/comments","events_url":"https://api.github.com/repos/IBM-Swift/Swift-Kuery/issues/17/events","html_url":"https://github.com/IBM-Swift/Swift-Kuery/issues/17","id":192590343,"number":17,"title":"Describe column schema with Kuery?","user":{"login":"rfdickerson","id":1310293,"avatar_url":"https://avatars.githubusercontent.com/u/1310293?v=3","gravatar_id":"","url":"https://api.github.com/users/rfdickerson","html_url":"https://github.com/rfdickerson","followers_url":"https://api.github.com/users/rfdickerson/followers","following_url":"https://api.github.com/users/rfdickerson/following{/other_user}","gists_url":"https://api.github.com/users/rfdickerson/gists{/gist_id}","starred_url":"https://api.github.com/users/rfdickerson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfdickerson/subscriptions","organizations_url":"https://api.github.com/users/rfdickerson/orgs","repos_url":"https://api.github.com/users/rfdickerson/repos","events_url":"https://api.github.com/users/rfdickerson/events{/privacy}","received_events_url":"https://api.github.com/users/rfdickerson/received_events","type":"User","site_admin":false},"labels":[{"id":422553604,"url":"https://api.github.com/repos/IBM-Swift/Swift-Kuery/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-30T15:10:53Z","updated_at":"2016-12-04T17:19:10Z","closed_at":null,"body":"I have studied how [SQLAlchemy](http://docs.sqlalchemy.org/en/latest/orm/tutorial.html) works in order to describe a table and its columns:\r\n\r\n```python\r\n>>> User.__table__ \r\nTable('users', MetaData(bind=None),\r\n            Column('id', Integer(), table=<users>, primary_key=True, nullable=False),\r\n            Column('name', String(), table=<users>),\r\n            Column('fullname', String(), table=<users>),\r\n            Column('password', String(), table=<users>), schema=None)\r\n```\r\n\r\nIt specifies the column title, the data type, the table it refers to, and the default values. I think having some of this could help with:\r\n\r\n1. The creation of the table directly from our Table description.\r\n2. Help us later create the mapping from the Table to a Swift `struct` or `class` automatically for users. Potentially for a future ORM library that uses Swift-Kuery, for instance.\r\n\r\nSo in Swift, I was thinking something like this:\r\n\r\n```swift\r\nclass Users: Table {\r\n\r\n   let id = Column(name: \"id\", type: .integer, isPrimaryKey: true, isNull: false)\r\n   let name= Column(name: \"name\", type: .text)\r\n   let fullName = Column(name: \"fullname\", type: .text)\r\n   let password = Column(name: \"password\", type: .text) \r\n}\r\n```\r\n\r\nwhere types could be:\r\n\r\n```swift\r\nenum SQLDataType {\r\n   case integer\r\n   case text\r\n   // ...\r\n}\r\n\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/IBM-Swift/Swift-Kuery/issues/comments/264716911","html_url":"https://github.com/IBM-Swift/Swift-Kuery/issues/17#issuecomment-264716911","issue_url":"https://api.github.com/repos/IBM-Swift/Swift-Kuery/issues/17","id":264716911,"user":{"login":"rfdickerson","id":1310293,"avatar_url":"https://avatars.githubusercontent.com/u/1310293?v=3","gravatar_id":"","url":"https://api.github.com/users/rfdickerson","html_url":"https://github.com/rfdickerson","followers_url":"https://api.github.com/users/rfdickerson/followers","following_url":"https://api.github.com/users/rfdickerson/following{/other_user}","gists_url":"https://api.github.com/users/rfdickerson/gists{/gist_id}","starred_url":"https://api.github.com/users/rfdickerson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfdickerson/subscriptions","organizations_url":"https://api.github.com/users/rfdickerson/orgs","repos_url":"https://api.github.com/users/rfdickerson/repos","events_url":"https://api.github.com/users/rfdickerson/events{/privacy}","received_events_url":"https://api.github.com/users/rfdickerson/received_events","type":"User","site_admin":false},"created_at":"2016-12-04T17:19:10Z","updated_at":"2016-12-04T17:19:10Z","body":"@naithar - yeah, one could use a method (borrowing from SQLAlchemy) like:\r\n\r\n```swift\r\nUsers.create(engine)\r\n```\r\n\r\nwhere engine represents the connection to the database."}}
{"actor":{"display_login":"rfdickerson"}}