home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1616782404

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/sqlite-utils/issues/562#issuecomment-1616782404 https://api.github.com/repos/simonw/sqlite-utils/issues/562 1616782404 IC_kwDOCGYnMM5gXiRE 9599 2023-07-02T19:24:14Z 2023-07-02T19:26:39Z OWNER

Dataclasses were added in Python 3.7 and sqlite-utils was originally written for Python 3.6 - but both 3.6 and 3.7 are EOL now.

The thing that makes Dataclasses particularly interesting is the potential to use type annotations with them to help specify the types of the related SQLite columns.

Example for https://datasette.io/content/users

sql CREATE TABLE [users] ( [login] TEXT, [id] INTEGER PRIMARY KEY, [node_id] TEXT, [avatar_url] TEXT, [gravatar_id] TEXT, [html_url] TEXT, [type] TEXT, [site_admin] INTEGER, [name] TEXT ); And the dataclass: ```python from dataclasses import dataclass

@dataclass class User: id: int login: str node_id: str avatar_url: str gravatar_id: str html_url: str type: str site_admin: int name: str ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
1784794489  
Powered by Datasette · Queries took 0.884ms · About: github-to-sqlite