* Use py3's f-strings instead of s.format(**locals())
In light of the bug reported here
https://github.com/apache/incubator-superset/issues/6347, which seems
like an odd `.format()` issue in py3, I greped and replaced all
instances of `.format(**locals())` using py3's f-strings
* lint
* fix tests
* [SIP-5] Open a new /api/v1/query endpoint that takes query_obj
- Introduce a new handle_superset_exception decorator to avoid repeating the logic for catching SupersetExceptions
- Create a query_obj_backfill method that takes form_data and constructs a query_obj that will be constructed in the client in the future. Use the backfill in explore_json.
- Create a new /api/v1/query endpoint that takes query_obj only and returns the payload data. Note the query_obj is constructed in the client. The endpoint currently only handles query_obj for table view viz (we'll be adding support to new viz types as we go).
- Unit test to verify the new endpoint for table view
* fix tests and lint errors
* - Move the new query endpoint into its own api.py view.
- Create QueryObject and QueryContext class to encapsulate query_object to be built from the client and additional info (e.g. datasource) needed to get the data payload for a given query
- Remove the query_obj_backfill as we'll start building the first query_object on the client so it no longer makes sense to have a short-lived backfill for the matter of days.
* Fixing lint and test errors
* Fixing additional lint error from the previous rebase.
* fixing additional lint error
* addressing additional pr comments
* Make /query accept a list of queries in the query_context object.
* fixing a lint error
* - Move time_shift based calculation and since, until check into util
- Add typing info for get_since_until
- Add new unit tests to verify time_shift calculation and the since until check
* [utils] gathering/refactoring into a "utils/" folder
Moving current utils.py into utils/core.py and moving other *util*
modules under this new "utils/" as well.
Following steps include eroding at "utils/core.py" and breaking it down
into smaller modules.
* Improve tests
* Make loading examples in scope for tests
* Remove test class attrs examples_loaded and requires_examples
* Add schema level access control on csv upload
* add db migrate merge point
* fix flake 8
* fix test
* remove unnecessary db migration
* fix flake
* nit
* fix test for test_schemas_access_for_csv_upload_endpoint
* fix test_csv_import test
* use security_manager to check whether schema is allowed to be accessed
* bring security manager to the party
* flake8 & repush to retrigger test
* address comments
* remove trailing comma
* Fixing issue with extra params in formData
* Pass in param use_slice_data to decide whether to use slice data
* Fixing core_tests to not use explore_json overrides
* Improve URLs for Chart and Dashboard ModelViews
Prior to this, the ModelView for Chart and Dashboard would be
at `/slicemodelview/list/` and `/dashboardmodelview/list/`.
Now we have cleaner URLs at `/chart/list/` and `/dashboard/list/`
* Fix unrelated js lint
* addressing comments
* Improve database type inference
Python's DBAPI isn't super clear and homogeneous on the
cursor.description specification, and this PR attempts to improve
inferring the datatypes returned in the cursor.
This work started around Presto's TIMESTAMP type being mishandled as
string as the database driver (pyhive) returns it as a string. The work
here fixes this bug and does a better job at inferring MySQL and Presto types.
It also creates a new method in db_engine_specs allowing for other
databases engines to implement and become more precise on type-inference
as needed.
* Fixing tests
* Adressing comments
* Using infer_objects
* Removing faulty line
* Addressing PrestoSpec redundant method comment
* Fix rebase issue
* Fix tests
* Added support for URLShortLinkButton to work for the dashboard case
* Fix lint errors and test
* Change references to 'slice' to 'chart'.
* Add unit tests to improve coverage
* Fixing lint errors
* Refactor to make URLShortLink more generic. Remove history modification code, redirect should be handling this.
* Remove history modification code, redirect should be handling this
* Generate a shorter link without the directory, and delegate default linked to the contents of window.location
* Fix lint errors
* Fix test_shortner test to check for new pattern
* Remove usage of addHistory to manipulate explore shortlink redirection
* Address build failure and using better practices for shortlink defaults
* Fixing alphabetical order
* More syntax mistakes
* Revert explore view history changes
* Fix use of component props, & rebase
* Initial test
* Save
* Working version
* Use since/until from payload
* Option to prefix metric name
* Rename LineMultiLayer to MultiLineViz
* Add more styles
* Explicit nulls
* Add more x controls
* Refactor to reuse nvd3_vis
* Fix x ticks
* Fix spacing
* Fix for druid datasource
* Rename file
* Small fixes and cleanup
* Fix margins
* Add proper thumbnails
* Align yaxis1 and yaxis2 ticks
* Improve code
* Trigger tests
* Move file
* Small fixes plus example
* Fix unit test
* Remove SQL and Filter sections
* move access permissions methods to security manager
* consolidate all security methods into SupersetSecurityManager
* update security method calls
* update calls from tests
* move get_or_create_main_db to utils
* raise if supersetsecuritymanager is not extended
* rename sm to security_manager
* Remove comments from queries in SQL Lab that break Explore view
This fixes an issue where comments on the last line of the source query comment out the closing parenthesis of the subquery.
* Add test case for SqlaTable with query with comment
This test ensures that comments in the query are removed when calling SqlaTable.get_from_clause().
* Add missing blank line class definition (PEP8)
* [Explore view] Use POST method for charting requests
* fix per code review comments
* more code review fixes
* code review fix: remove duplicated calls for getting values from request
* [Explore view] Use POST method for charting requests
* fix per code review comments
* more code review fixes
* code review fix: remove duplicated calls for getting values from request
* Use the query_obj as the basis for the cache key
When we recently moved from hashing form_data to define the cache_key
towards using the rendered query instead,
it made is such that non deterministic form
control values like relative times specified in "from" and "until" time
bound resulted in making those miss cache 100% of the time.
Here we move away from using the rendered query and using the query_obj
instead.
* Deprecating using form_data in templates
* Fix USA's state geojson for 'Country Map' visualization
Turns out the ISO codes were missing from the geojson file, this adds it
and uses human-readable indents.
* using proper ISO codes
* Linting
New linting rules started applying, I'm guessing a new version of
pylint?
* change reference for slices to chart
* change profile page reference
* change reference for Associated Slices
* change back to single quotes
* fix other single quotes
* linting
* last one
* fix test
A bug in to_dict(orient="records") in pandas/core/frame.py prevents
datetimes with time zones to be worked with. This works around the
issue in superset by re-implementing the logic of pandas in the
correct way. Until pandas fixes the issue this code should stay.
https://github.com/pandas-dev/pandas/issues/18372
This closes#1929
* exposed API endpoint to get querystring for a slice
* Added unit tests for endpoint
* fixed test case for python3
* moved get querystring logic into its own func
* renamed query string endpoint
* [explore] fixed padding bug on filter section
* fix slice_id logging issue
* [superset-sqllab] fix slice_id population in appropriate column
* [explore-logging] test the slice_id logging fix
* fix travis errors
* fix nits pointed out in PR comments
* cleanup tests
* made python more beautiful
* made python even more beautiful
* made python even more more beautiful
* made python even more more more beautiful
* fix lint error
* make exception handling more specific
* fixed silly error
* fixed argument indentation
* [add] Save filters to dashboard
* format code
* fix CI error
* add semicolon semi
* fix none object
* add test data
optimize the js code
fix the compatibility issue
* fix urllib to urllib.parse
* add space
* update test case
* remove 'return'
* fix error
* update test case
* sort explicitly on label
* add simple test for /slicemodelview/add endpoint
* make comments and method names more clear
* fix test name
* be more explicit, test status_code
* Simplifying the viz interface (#2005)
* Working on dashes
* Making this a collaborative branch
* Fixing some bugs
* Fixing bugs
* More improvements
* Add datasource back in bootstrap data
* Decent state
* Linting
* Moving forward
* Some more linting
* Fix the timer
* Triggering events through state
* Lingint
* Put filters in an array instead of flt strings (#2090)
* Put filters in an array instead of flt strings
* Remove query_filter(), put opChoices into Filter
* Update version_info.json
* Fix migrations
* More renderTrigger=true
* Fixing bugs
* Working on standalone
* getting standalone to work
* Fixed forcedHeight for standalone =view
* Linting
* Get save slice working in v2 (#2106)
* Filter bugfix
* Fixing empty series limit bug
* Fixed dashboard view
* Fixing short urls
* Only allow owners to overwrite slice (#2142)
* Raise exception when date range is wrong
* Only allow owner to overwrite a slice
* Fix tests for deprecate v1 (#2140)
* Fixed tests for control panels container and filters
* Fixed python tests for explorev2
* Fix linting errors
* Add in stop button during slice querying/rendering (#2121)
* Add in stop button during slice querying/rendering
* Abort ajax request on stop
* Adding missing legacy module
* Removing select2.sortable.js because of license
* Allow query to display while slice is loading (#2100)
* Allow query to display while slice is loading
* Put latestQueryFormData in store
* Reorganized query function, got rid of tu[le return values
* Merging migrations
* Wrapping up shortner migration
* Fixing tests
* Add folder creation to syncBackend
* Fixing edit URL in explore view
* Fix look of Stop button
* Adding syntax highlighting to query modal
* Fix cast_form_data and flase checkbox on dash
* Bugfix
* Going deeper
* Fix filtering
* Deleing invalid filters when changing datasource
* Minor adjustments
* Fixing calendar heatmap examples
* Moving edit datasource button to header's right side
* Fixing mapbox example
* Show stack trace when clicking alert
* Adding npm sync-backend command to build instruction
* Bumping up JS dependencies
* rm dep on select2
* Fix py3 urlparse
* rm superset-select2.js
* Improving migration scripts
* Bugfixes on staging
* Fixing Markup viz
* Rename rv => o in the decorator.
* Address comments.
* Permissions cleanup: remove none and duplicates. (#1967)
* Updates
* Rename var and dropdown text
* Cleanup
* Resolve comments.
* Add user to the perm check.
* Add KeyValue model for storing id-value pairs
use it for storing shared queries
* Change string to text and added test
* Put getQueryLink in one place
* Changed migration down version
* Changes based on comments
* Update bcf3126872fc_add_keyvalue.py
* Enable freeform-select with fetched column values for filter values
- db migration to add filter_select_enabled
- add freeform-multi option for Selectfield
- modify formatFilter() function on query to accomodate filter-select
* Fix js tests
* Fix codeclimate issue
* Changes based on comments
* Add test for filter endpoint
* Extract out renderFilterFormField function from render
* Fix landscape issues
* add config option for explore v2 beta users, and send through v2 path
* fix long lines
* use role rather than user ids in config
* add test
* simplify role check
* remove extra line
* use different test user for v2 tests
* Not working errors
* Remove update_explore endpoint, only update explore endpoints in reducer on query
* Change scroll to auto and make container reponse to height:
* Remove update_explore endpoint
* Remove can_update_explore perm
* Added filter in ControlPanelsContainer
* Move function for getting url params object to utils
* Fixed python test
* Move Filter to separate component
* Added specs and made changes based on comments
* Moved specs to right folder
* Fixed bugs with viz in exploreV2
Done:
- fix typo in pie viz
- add metrics/groupby to dist_bar viz
- fix typo in heatmap viz
- add big_number_total to viz
- fixed problem with fetching columns for datasource
- add sqlaTimeSeries to viz
- change row_limit and limit from number to strings so that we
don't need to parse integers in bootstrap data
* Fix python tests
* Added order_bars checkbox for dist_bar viz
* Get query buttonw working in explorev2
- Create new endpoint for updating explore viz
- Send over new form_data when query button is pressed
* Added endpoint test
* Changes based on comments
* Added docstring for endpoint, and query spec
* Remove white space around docstring
* Change in files
* Renamin files and folders
* cleaning up a single piece of lint
* Removing boat picture from docs
* add superset word mark
* Update rename note in docs
* Fixing images
* Pinning datatables
* Fixing issues with mapbox-gl
* Forgot to rename one file
* Linting
* v0.13.0
* adding pyyaml to dev-reqs
* pass field options in viz json
* move field options to fetch_datasource_metadata
* on control panels container mount, fetch datasource meta data and set dynamic field choices
* render options for select fields
* use component class rather than sic
* fix linting
* fix whitespace
* delete unused var
* only render fields once datasource meta has returned
* fix typo
* add datasources and fix column formatting
* fix tests
* never used function
* fix tests
* add test for fetch_datasource_metadata
* remove unneeded props
* Added time filter to query search page
* Added start date
* Updated python endpoint test
* changed spec
* Added specs and tests
* Modified python/js tests and some function/file names
based on code review comments
* Resolved conflicts in DashboardSelect_spec and QuerySearch_spec
* Break python tests for separate functions, Move sql queries to setUp()
* Get around eslint error for spec
* Small changes based on comments
* do not over-write the stored password with a masked password.
his addresses issue #1199
* added a test to validate that sending a password-masked sqlalchemy_uri does not over-write the stored sqlalchemy_uri
* requery the database object after the update.
use self.assertEqual for more informative error messages.
* Query search page under SQL Lab tab
* Modifications based on comments
* Hash
* Added spec and endpoint test with modifications
based on second round comments
* Changed permission menu in https://github.com/airbnb/caravel/pull/1095/files
* Query search page under SQL Lab tab
* Modifications based on comments
* Hash
* Added spec and endpoint test with modifications
based on second round comments
* Changed permission menu in https://github.com/airbnb/caravel/pull/1095/files
* Generalize switch between different datasources.
* Fix previous migration since slice model changed
* Fix warm up cache and other small stuff
* Adding modules and datasources through config
* Replace tabs w/ spaces
* Fix other style issues
* Change add method for SliceModelView to pick the first non-empty ds
* Remove tests on slice add redirect
* Change way of db migration
* Fix styling
* Fix create slice
* Small fixes
* Fix code climate check
* Adding notes on how to create new datasource in CONTRIBUTING.md
* Fix last merge
* A commit just to trigger travis build again
* Add migration to merge two heads
* Fix codeclimate
* Simplify source_registry
* Fix codeclimate
* Remove all getter methods
* move initialization of Database sqlalchemy_uri and password from DatabaseView.pre_add to utils.get_or_create_main_db.
Unit tests for mysql and postgres include username and password in the SQLALCHEMY_DATABASE_URI.
* modified test_testconn to work with sqlalchemy uri with a username and password.
* Improving the Visualize flow
* Fixed the timer
* CTAS
* Expiclit engine handling
* make tab full height, stretch for longer content (#1081)
* Better error handling for queries
* Hooked and fixed CSV export
* Linting
* Tying in the dttm in the viz flow
* Indicator showing when going offline
* Addressing comments, fixing the build
* Fixing unit tests
* call explore() directly from '/caravel/slice/id/' endpoint instead of redirecting to it.
* pass slice_id instead of slice_params in 'caravel/slice/id/' endpoint to avoid logging errors. add fix for MultiDict bug
* address max's comments
* remove the /slice/id/ endpoint in preference of /datasource_type/datasource_id/slice_id/
* pep8
* Carapal react mockup
This is really just a mock up written in React to try different
components. It could become scaffolding to build a prototype, or not.
* Merging in Alanna's theme tweaks for SQL lab
* Tweak the display of the alert message in navbar
* Sketching the middleware refresh for Queries
* Adjustments
* Implement timer sync.
* CTAS
* Refactor the queries to be stored as a dict. (#994)
* Download csv endpoint. (#992)
* CSV download engdpoint.
* Use lower case booleans.
* Replcate loop with the object lookup by key.
* First changes for the sync
* Address comments
* Fix query deletions. Update only the queries from the store.
* Sync queries using tmp_id.
* simplify
* Fix the tests in the carapal. (#1023)
* Sync queries using tmp_id.
* Fix the unit tests
* Bux fixes. Pass 2.
* Tweakin' & linting
* Adding alpha label to the SQL LAb navbar entry
* Fixing the python unit tests
* pass the request arg in the /caravel/slices/<slice_id>/ endpoint.
remove unused import.
* test that a single slice redirects rather than testing them all. update standalone redirect logic for Javascript 'false' instead of Python False
After ea8a7ec1ba creating a slice
started redirecting to druid datasource from sqlalchemy tables.
That's quite painful for sqlalchemy tables users.
Instead of hardcoding a choice just query the db, if we don't
have any druid datasource fallback to sqlalchemy tables.
Bonus points we remove hacky javascript and make the message
translatable.
While at it fix druid client test to not hardcode datasource id.
* Flashed messaged should be flushed in every page
* Show error messages in AJAX style
* Introduce the decorator "api"
* Move toggleCheckbox() to the right place and trigger it in jQuery style
* add unicode data to tests
* make tests pass on 2.7
* clean up data loading
- remove duplicate keys in slice_data
- reduce line length
* change manager option flag to -t, --load-test-data
* test --> load_test_data
* Make sure anonymous user with proper permissions can access data
* Review fixes: naming changes
* Review fixes: add more granular tests for public user dashboard access
* Review fixes: test that public user has access only to permitted data sets
* Introducing more security features
* Many to many owners for slices and dashboards
* Slices are filtered to only slices that the user has access to
* Adding unit tests