Relax Table schema constructor
#2850
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for using native Python types as column type specifiers, when creating a Perspective
Tablefrom a schema. The available types are based on the types allowed in 2.10.1:It is worth noting that despite the use of
dateanddatetimepython types as schema specifiers for legacy support, 3.x does not supportdateordatetimevalues when provided to thetableconstructor function in adictorlistinput type (though you may extend nativejsonparsing to allow this, or usepandas.DataFrameto marshall these to for you, see the 3.x release notes).This support is a convenience feature for existing integrations with the old API. Unlike the old API,
Table::schemaandView::schema(and all existing and future APIs that use Perspective visual types) will only returnString.Also fixed,
PerspectiveWidgetwas moved to a sub-module in #2728, but the reference to this class was left in the root__init__.py's__all__variable. A test for this has been added as well - which may seem a bit ham-fisted, but even perspective's own repo lacked a test-path which includedfrom perspective import *to expose this case beforehand, so ...