koljonen
69a6d0b38f
In completion tests, get columns from metadata instead of manually listing them
2016-06-18 21:25:55 +02:00
koljonen
932603130d
In completion tests, get functions from metadata instead of manually listing them
2016-06-18 21:24:02 +02:00
koljonen
a79e124025
In completion tests, get views from metadata instead of manually listing them
2016-06-18 21:24:00 +02:00
koljonen
d40bae021e
In completion tests, get tables from metadata instead of manually listing them
2016-06-18 21:23:12 +02:00
koljonen
42cf384ede
In completion tests, get datatypes from metadata instead of manually listing them
2016-06-18 21:21:17 +02:00
koljonen
c3c18bcebe
In completion tests, get schemas from metadata instead of manually listing them
2016-06-18 21:18:32 +02:00
koljonen
a784c7a158
Consolidate common code in smart_completion tests
2016-06-18 21:16:12 +02:00
koljonen
5b20e107b8
Fix some join-condition issues
...
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-16 19:27:57 +02:00
koljonen
b69404c215
Add a couple of tests suggested by @darikg
2016-06-14 22:44:36 +02:00
koljonen
6cb8c38628
Join conditions: alias tables already included in query
...
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-14 22:34:10 +02:00
koljonen
351a58554b
Also exclude NATURAL JOIN from join suggestions
2016-06-10 03:51:52 +02:00
koljonen
582852adb6
Various changes after review
2016-06-10 03:26:42 +02:00
koljonen
9b6a72e9e0
For 'JOIN <cursor>', suggest 'foo on foo.fooid = bar.fooid'
...
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-09 00:55:07 +02:00
Darik Gamble
e5cc38d835
column
keyword suggests columns
2016-06-07 14:44:52 -04:00
darikg
92cc469b7b
Merge pull request #512 from koljonen/casing
...
Custom casing of table/column/function/view names
2016-06-06 17:21:32 -04:00
Amjith Ramanujam
163b2e2087
Merge pull request #521 from Smotko/configure-row-limit
...
Make too many rows warning limit configurable
2016-06-05 14:50:39 -07:00
koljonen
7e45e893ca
Custom casing of table/column/function/view names
...
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-04 23:05:32 +02:00
darikg
52bac9af85
Merge pull request #513 from koljonen/order_columns_by_db_column_order
...
Order columns by in-table order when expanding *
2016-06-04 07:34:35 -04:00
Anže Pečar
302d425609
Make sure low_count is never greater than over_default
2016-06-02 18:37:23 -07:00
Anže Pečar
1947e74c00
Add test for row_limit parameter
2016-06-02 18:37:23 -07:00
koljonen
5d9dfcdcc3
Use pg_proc.proargmodes &c. instead of parsing arg_list
...
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-02 01:44:31 +02:00
darikg
f912633d6d
Merge pull request #516 from dbcli/koljonen/fix_another_casing_issue
...
Fix issue with 'SELECT Foo.*<cursor> FROM Foo'
2016-06-01 16:30:06 -04:00
koljonen
e217bac439
Fix issue with 'SELECT Foo.*<cursor> FROM Foo'
...
In the expansion, we got '"Foo".<col>' when we should have gotten 'Foo.<col>'.
2016-05-31 23:45:11 +02:00
koljonen
740085dd23
Order columns by in-table order when expanding *
...
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-31 01:29:44 +02:00
koljonen
843b859c1d
Fix two casing issues with schemas
...
1. In 'SELECT * FROM Foo.', Foo was not recognized as foo.
2. In 'SELECT * FROM "Foo"', objects in Foo were not suggested.
2016-05-27 11:29:23 +02:00
darikg
a9c209df7a
Merge pull request #510 from koljonen/fixtablecasingissue2
...
Fix another problem where table names would not be recognized when nott in lower case
2016-05-25 19:11:07 -04:00
koljonen
59e3068a07
Fix another problem where table names would not be recognized when not in lower case
...
My previous fix didn't cover the case 'INSERT INTO Foo(<cursor>)', which is now covered.
2016-05-25 18:31:34 +02:00
koljonen
7f8bd9bbd4
Make join-condition suggestions work with multi-line queries
2016-05-24 16:11:36 +02:00
koljonen
8431b32166
Support for join-condition suggestions after ON
...
The user types 'SELECT * FROM parenttable p JOIN childtable c on '. We then suggest ['c.parenttableid = p.parenttableid', 'c.createdby = p.createdby', ...] as completions.
The suggestions are FK matches first, then name matches for int columns, then name matches for other columns, sorted by proximity from the cursor to the other table.
Some changes:
For "JOIN Foo USING(<cursor>)", now only columns present in Foo are suggested.
For all suggestions after 'ON', now only the tables before the cursor are considered.
meta[reltype]][relname] goes from being a list of columns to being an OrderedDict {column_name:ColumnMetadata}, where the ColumnMetaData contains the column's name, data type and a list of FKs involving the column. This entails modification of a number of functions dealing with columns.
2016-05-24 14:18:19 +02:00
koljonen
a5fa8ca1cb
Fix problem where table names would not be recognized when not in lower case
2016-05-20 00:00:31 +02:00
darikg
30de80223b
Merge pull request #505 from koljonen/drop_asterisk_column_suggestion
...
Stop suggesting * as a column
2016-05-17 19:40:42 -04:00
Stuart Quin
d378ddf559
Merge pull request #504 from dbcli/amjith/unicode-notices
...
Support unicode strings in notices.
2016-05-17 20:32:10 +01:00
Amjith Ramanujam
0524e0adbf
Disable the test for unicode notices.
2016-05-17 12:04:30 -07:00
koljonen
a60ee9a85f
Stop suggesting * as a column
...
I don't think suggesting * is of use to anyone, and it's in the way for anyone who just wants a column.
2016-05-17 12:27:33 +02:00
darikg
8d426c2db6
Merge pull request #502 from koljonen/cleanup
...
Remove dead code and fix a broken test
2016-05-16 18:44:25 -04:00
darikg
087fb1cb7d
Merge pull request #492 from koljonen/master
...
Completion to column list when * is entered
2016-05-16 18:36:46 -04:00
koljonen
0af862f1ff
Remove obsolete comments
2016-05-16 17:31:52 +02:00
koljonen
8e24cd41dc
Various small changes after code review
2016-05-16 13:48:46 +02:00
Amjith Ramanujam
69ee125bf1
Trying the command in a single line.
2016-05-15 22:59:53 -07:00
Amjith Ramanujam
2cfd9fc913
Add a test for unicode tests.
2016-05-15 22:39:41 -07:00
darikg
5844690138
Merge pull request #501 from koljonen/fixusing
...
Fix bug where "USING(<cursor>" wasn't detected properly + add test case
2016-05-15 14:44:15 -04:00
koljonen
ef99084954
Remove new test I added and edit the existing ones to cover the same case instead
...
As suggested by darikg
2016-05-15 20:29:48 +02:00
koljonen
838d4f6950
Remove dead code and fix a broken test (all found by Codacy)
2016-05-15 19:41:30 +02:00
darikg
30727196ed
Merge pull request #497 from koljonen/allownonsetreturningfunctionsinfromclause
...
Improve filtering of functions for FROM clause
2016-05-15 13:01:10 -04:00
koljonen
fffa740fbc
Fix more test bugs ... apparently the able order can be indeterministic
2016-05-15 18:35:22 +02:00
koljonen
17a2b3a4b7
Fix some bugs in the tests I added
2016-05-15 18:05:48 +02:00
koljonen
926004eedd
Fix bug where "USING(<cursor>" wasn't detected properly + add test case
2016-05-14 19:08:53 +02:00
koljonen
de83a72abf
After code review: Remove "parent" field I added to Columns
...
It turned out there was a way to accomplish qualification of column names without it.
2016-05-14 18:40:32 +02:00
koljonen
b793ed5c00
Some changes after code review
...
Move *-expansion logic from find_matches to get_column_matches
Make the expansion always qualify column names if there's more than one table. For this I changed populate_scoped_columns to return a dict{TableReference:[column names]}; I took this code from my other branch joinconditions.
Add a bunch of tests
2016-05-14 18:19:55 +02:00
koljonen
6d920340b8
Fix tests I broke in eaf3a11c94
2016-05-14 15:04:55 +02:00
koljonen
16efe77433
Support for qualifiers in * expansion
...
This means that when the user expands the * in "select t.* from tbl t", the result is "select t.col1, t.col2, t.col3, ... from tbl t".
2016-05-09 14:35:14 +02:00
koljonen
eaf3a11c94
Improve filtering of functions for FROM clause
...
Change from filtering out all non-set-returning functions to only filteirng out windowing functions and aggregate functions.
Non-set-returning functions are legal in the FROM clause and can be quite useful.
2016-05-07 13:48:11 +02:00
Pavel Savchenko
1dabd3be63
Unquote URI parts prior to using in connection
...
As you know [RFC-3986][1] allows passing "disallowed" characters
as long as these are percent encoded.
Since we deal with the url parsing, we can expect this to happen
and need to use the values after they have been decoded.
[1]: https://tools.ietf.org/html/rfc3986#section-2.1
2016-04-27 17:58:16 +02:00
Anthony Lai
f1ff7158e0
Fix auto-completion breaking for table names with caps
2016-03-22 23:04:33 -07:00
Anthony Lai
eb3ef2e143
unescape completion names for lexical priority
2016-03-22 22:08:21 -07:00
Anthony Lai
1fe6ff06a2
Fix lexical order tiebreaking
2016-03-18 21:27:07 -07:00
Fernando Mora
6af6454e59
More appropiate dates/times types test name
2016-02-26 16:27:12 +01:00
Fernando Mora
5f4bded599
Issue #448 . Add timestamptz to DATE custom extension
2016-02-26 16:21:27 +01:00
Daniel Rocco
66f9647210
Use lexical order to break ties when fuzzy matching
2016-02-14 23:33:23 -05:00
Amjith Ramanujam
fea50b59db
Merge pull request #457 from dbcli/stuartquin/cast-bc-dates
...
Issue #448 extension for BC dates
2016-02-03 19:23:22 -08:00
David Szotten
d4ffbe6104
oh py2.6 how i don't miss you
2016-02-03 22:31:10 +00:00
David Szotten
85181ab252
factor out ensure_dir_exists
and use for log
2016-02-03 22:28:04 +00:00
David Szotten
43a13ba065
a few more tests
2016-02-03 20:58:32 +00:00
David Szotten
bea392d7ed
ensure target dir exists when copying config
2016-02-03 20:45:36 +00:00
Stuart Quin
37c10e45c8
Issue #448 extension for BC dates
2016-02-03 10:57:36 +00:00
David Szotten
f6c159e805
test for recent patch for execute_from_file
...
to prevent obvious regressions at least
2016-02-02 18:56:20 +00:00
Amjith Ramanujam
c4557a8215
Add a test case for enum unicode case.
2016-01-12 04:55:42 -08:00
David Szotten
2b867820d9
don't error when completing parameter-less functions
2016-01-05 16:32:31 +00:00
Darik Gamble
90651ca7fe
Really sort keywords after everything else
2015-11-26 14:17:47 -05:00
Darik Gamble
0f70ccad31
Add a bunch of tests for multiple joins
2015-11-25 16:17:08 -05:00
Amjith Ramanujam
5dde125d93
Merge pull request #421 from dbcli/darikg/support-leading-double-quote
...
Handle manually entered double-quote gracefully
2015-11-24 11:17:31 -08:00
Darik Gamble
2c4f4e689d
Add more tests for qualified table names with or without quotes
2015-11-23 16:48:27 -05:00
Darik Gamble
75a184571a
Rename old test to avoid redefinition
...
'test_simple_select_with_cols_multiple_tables' was defined twice with different bodies
2015-11-23 14:39:31 -05:00
Amjith Ramanujam
b68c2ab38c
Add tests for the format_output.
2015-11-22 05:46:06 -08:00
Darik Gamble
9295cb9686
Fix suggestions after a manually entered double quote escape
2015-11-21 16:39:30 -05:00
Darik Gamble
692afc8240
Replace suggestion dicts with namedtuples
2015-11-16 07:41:27 -05:00
Darik Gamble
5b5e861258
extract_tables returns tuples, not lists
2015-11-16 07:28:22 -05:00
Darik Gamble
0cf0b7ff59
Update pgcompleter tests
2015-11-08 15:55:50 -05:00
Darik Gamble
886b048af0
PGCompleter initializes a prevalence counter (not used yet)
2015-11-08 15:55:49 -05:00
Darik Gamble
9c97d35606
New package prioritization and class PrevalenceCounter
2015-11-08 15:54:15 -05:00
Darik Gamble
1ea9bf735b
Refactor a lot of run_cli
into smaller submethods:
...
`_build_cli`, '_evaluate_command` and `_handle_server_closed_connection`
_evalute_command returns (output, MetaQuery) tuple where MetaQuery is a namedtuple
(query, successful, total_time, meta_changed, db_changed, path_changed, mutated)
2015-10-28 10:58:29 -04:00
Darik Gamble
edcc5c8a2d
pgexecute.run returns two extra tuple elements: query, and success
2015-10-28 10:58:28 -04:00
Darik Gamble
6df33e959d
exception_formatter returns only status, not the entire results tuple
2015-10-28 10:58:27 -04:00
Darik Gamble
488ac21dae
trivial indent fix
2015-10-28 10:58:25 -04:00
Darik Gamble
c9b55ba12e
Fix pgexecute tests
2015-10-28 10:58:25 -04:00
Iryna Cherniavska
2be25f5358
Setproctitle should be optional in tests.
2015-10-26 15:00:42 -07:00
Jacek Wielemborek
74c67a6dc6
Add a test written by darikg. Not actually executed, please confirm it.
2015-10-25 20:01:54 +01:00
Amjith Ramanujam
cc7b9d2d56
Make setproctitle optional in Windows
2015-10-23 02:49:20 -07:00
Stuart Quin
eea0cbd495
Clearer function name, handle passwords with spaces
2015-10-19 18:40:50 +01:00
Stuart Quin
748fcb7677
Issue #355 Use setproctitle to hide command line passwords
2015-10-18 21:56:52 +01:00
Darik Gamble
947cdb9506
support different error-handling options
2015-10-10 15:05:30 -04:00
Iryna Cherniavska
08347934c4
Fix for behave tests failing with pexpect 4.0.
2015-10-05 14:11:31 -07:00
darikg
4055b726cc
Merge pull request #368 from dbcli/darikg/suggest-columns-from-functions
...
Suggest columns from functions
2015-10-04 09:31:11 -04:00
Amjith Ramanujam
12207f39fe
Merge pull request #373 from dbcli/darikg/fix-need_completion_refresh
...
Fix need_completion_refresh
2015-10-03 14:48:16 -07:00
Darik Gamble
bb12d553a4
Fix need_completion_refresh
...
Was only actually checking the first command in multiple commands
2015-10-03 14:41:50 -04:00
Darik Gamble
9a7cae6cf5
Expand more join tests to check compound statements
2015-10-03 14:10:51 -04:00
Darik Gamble
ee0995ceed
Fix suggestions in compound join clauses
...
Previously, this worked correctly, suggesting columns etc. from `a`
`SELECT * FROM abc a JOIN def d ON a.`
But this suggested only keywords:
`SELECT * FROM abc a JOIN def d ON a.id = d.id AND a.`
2015-10-03 14:04:00 -04:00
Darik Gamble
38f5e875ef
Add missing test assertion
2015-10-03 10:01:06 -04:00
Darik Gamble
fc25e576eb
Delete outdated comment
2015-10-03 09:59:13 -04:00
Darik Gamble
62b2962b63
Suggest fields from functions used as tables
2015-09-29 09:07:20 -04:00
Darik Gamble
07030e20d2
Move FunctionMetadata definition into its own package
2015-09-29 09:07:20 -04:00
Darik Gamble
a0266de192
Extract functions in the FROM clause as tables
2015-09-29 08:54:49 -04:00
Iryna Cherniavska
2020e7204d
Using pgspecial as a separate module. Warning: this branch will not build.
2015-09-26 17:51:51 -07:00
Darik Gamble
169eb3ff58
Suggest set-returning functions as tables
2015-09-23 14:09:38 -04:00
Darik Gamble
2e9dce513b
pgexecute returns additional function metadata
2015-09-23 14:09:37 -04:00
Darik Gamble
431ba8f695
Don't hide functions from pg_catalog
2015-09-22 13:00:35 -04:00
Iryna Cherniavska
72ea4edcec
Strip color codes out of behave actual output.
2015-09-13 11:21:13 -07:00
Iryna Cherniavska
870b613f6f
When behave fails, it prints out expected and actual output.
2015-09-13 10:19:25 -07:00
Iryna Cherniavska
6664337a85
Functional test for refresh command.
2015-09-06 10:18:21 -07:00
Iryna Cherniavska
62af9d3a96
Added refresher tests.
2015-09-05 18:31:53 -07:00
Amjith Ramanujam
6e1bc6fcd1
Merge pull request #342 from dbcli/j-bennet/completion-in-named-query
...
Autocompletion in named queries.
2015-08-25 21:45:53 -07:00
Amjith Ramanujam
d222e085b7
Update the tests for named query.
2015-08-25 19:41:04 -07:00
Iryna Cherniavska
037e8c84a0
Minor test changes.
2015-08-25 19:35:40 -07:00
Iryna Cherniavska
31b867f632
Autocompletion in named queries. Connect #270 .
2015-08-25 19:35:40 -07:00
Amjith Ramanujam
e4c18532c3
Merge pull request #344 from dbcli/j-bennet/fix-read-from-file
...
Added read_from_file back into iospecial.
2015-08-25 19:26:16 -07:00
Amjith Ramanujam
fb86930cd6
Add tests for where clause with keywords.
2015-08-24 19:31:25 -07:00
Iryna Cherniavska
da12a70cbb
Added read_from_file back into iospecial (it was removed but is still being used. Added integration test for editing a file.
2015-08-24 17:46:40 -07:00
Amjith Ramanujam
585b37e70f
Fix failing tests for python 3.
2015-08-23 01:50:09 -07:00
Amjith Ramanujam
65398f0051
Fix failing tests.
2015-08-23 01:43:54 -07:00
Amjith Ramanujam
72b8e60d18
Merge pull request #337 from dbcli/darikg/multiline_open_quotes
...
Don't end multi-line query within a quote
2015-08-19 21:54:11 -07:00
Darik Gamble
9be09b8bf4
Add function to check for unclosed quotations
2015-08-18 06:04:08 -04:00
Amjith Ramanujam
f2e436ad2f
Fix unicode issues and update tests.
2015-08-18 00:38:56 -07:00
Amjith Ramanujam
5796fa2b4e
Fix tests for multiple queries with syntax error.
2015-08-18 00:27:40 -07:00
Iryna Cherniavska
9a35e5ef05
Started adding "service" option. Connect #289 .
...
Switched to dsn-based approach (no config parsing).
2015-08-13 23:40:11 -07:00
Amjith Ramanujam
ad9c99f790
Merge pull request #323 from dbcli/darikg/bugfix-283
...
Fix #283
2015-08-05 15:43:05 -07:00
Amjith Ramanujam
4b644bf2f1
Merge pull request #324 from dbcli/darikg/bugfix-322
...
Fix #322
2015-08-05 15:04:33 -07:00
Amjith Ramanujam
259f4897a2
Merge pull request #320 from dbcli/darikg/bugfix-317
...
Add regression test for #317
2015-08-05 15:01:14 -07:00
Amjith Ramanujam
9ab49a2145
Merge pull request #321 from dbcli/j-bennet/integration-tests
...
Fixes for test database being in use problem.
2015-08-05 14:55:51 -07:00
Darik Gamble
3205fb0f85
Test completions with an escaped table alias
2015-08-05 15:47:27 -04:00
Darik Gamble
3ef99aa043
Test suggest_type with escaped table aliases
2015-08-05 15:46:13 -04:00
Darik Gamble
21125e8820
Test extract_tables with escaped table aliases
2015-08-05 15:45:40 -04:00
Darik Gamble
6a2771a9a2
Add tests for \c and \connect to suggest databases
2015-08-05 14:32:35 -04:00
Iryna Cherniavska
a895703201
Shortened expect timeouts.
2015-08-05 09:00:55 -07:00
Iryna Cherniavska
10d76fb978
Fixes for test database being in use problem.
2015-08-05 08:50:54 -07:00
Darik Gamble
e97cc6586d
Add regression test for #317
2015-08-05 09:40:31 -04:00
darikg
a25dc906af
Merge pull request #311 from dbcli/amjith/autocompletion-crash
...
Fix the crashing autocompletion on joins.
2015-08-02 10:34:49 -04:00
Amjith Ramanujam
09ccb535ec
Add a test for the crashing bug fix.
2015-08-01 08:29:33 -07:00
Amjith Ramanujam
5de07bdbde
Fix the crashing autocompletion on joins.
2015-08-01 08:22:31 -07:00
Amjith Ramanujam
1f147f5e7a
Merge pull request #300 from dbcli/j-bennet/integration-tests
...
More integration tests
2015-08-01 07:45:22 -07:00
Iryna Cherniavska
2c9056133a
More fiddling with python version string.
2015-07-31 09:49:38 -07:00
Iryna Cherniavska
59af55c90b
Added python version suffix to test db name, so each version creates its own test db.
2015-07-31 09:43:58 -07:00
Iryna Cherniavska
ae2e56f319
Disconnect from test db after table drop.
2015-07-31 09:18:38 -07:00
Amjith Ramanujam
390839b945
Merge pull request #277 from darikg/darikg/completions-meta-display
...
[wip/rfc] Put meta info in the completions menu
2015-07-28 13:19:52 -07:00
Iryna Cherniavska
22670a8393
CRUD tests for database and table, select and update on table.
2015-07-28 10:21:43 -07:00
Iryna Cherniavska
4903604704
Working on more test steps.
2015-07-27 22:21:12 -07:00
Iryna Cherniavska
4a5c77d5ca
Added tests for db create/drop, connect/disconnect. Fix for connecting with no password (trust).
2015-07-27 16:28:15 -07:00
Darik Gamble
7b997e4083
Update tests so they pass with metadisplay
2015-07-19 14:36:23 -04:00
Iryna Cherniavska
4980b4ef09
Moved behavioral tests into tests. Updated expected help output. Drop test db if exists.
2015-07-12 14:41:36 -07:00
Iryna Cherniavska
cb9905a44e
Merge pull request #262 from dbcli/amjith/expanded_output_separator_fix
...
Make the horizontal separator in expanded mode a constant length.
2015-07-01 21:52:04 -07:00
Darik Gamble
581061440b
pg_execute.run accepts a PGSpecial object, instead of calling special.execute directly
2015-06-30 12:40:53 -04:00
Darik Gamble
1355665270
format_output takes an extra arg instead of referencing pgspecial directly
...
This also allows us to simplify some of the tests in test_pgexecute,
which tested with and without expanded output by first running '\x',
which is a pretty roundabout way of mutating a global variable
2015-06-30 11:28:06 -04:00
Amjith Ramanujam
7c6c56de6b
Fix the failing tests for expanded output.
2015-06-21 00:03:43 -07:00
Daniel Rocco
40149ad648
Add tests for fuzzy ranking adjustments.
2015-06-16 08:35:42 -04:00
Darik Gamble
4e46c01d3c
Gross test that \dt, \df etc. run without error
2015-05-23 08:33:42 -04:00
Darik Gamble
9e621ba97c
Support \dT to list datatypes
2015-05-23 08:33:42 -04:00
Darik Gamble
128264057e
Suggest custom types in addition to built-ins
2015-05-23 08:33:41 -04:00
Darik Gamble
5692782bd2
Give pgexecute a datatypes() method to get custom type names
...
Not used yet
2015-05-23 08:33:39 -04:00
Darik Gamble
a169f01609
Suggest datatypes from a hardcoded whitelist
2015-05-23 08:33:39 -04:00
Darik Gamble
bd3d0fb924
Add test to find_prev_keyword for parentheses
2015-05-23 08:32:13 -04:00
Darik Gamble
70732f0025
drop schema
and create schema
should suggest schemas
2015-05-20 17:59:32 -04:00
Amjith Ramanujam
f906183b7e
Fix a typo in the test fixture setup.
2015-05-14 08:40:27 -07:00
Amjith Ramanujam
0c9c51b4f7
Fix failing tests in Python 2.
2015-05-11 13:34:47 -07:00
Darik Gamble
e060dd398e
improve suggestions in non-trivial WHERE clauses
...
sqlparse groups tokens belonging to the where clause into a single Where token (a subclass of TokenList). In order to handle cases beyond the simplest `SELECT * FROM foo WHERE`, we need to look "inside" of this token list.
2015-05-02 17:33:25 -04:00
Darik Gamble
ff9caf45f4
improve find_prev_keywords
...
1) Add clarifying comments
2) Fix bug where a keyword inside of a TokenList would result in a ValueError
3) Ignore as keywords a fixed list of logical operators
2015-05-02 17:33:23 -04:00
Iryna Cherniavska
dc3f094b1b
Implemented external editor call.
2015-04-20 09:11:36 -07:00
Daniel Rocco
7fe802a33f
Add suggest tests for INSERT INTO, COPY, UPDATE, DESCRIBE, JOIN, and TRUNCATE
2015-04-18 17:34:59 -04:00
Amjith Ramanujam
f4c5e5ae30
Add an extra test for the JOIN USING for good measure.
2015-04-17 09:39:02 -07:00
Amjith Ramanujam
049c51b971
Merge pull request #190 from darikg/joins
...
some join-related improvements
2015-04-16 22:30:38 -07:00
Amjith Ramanujam
7d4e57090c
Merge pull request #202 from drocco007/feature/match-anywhere
...
Completion search text matches user-defined entities anywhere in the name
2015-04-15 06:29:43 -07:00
Amjith Ramanujam
dc94ca3820
Merge pull request #195 from darikg/pg_catalog
...
Improve handling of pg_catalog in metadata
2015-04-14 17:07:28 -07:00
Daniel Rocco
76b44443d1
Completion search text matches user-defined entities anywhere in the name
...
When searching for completions in smart completion mode, a potential
suggestion of a user-specified name (e.g. tables, functions, etc.) is
considered a match if the search text appears anywhere in the
suggestion. Keywords, special commands, and built-in functions still
use startswith matching.
Closes #193
2015-04-12 21:21:51 -04:00
Daniel Rocco
e85116d846
Handle a ',' entered before any completions gracefully
...
Fixes #197
2015-04-11 09:55:34 -04:00
Darik Gamble
41007c549e
bugfix: don't exclude any schemata from metadata queries
2015-04-09 13:00:57 -04:00
Darik Gamble
90974ecff8
support 'JOIN ... USING (' by suggesting columns present in more than one table
2015-04-07 15:43:29 -04:00
Darik Gamble
c7307e5a7d
find_prev_keyword strips everything after the last keyword
2015-04-06 18:30:05 -04:00
Darik Gamble
1fad19a584
bugfix: extract_tables stopped prematurely on INNER JOIN et al
...
check for value.endswith('join') instead of just value == 'join'
2015-04-06 06:30:56 -04:00
Darik Gamble
070b138cf3
bugfix: suggestions were broken after specifying a join type
...
because sqlparse parses things like 'inner join' as a single token, simply checking if token value
matches 'join' fails on further specified join types
2015-04-06 05:52:38 -04:00
Darik Gamble
05dac16040
suggest view names
2015-04-05 16:38:04 -04:00
Darik Gamble
d437f0cabf
pgexecute supports returning view metadata
...
generalize tables() to _relations(relkind_filter), and add convenience methods tables() and views() which simply call _relations() with the appropriate relkind_filter value
similarly, generatize columns() to _columns(relkind_filter), and add convenience methods table_columns() and view_columns()
2015-04-05 16:38:02 -04:00
Amjith Ramanujam
a80eb4ea19
Add a title field and report the notices. Closes #177
2015-03-25 00:26:38 -07:00
Daniel Rocco
9124df2364
Format Decimal values directly as strings
...
Closes #169
2015-03-11 00:59:36 -04:00
Amjith Ramanujam
55120a9958
Merge pull request #170 from darikg/better_dots
...
Better handle schema qualifications in current word
2015-03-08 17:50:23 -07:00
Darik Gamble
2b85eaecb0
Better handle schema-qualified word_before_cursor
...
Previously, if the current word contained a period, `suggest_type` would parse text to the right of the period as `word_before_cursor`, so that characters to the left of the period were parsed as the final token. Then `suggest_based_on_last_token` would generate suggestions under the generic catch-all `elif token_v.endswith('.')`. This means that, for example, `DROP TABLE schema_name.<TAB>` and `DROP FUNCTION schema_name.<TAB>` would each suggest both tables and functions from schema_name.
This commit changes this behavior to include schema qualifications as part of word_before_cursor, so that `suggest_based_on_last_token` operates on the actual preceding token, not just the schema name. This allows each token value to handle schema qualifications differently, and now `DROP TABLE schema_name.<TAB>` suggests only tables from schema_name, and the corresponding `DROP FUNCTION` command only functions.
2015-03-06 08:26:41 -05:00
Daniel Rocco
8e919f1b6c
Interpret incoming JSON as a string instead of via json.loads
...
Closes #163
2015-03-01 00:40:46 -05:00
Darik Gamble
bccde788f3
Watch out for leading whitespace
2015-02-28 08:43:34 -05:00
Darik Gamble
687578eafb
\dn suggests schemas only
2015-02-27 10:06:44 -05:00
Darik Gamble
5d44904aa3
\df suggests only schemas and functions
2015-02-27 10:04:59 -05:00
Darik Gamble
1fa910b7fd
Move pgspecial suggestions to separate method
2015-02-27 10:02:12 -05:00
Amjith Ramanujam
eded02a0a8
Add a test for the special multi-command case.
2015-02-26 23:28:21 -08:00
Daniel Rocco
2f34fbafd6
Only include special command completions at the start of a statement
...
Closes #159
2015-02-25 16:58:01 -05:00
Daniel Rocco
840f3bd3a8
Add completion for CREATE WITH TEMPLATE
...
Closes #156
2015-02-24 12:44:32 -05:00
Darik Gamble
22ed9ddb86
Autocomplete function names
2015-02-17 12:35:56 -05:00
Darik Gamble
896297c440
Store function metadata (not used yet)
2015-02-17 11:38:22 -05:00
Amjith Ramanujam
7091dce672
Revert psycopg2cffi to psycopg2.
2015-02-08 14:54:57 -08:00
Amjith Ramanujam
c5c3047b90
Convert to use cffi. But unicode isn't working.
2015-02-06 22:58:59 -08:00
Amjith Ramanujam
f956fa80ea
Add a test for the boolean printing.
2015-01-31 16:38:47 -08:00
Amjith Ramanujam
d324b27e41
Replace splat import in tests.
2015-01-30 18:59:09 -08:00
Amjith Ramanujam
cf0f33ff01
Add a test for the unicode handling in unknown types.
2015-01-30 18:15:40 -08:00
darikg
13f84bf83e
Fix #106 - autocompletion in multiple statements
2015-01-28 18:21:13 -05:00
Amjith Ramanujam
27a363ee06
Fix broken tests.
2015-01-27 23:12:15 -08:00
Darik Gamble
7d3f276e83
Fix \d special command and add some tests
2015-01-26 08:30:55 -05:00
Darik Gamble
cbca9c62df
Split up smart completion tests into two files
...
One file for simple public schema only tests, and another more focused on schema-aware autocompletion
2015-01-25 16:41:03 -05:00
Darik Gamble
89cffd18ba
Fix failing tests in python 3 by converting dictionaries to tuples so sorted can sort them
2015-01-25 13:15:01 -05:00
Darik Gamble
830d1beaa8
Remove pandas dependency by storing database metadata as lists of tuples
2015-01-25 11:39:03 -05:00
Darik Gamble
7e7051fef7
Merge branch 'master' into schema_autocomplete
2015-01-25 11:37:46 -05:00
Amjith Ramanujam
d2c79d8240
Remove the custom parse_dsn function.
2015-01-23 22:31:37 -08:00
Daniel Rocco
52b684574e
Cast bytea fields to text for output.
2015-01-21 22:50:24 -05:00
Iryna Cherniavska
13f3af72c3
ON keyword now suggests tables and aliases on the right side of equal sign also.
2015-01-19 17:03:44 -08:00
Darik Gamble
98b064b829
fix schema-handling in tests
2015-01-19 13:04:50 -05:00
Amjith Ramanujam
41927cd8d3
Merge branch 'master' into pr127
2015-01-18 22:08:52 -08:00
Amjith Ramanujam
1e59d7a946
Add tests for auto-escaped tables/columns.
2015-01-18 21:52:25 -08:00
Darik Gamble
8bba43e1d7
Add missing import
2015-01-18 19:04:24 -05:00
Darik Gamble
cc6276925f
Get schema names with a direct query instead of stripping them from the tables metadata so we can autocomplete schemata without tables in them
2015-01-18 18:27:25 -05:00
Darik Gamble
78288101c2
Make autocomplete schema-aware
2015-01-18 15:53:47 -05:00
Iryna Cherniavska
c4c61b8ce5
ON keyword suggests either table aliases, or table names.
2015-01-17 22:16:53 -08:00
darikg
ffeb89e406
fix bug where show_help command failed in python 3 due to iteritems() deprecation
2015-01-14 15:19:23 -05:00
Karl-Aksel Puulmann
89547a171e
Support having multiple queries on the same line.
...
Note that if any of the queries raises an error, nothing besides the error is
output. This is different behavior from psql which outputs separately for each
query:
_test_db=# select 1; invalid syntax; select 2;
?column?
----------
1
(1 row)
ERROR: syntax error at or near "invalid"
LINE 1: invalid syntax;
^
?column?
----------
2
(1 row)
2015-01-10 11:55:35 +02:00
Karl-Aksel Puulmann
498257cf37
Fix expanded output package under python 3, add tests for unicode support.
2015-01-09 12:53:42 +02:00
Karl-Aksel Puulmann
b54823c96a
Fix problem with travis not using correct python versions when testing.
2015-01-09 12:33:27 +02:00
Karl-Aksel Puulmann
9632546c4b
Do only one query for all columns, instead of len(tables) queries. Should fix #25
2015-01-09 00:16:55 -08:00
Karl-Aksel Puulmann
b7f9c00c21
Fix issues pointed out in pull request comments.
2015-01-09 00:14:18 -08:00
Karl-Aksel Puulmann
8307a7e642
Simplistic test
2015-01-09 00:14:18 -08:00
Karl-Aksel Puulmann
a87f3a1fcc
Checking if database exists and some initial fixtures which clean up
2015-01-09 00:13:19 -08:00
Stuart Quin
decb370f88
Add test for expected output
2015-01-08 23:38:54 -08:00
Karl-Aksel Puulmann
d566ff3286
Remove the extra tox.ini
2015-01-07 21:55:27 +02:00
Amjith Ramanujam
4e862015f8
Mark the multicolumn sub-select test to xfail.
2015-01-04 23:23:48 -08:00
Amjith Ramanujam
b61663a65c
Move parse_dsn tests to test folder instead of doctests.
2015-01-04 16:20:52 -08:00
Amjith Ramanujam
922a74d58a
Add tox and fix python3 failures.
2015-01-02 00:04:01 -08:00
Amjith Ramanujam
a4460f17cc
Remove the debug statment left in tests.
2015-01-01 00:16:43 -08:00
Amjith Ramanujam
6e622d6dde
Add initial completion support for JOIN statements.
2015-01-01 00:07:31 -08:00
Amjith Ramanujam
1cfdb4c55a
Extract tables from JOIN statements.
2014-12-31 23:17:50 -08:00
Amjith Ramanujam
16af5d0ec1
Add keyword completion for sub-select.
2014-12-30 21:46:16 -08:00
Amjith Ramanujam
0fa38b0e4f
Fix another corner case for table name extraction in nested sql.
2014-12-30 00:22:48 -08:00
Amjith Ramanujam
65c7cdaafa
Fix the table extraction for nested select statement.
2014-12-29 21:43:41 -08:00
Iryna Cherniavska
799d4bc35b
Added tests for multiple column suggestion, dot and alias.
2014-12-28 14:57:51 -08:00
Iryna Cherniavska
335e57215c
added tests for dot and alias
2014-12-27 14:43:49 -08:00
Iryna Cherniavska
5b4644ba34
added naive completion tests
2014-12-27 13:49:35 -08:00
Amjith Ramanujam
665f5e9d0a
Remove the debug statmenet.
2014-12-26 00:41:45 -08:00
Amjith Ramanujam
9763ddb95c
Fix the table parsing for update and add a test.
2014-12-26 00:32:56 -08:00
Amjith Ramanujam
be322144c3
Fix multiple columns for aliased tables.
2014-12-25 02:08:31 -08:00
Amjith Ramanujam
7492594c37
Improve the Insert completion.
2014-12-25 01:55:00 -08:00
Amjith Ramanujam
09c5f28abe
First attempt at dot completion and alias detection.
2014-12-24 23:56:12 -08:00
Amjith Ramanujam
b432811a21
Refactor sqlcompletion to make it work for multiple cols and tables.
2014-12-24 01:32:01 -08:00
Amjith Ramanujam
351686fa33
Make parseutils to work with hanging comma and insert statements.
2014-12-24 00:16:08 -08:00
Iryna Cherniavska
6933b72cb9
added some smart completion tests
2014-12-23 23:59:14 -08:00
Amjith Ramanujam
6a9b224834
Add tests for parse_utils.extract_tables.
2014-12-23 23:29:26 -08:00
Amjith Ramanujam
080675ba0f
Add a check for partially entered col name.
2014-12-20 23:38:48 -08:00
Amjith Ramanujam
c6926dda0a
Add a test for where clause and rename all tests functions.
2014-12-20 22:28:30 -08:00
Amjith Ramanujam
23f3ae3028
Cleanup sql_completion tests.
2014-12-20 14:18:28 -08:00
Iryna Cherniavska
e287787045
attempt to suggest column name when function is typed
2014-12-18 13:57:40 -08:00