Граф коммитов

79 Коммитов

Автор SHA1 Сообщение Дата
samir-puranik 8aac258e69
Add cascade to drop for trigger and properly format drop script for functions/procedures/trigger functions (#476) 2023-09-01 16:34:31 -04:00
samir-puranik ead422b848
During CREATE script for tables, add CREATE scripts for its associated indexes and triggers (#469)
This PR adds index CREATE and trigger CREATE scripts to the table CREATE script. In the process the following was also changed/updated:
- Trigger templates updated
- Tests for scripting on tables updated to include checks for index and trigger scripts
- Test for trigger updated to use `FUNCTION` instead of `PROCEDURE` because mock server is version 13. The version 13 template uses `FUNCTION` instead
- Index create scripts include `IF NOT EXISTS`
- The metadata.schema value for Indexes and Triggers stores `f'{schema}.{table_or_view_name}'`
- Triggers are now scriptable
- The way Indexes are fetched during scripting is slightly different than before, but more similar to how Triggers are fetched. This is because they are both table_objects
- Indexes are now scriptable even under materialized views
2023-08-28 15:14:03 -04:00
nasc17 c3f1582088
Address broken connections during open sessions (#466)
* reconnect if broken

* update naming

* retry for broken connection during request

* change name of SCRIPTAS_REQUEST

* expand node broken connection

* reconnect during refresh if needed

* lint fix

* test fix init

* none checks for tests

* fix connection during errors

* return after script request exception

* use mock connection for server in test

* put back try catch block for node expansion

* validate error

* mock server

* mock server

* Revert "mock server"

This reverts commit 2cdeeea68f.

* Revert "put back try catch block for node expansion"

This reverts commit a87a34b52e.

* retry state

* add back exception in expand node base

* lint error
2023-08-24 18:50:45 -04:00
samir-puranik a7f10d8b76
Update to function templates (#467)
- Updated template files ensuring
    - add PgAdmin License header
    - change data.func_without_args to data.func_args
    - macros are being pathed to properly
- Using `.server` instead of `._server` outside of NodeObject class
- Added conn to FunctionBase query_data methods
2023-08-24 16:30:33 -04:00
samir-puranik eec418ec10
Fixes to indexes and constraints to be shown properly in OE (#463)
Addresses issues described in microsoft/azuredatastudio-postgresql#452 and microsoft/azuredatastudio-postgresql#453.

- Indexes should now show scripting options regardless of if they are unique or not
- Indexes will not show primary key, but this will show up in constraints. This is following the pattern of PgAdmin
- Constraints should properly show the associated constraints
    1. Check constraints
    2. Exclusion constraints
    3. Index constraints (primary key and unique key)
    4. Foreign key constraints
- Template files were updated for all constraint types
2023-08-23 13:29:39 -04:00
samir-puranik aa4b93f75a
Fixing the Scripting issues for Indexes (#450)
* initial commit

* started to fix style check and tests

* check to see if parent hasattr of schema

* is_sort_nulls_applicable should always be set to true
2023-07-25 12:42:46 -07:00
samir-puranik 994259310a
Fixing CREATE script for Functions (#442)
Fixes create script for functions such that:

- Syntax is correct for immediate execution
- Function body is included for all versions (< 14 and >= 14)
- Should work for procedures and functions

Some template files needed to be changed slightly to prevent using the full properties that are generated for functions in pgAdmin.
2023-07-19 12:12:43 -07:00
nasc17 5f2745b7b9
fix (#433) 2023-06-27 21:31:14 -04:00
nasc17 c76a772a72
Add support for showing stored procedures (#423)
* init routing updates

* procedure templates

* spacing

* script fixes

* remove qtLiteral condition from sql files

* fix quotation issue

---------

Co-authored-by: Daeun Yim <daeunyim@microsoft.com>
2023-06-16 14:38:14 -04:00
Daeun Yim a531607bb6
Psycopg version bump 2 to 3 (#428)
* Fix broken language service

* Fixing tests

* remove qt literals

* Fix test codes

* Fix psycopg2 code

* autopep

* test debugger

* Fix psycopg2 references
2023-06-14 14:48:16 -07:00
Joe Nelson 16c4f46531
Fix display of partitioned tables (#422)
* Include partitioned tables in catalog queries
* Exclude partitions themselves from table list view
2023-06-08 15:57:43 -05:00
nasc17 afcefe90c3
Fix being able to edit tables (#411)
* set metadata

* fix edit table

* fix breaking changes
2023-05-24 11:34:24 -07:00
Daeun Yim e05d2c9dfb
Fix version 15 node expand issue (#408)
* Fix broken language service

* fix version 15 expand issue

* Remove unneccessary change
2023-05-19 14:59:13 -07:00
nasc17 d1e24a84ca
Nasc/database list bug fix (#401)
* add new param

* fix error string

* build fix

* fix argument

* remove illegal option

* mock pg_dump path for test

* version 14

* Revert "remove illegal option"

This reverts commit 0da56482ef.

* fix materialized view space issue

* fix test failing in pipeline

* empty commit to trigger CI

---------

Co-authored-by: Daeun Yim <daeunyim@microsoft.com>
2023-05-09 15:57:20 -07:00
Daeun Yim 7a7fb3b075
Add PG Restore/Dump for version 13 and Fix sequence in column and sequence object (#295)
* pgrestore and dump for version 13

* fix column object and add properties

* fix sequence object and column object

* Broken column object fixed

* style fixed
2021-10-06 10:20:34 -07:00
Daeun Yim cae4e4ecc6
Fix integration tests and resurrect style tests
* downgrade prompt_toolkit add pydevd

* restore language tests for prompt_toolkit new version

* flake tests

* wrong file to test flake8

* Revert "wrong file to test flake8"

This reverts commit b373e399f7.

* configuration bug fix

* fix integration bug

* integration test error message fix

* add connection closing for integration tests

* Change config file logic

* integration test bug fix

* test integration bug fix

* remove config file

* Update integration test

* Update integration_tests.py

* Update integration_tests.py

* integration test bug fix

* Update integration_tests.py
2021-09-13 22:19:07 -07:00
Daeun Yim 3d61b5f027
Bug fixes: CTE, SELECT INTO, Constraints for CREATE TABLE as script (#289)
* fix create as script bug

* Add constraints to script and fix autocomplete bugs
2021-09-07 20:42:32 -07:00
Daeun Yim 872dca36d9
fix table variable error (#287) 2021-08-17 15:39:09 -07:00
Daeun Yim 1b96282ff7
Fixing bug for Table 'Script as Create' and Function 'Script as Create' (#284)
* fix create as script bug

* Fix for function scripting

Fix for function scripting
2021-08-17 14:04:55 -07:00
Kevin Mao 483ff6b177
Refactor tools service to support MySQL provider (#267)
* Merge with MySQL/MariaDB branch

* Adjust services to be provider flexible, added MySQL support and re-branded pgtooslservice to ossdbtoolsservice.
2020-08-12 17:24:41 -04:00
swjain23 0087472bcd
Fix create as view query (#254) 2020-07-29 11:14:57 -07:00
Anup N. Kamath dc634a4556
Include PG11 script files (#212)
* include pg11 script files

* Adding pgadmin4 header for pg11 scripts

* fix the memory view test
2019-06-09 18:55:52 -07:00
ChrisSun-ms 39e98ab032
fix create func issue (#199) 2019-01-18 16:39:57 -08:00
Anup N. Kamath a6ee8efd3a
Fixed edit data changes (#194)
* Fixed edit data changes

* fixing instance type error in prompt_toolkit.completion

* flake8 latest version change recommended changes
2018-12-05 15:55:43 -08:00
ChrisSun-ms 543b31e6e1
Fix function scripting bug (#189)
* init fix

* fix function script bug

* iter 2

* iter 2

* solve style and test failure

* iteration3
2018-01-26 12:59:21 -08:00
ChrisSun-ms bf53597b9e
fix select script (#186) 2018-01-18 17:18:20 -08:00
ChrisSun-ms bd8a0cd659
Making scripting works fine for Database, Table, View, Schema and Function (#182)
* init pr - make sure scripting works solid

* init

* fixing style

* fix styling - 2
2018-01-16 14:53:45 -08:00
Praveen Barli b62d6caffb
added convalidated column in select similar to 9.6 ver script (#173) 2017-11-09 14:54:44 -08:00
Aditya Bist 7409acfc1b shortened template paths for table objects (#163) 2017-10-13 09:57:52 -07:00
Shinil Mannadath 7b55e2a2eb Shinim/feature/pgsmoscripts (#161)
* Stream line the pg scripts

* Bug fixes for PG 10 OE errors and System object scripting

* Bug fixes for PG 10 OE errors and System object scripting

* Bug fixes for PG 10 OE errors and System object scripting
2017-10-11 09:17:55 -07:00
Anup N. Kamath 1f50d541bf PG - Materialized Views (#156) 2017-10-10 15:22:30 -07:00
Shinil Mannadath 9d010abdd6 PG SQL Object Model #1775 - OE System Folders (#147)
* PG SQL Object Model #1775 - OE System Folders

* PG SQL Object Model #1775 - OE System Folders

* PG SQL Object Model #1775 - OE System Folders

* PG SQL Object Model #1775 - OE System Folders
2017-10-03 12:57:53 -07:00
Aditya Bist c8bad8f8aa fixed scripting for PG and ran autopep8 (#145)
* fixed scripting for PG and ran autopep8

* fixed tests and more autopep8 changes
2017-09-29 13:19:18 -07:00
Shinil Mannadath 02554d6797 PG SQL Object Model #1775 (#142)
* PG SQL Object Model #1775

* PG SQL Object Model #1775

* PG SQL Object Model #1775

* PG SQL Object Model #1775
2017-09-28 14:13:10 -07:00
ChrisSun-ms 475f7211b9 scripting service for Constraints, Rule and Trigger (#119)
* init for rule & trigger

* init constraints

* solve styling

* update super class method for constraints

* fix some comments

* fix PR comments

* small fix

* small fix - 2

* styling fix
2017-09-12 10:32:48 -07:00
ChrisSun-ms 7e8d8a2c01 Scripting for Index and test framework change (#130)
* init index.py file

* init test_object_index.py file

* init test_scripter.py file

* init index & change of test framework

* init index & change of test framework - 2

* small fix - styling

* small fix - 3
2017-09-12 10:30:45 -07:00
Matt Irvine c9a0f5422e Add database dashboard search results by handling metadata/list requests (#129) 2017-09-11 13:13:35 -07:00
Ravindra Kasireddy ecc0338741 PGSMO ScriptableSelect mixin and View expand error (#124)
PGSMO ScriptableSelect mixin
2017-09-08 15:08:26 -07:00
Kevin Cunnane 78ecf487f9 Integrate PG-CLI completion code into tools service (#121)
This commit integrates the bulk of the PG-CLI code for auto-completion into our codebase. Putting this out as its own PR for clarity, since the separate work to integrate into the language service will be much smaller. The code has been changed to:

- Avoid supporting CLI-only special syntax
- Make unit tests support the unittest framework rather than pytest
- Integrate with PGSMO in the CompletionRefresher class

**Additional changes**

Added a ThirdPartyNotices.txt with our 2 codebases we're using directly in the code. We'll also want to update this to a) be included in the bundle so it's installed on disk with the exe, and b) add in any module dependencies used at runtime (not test dependencies)
Notes

**Notes**
The code under pgsqltoolsservice\language\completion has been minimally changed from PG-CLI, and should be updatable in the future for changes. Similarly, unit tests under tests\language\completion have been changed from pytest to nosetest + parameterized. 

Long-term will look at whether we can go to a direct pg-cli dependency but this requires investigation re: only building in the modules we need, since it has a lot of extra dependencies, and filtering out / avoiding paths where the special CLI handling is processed. These are candidates for submitting back as config options to their codebase once we're public, since at that point they might be willing to take this and let us factor this cleanly out.
2017-09-07 14:50:23 -07:00
Ravindra Kasireddy 6f2986f31c PG OE: Database support (#102)
* DB support

* DB changes

* PG OE2

* merge2

* Merge with UTC

* PG OE

* UTC

* Merge master 2

* PG OE

* PE OE Master Merge

* PG OE Server Close connection

* PG OE Master merge bugs fix

* PG OE Master merge bugs fix2

* code changes

* check node type

* PG OE with callback function

* Shutdown test case

* clean test case

* PE OE refactoring

* PE OE refactoring2

* flakes

* PE OE refactoring Unit test cases

* closing db connections

* PG OE PR comments

* Removing property oid

* Placing a not for node_object
2017-09-06 14:45:56 -07:00
Anup N. Kamath 3d4765dd48 PG - Edit Data Changes (#117)
Fixed the feedback except the using psycopg2 for generating the queries. We use the mogrify for psycopg which expects the query template to be in certain format. As of now we manually handle escaping any column names of table names. But I will make this change to use SQL from the psycopg2
2017-09-05 11:21:57 -07:00
Benjamin Russell ff62764440 Fix for macro_root issue (#113) 2017-08-31 12:07:52 -07:00
ChrisSun-ms 93a143d358 Table Scripting for Column - Create/Delete/Update (#109)
* init for column

* add missing property- column

* fix query- column

* fix pr comments - column

* fix pr styling - column

* reuse table macros - column

* reuse table macros and fix full_property
2017-08-30 10:29:17 -07:00
Benjamin Russell 51f979c4b4 URNs for PGSMO (#111)
* Initial implementation of URNs for objects
* Lookup logic for URNs
* URN generation logic
* Update to _register_child_collection to map class name to collection, allowing URN lookup implementation in NodeObject

* Tweaks to make it work!

* Wiring it up to the scripting service

* Hacking in support for SELECT

* Unit tests work!

* Adding tests for urn generation

* Adding tests for get_obj_by_urn in server

* Adding tests for getting object by URN at the object level

* Fixing broken unit tests for scripting service

* Adding test for urn utilities

* Flake8 stuff and things
2017-08-29 16:07:54 -07:00
Benjamin Russell 35b18b74f6 PGSMO: Scripting Mixins (#101)
* Mixins for collation work!

* Create mixins for most other things work. Lots of futsing with the unit tests

* Creating mixin for delete

* Creating mixin for update

* Adding unittests for scripting mixins

* Adding unittests for mixins in the classes
Fixing Collation unittests

* Fixing smo edit table metadata tests

* Patching up datatype, disabling mixin testing in the node_base

* Flake8 stuff

* Fixes as per Matt's PR comments

* Rewriting unit tests for scripting service

* Fixing template renderer as per PR comments
Adding tests for template rendering with macros
Adding back tests for scripter

* flake8 nonsense
2017-08-25 09:42:55 -07:00
Kevin Cunnane 073060b9ac Add DataType support in Scripting & OE, and support Sequence & Collation in OE (#99)
- Added DataType support in both OE and Scripting.
- Added unit tests in test_scripting.py. These do some basic template validation - we should go back and add more for the other object types. This actually validates navigating the PGSMO Database and Schema to get the object in addition to template generation. They also do some basic verification of the output.
- Added Sequence and Collation support to OE as this was missed. We need tests for these but don't seem to have a pattern. Created Microsoft/carbon#1716 to track this.
2017-08-22 11:21:03 -07:00
Benjamin Russell d3a8f00053 Remove Connection Dependency for Scripting (#98)
* Removing connection from script methods

* Merge changes

* Removing extraneous server_version method

* Fixing bug with connection variable.

* flake8 nonsense
2017-08-21 16:14:33 -07:00
Praveen Barli 0d939e9c92 collation script changes (#86)
* script changes

* script changes

* delete script changes

* update script changes

* removed default value for mandatory properties

* updated comments

* fixed style errors from flake8
2017-08-16 11:18:01 -07:00
Ravindra Kasireddy 381ff79307 Feature/sequence scripting (#83)
* sequence scripting

* flake changes

* merge

* merged flake changes

* update schema test cases

* update changes

* PR changes

* PR merge
2017-08-11 17:16:34 -07:00
Anup N. Kamath 9ba60ae574 Akamath46297/scripting/functions (#82)
* Initial scripting changes for functions

* Additional changes

* Fixed comments
2017-08-11 16:20:43 -07:00