Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type signatures for .create_table() and .create_table_sql() and .create() and Table.__init__ #314

simonw opened this issue Aug 10, 2021 · 2 comments
enhancement New feature or request


Copy link

simonw commented Aug 10, 2021

Adding type signatures to create_table() and .create_table_sql() is a bit too involved, I'll do that in a separate issue.

Originally posted by @simonw in #312 (comment)

@simonw simonw added the enhancement New feature or request label Aug 10, 2021
@simonw simonw changed the title Type signatures for create_table() and .create_table_sql() Type signatures for .create_table() and .create_table_sql() and .create() and Table.__init__ Aug 10, 2021
Copy link
Owner Author

simonw commented Aug 10, 2021

Also the .insert() family of methods - they look pretty ugly in Sphinx right now:


I should probably define reusable types for things like pk=, which have complex type signatures (a string or a list/tuple of strings) and show up in multiple places.

Copy link
Owner Author

simonw commented Aug 10, 2021

I took a big bite out of this when I annotated the .insert() method - but there are a bunch of other places that still need doing:

def insert(
record: Dict[str, Any],
column_order: Optional[Union[List[str], Default]] = DEFAULT,
not_null: Optional[Union[Set[str], Default]] = DEFAULT,
defaults: Optional[Union[Dict[str, Any], Default]] = DEFAULT,
hash_id: Optional[Union[str, Default]] = DEFAULT,
alter: Optional[Union[bool, Default]] = DEFAULT,
ignore: Optional[Union[bool, Default]] = DEFAULT,
replace: Optional[Union[bool, Default]] = DEFAULT,
extracts: Optional[Union[Dict[str, str], List[str], Default]] = DEFAULT,
conversions: Optional[Union[Dict[str, str], Default]] = DEFAULT,
columns: Optional[Union[Dict[str, Any], Default]] = DEFAULT,
) -> "Table":

@simonw simonw closed this as completed in c79737b Aug 18, 2021
simonw added a commit that referenced this issue Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
enhancement New feature or request
None yet

No branches or pull requests

1 participant