summaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)Author
2016-10-17If prev_keyword is an unrecognized keyword, go backward until we find a ↵Darik Gamble
recognized one
2016-09-27master: decimal and float format in config fileFoxygrandpa
2016-09-15master: numbers division for int and floatFoxygrandpa
2016-09-12Fix crash bug with leading parenthesisJoakim Koljonen
2016-09-04Support configuring keyword casing preferencesDarik Gamble
2016-08-23Merge pull request #568 from dbcli/koljonen/hack_for_sqlparse_crashesAmjith Ramanujam
Temporary hack for sqlparse crashing after AS
2016-08-23Temporary hack for sqlparse crashing after ASJoakim Koljonen
And a regression test.
2016-08-23Fix crash bug with named queriesJoakim Koljonen
And add behave tests.
2016-08-08Merge pull request #553 from dbcli/darikg/cte-suggestionsAmjith Ramanujam
CTE-aware suggestions
2016-07-29Merge pull request #554 from dbcli/koljonen/suggestion_sortingAmjith Ramanujam
Some changes to sorting of suggestions
2016-07-27Make suggestions based on local tablesDarik Gamble
2016-07-27Rename the suggestion field `tables` to `table_refs` so we can add more ↵Darik Gamble
table-specific properties without getting confused
2016-07-27Add parseutils module for processing CTEs (not hooked up yet)Darik Gamble
2016-07-27Move parseutils tests into test subfolderDarik Gamble
2016-07-27packages/function_metadata.py --> packages/parseutils/meta.pyDarik Gamble
2016-07-26Fix failing tests.Amjith Ramanujam
2016-07-08Some changes to sorting of suggestionsJoakim Koljonen
2016-07-06Better scoping for tables in insert statementskoljonen
This commit makes it so that given `INSERT INTO foo(<cursor1>) SELECT <cursor2> FROM bar;`, we suggest `bar` columns for `<cursor2>` and `foo` columns for `<cursor1>`. Previous behaviour is sugggesting columns from both tables in both cases.
2016-07-06Merge pull request #531 from dbcli/koljonen/generate_aliasesdarikg
Suggest table aliases + add tests for casing
2016-06-29Repair exception thrown on urls with portsEric Wald
When the database URL contains a port, uri.port is (at least in Python 2.7.6) an integer, not a string, so urlparse.unquote chokes on it. Fixes issue #536, but is probably worth verifying on Python 3.
2016-06-27Suggest table aliases + add tests for casingkoljonen
If config.main.generate_aliases is True, for `SELECT * FROM `, we suggest `FooBar FB` and `foo_bar fb` instead of `FooBar` and `foo_bar`, respectively. To be able to add a test, I had to add support for testing with different settings, which meant I could also add tests for casing. There are two non-obvious changes that I can think of: 1. The lexical sorting of matches is modified so as to sort spaces and underscores before letters and to sort case-insensitively. This is so that e.g `Foob F` comes before 'FooBar FB' when `foob` is input. 2. We now suggest `some_func()` instead of `some_func` (because suggesting `some_func sf` didn't make any sense).
2016-06-27In test_sqlcompletion, remove some code duplicationkoljonen
2016-06-20Smart completion tests: make every test have its own completerkoljonen
2016-06-18Fix indentation of test_smart_completion_* metadata dictskoljonen
2016-06-18In completion tests, get columns from metadata instead of manually listing themkoljonen
2016-06-18In completion tests, get functions from metadata instead of manually listing ↵koljonen
them
2016-06-18In completion tests, get views from metadata instead of manually listing themkoljonen
2016-06-18In completion tests, get tables from metadata instead of manually listing themkoljonen
2016-06-18In completion tests, get datatypes from metadata instead of manually listing ↵koljonen
them
2016-06-18In completion tests, get schemas from metadata instead of manually listing themkoljonen
2016-06-18Consolidate common code in smart_completion testskoljonen
2016-06-16Fix some join-condition issueskoljonen
When self-joining a table with an FK to or from some other table, we got a false FK-join suggestion for that column. There was also a problem with quoted tables not being quoted in the join condition. And there were a couple of problems when trying to join a non-existent table or using a non-existent qualifier (`SELECT * FROM Foo JOIN Bar ON Meow.`). I also rewrote get_join_condition_matches a bit in the process, hopefully making it a bit simpler.
2016-06-14Add a couple of tests suggested by @darikgkoljonen
2016-06-14Join conditions: alias tables already included in querykoljonen
If we have the input `SELECT * FROM Foo JOIN `, we now suggest `Foo Foo2 ON Foo2.ParentID = Foo.ID` (given the appropriate casing file and FK). There were also some problems with quoted tables and with the casing of table aliases, which are now fixed. I also made a few cosmetic changes to get_join_matches (pgcompleter.py) just to make it a bit easier to work with.
2016-06-10Also exclude NATURAL JOIN from join suggestionskoljonen
2016-06-10Various changes after reviewkoljonen
2016-06-09For 'JOIN <cursor>', suggest 'foo on foo.fooid = bar.fooid'koljonen
This is based on my previous work on suggesting join conditions, but here instead we suggest the whole join. What we do is simply check all the tables in the statement for FK relationships and then suggest joins based on those. I think this will not only save key presses, but also be rather useful when exploring an unfamiliar (part of a) database. There's one non-obvious change in this commit (that I can think of): When calling **sqlcompletion.text_before_cursor**, the **text_before_cursor** argument now no longer includes **word_before_cursor**. This is because for 'SELECT * FROM foo JOIN bar<cursor>', we would otherwise consider the table **bar** already included in the statement and thus suggest e.g. 'baz on baz.barid = bar.barid'.
2016-06-07`column` keyword suggests columnsDarik Gamble
2016-06-06Merge pull request #512 from koljonen/casingdarikg
Custom casing of table/column/function/view names
2016-06-05Merge pull request #521 from Smotko/configure-row-limitAmjith Ramanujam
Make too many rows warning limit configurable
2016-06-04Custom casing of table/column/function/view nameskoljonen
This adds support for defining the casing to be used in completions (for unquoted names). The casing is determined by the casing file, which consists of a \n-separated list of names using the preferred casing. This file can either be populated manually or created automatically (based on usage in SQL/PLPGSQL functions), with a config setting.
2016-06-04Merge pull request #513 from koljonen/order_columns_by_db_column_orderdarikg
Order columns by in-table order when expanding *
2016-06-02Make sure low_count is never greater than over_defaultAnže Pečar
2016-06-02Add test for row_limit parameterAnže Pečar
2016-06-02Use pg_proc.proargmodes &c. instead of parsing arg_listkoljonen
Getting the parameters from proargnames, proallargtypes and proargmodes instead of from parsing the arg_list string simplifies FunctionMetadata quite a bit. I also made the ColumnMetadata for table/view columns use the same format for the type (i.e. regtype instead of typname). This means we now get join-condition suggestions for joining tables/views to functions, which didn't work before.
2016-06-01Merge pull request #516 from dbcli/koljonen/fix_another_casing_issuedarikg
Fix issue with 'SELECT Foo.*<cursor> FROM Foo'
2016-05-31Fix issue with 'SELECT Foo.*<cursor> FROM Foo'koljonen
In the expansion, we got '"Foo".<col>' when we should have gotten 'Foo.<col>'.
2016-05-31Order columns by in-table order when expanding *koljonen
And add a setting to use alphabetic order instead. We simply get the columns from the database in the canonical order, and then sort them if the user has opted for alphabetic order.
2016-05-27Fix two casing issues with schemaskoljonen
1. In 'SELECT * FROM Foo.', Foo was not recognized as foo. 2. In 'SELECT * FROM "Foo"', objects in Foo were not suggested.
2016-05-25Merge pull request #510 from koljonen/fixtablecasingissue2darikg
Fix another problem where table names would not be recognized when nott in lower case