Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating a source from a database #66

Closed
rpietka opened this issue Feb 22, 2022 · 5 comments
Closed

Generating a source from a database #66

rpietka opened this issue Feb 22, 2022 · 5 comments

Comments

@rpietka
Copy link

rpietka commented Feb 22, 2022

I'm trying to generate a source from a database. Unfortunately, although the database has objects, none is downloaded and saved to the source. Have output like:
[13:05:36] Using gulpfile c:\Users\rpietka.vscode\extensions\mp.oradew-vscode-0.3.29\dist\gulpfile.js
[13:05:36] Starting 'create'...
[13:05:36] Starting 'createSrcFromDbObjects'...
[13:05:36] Finished 'create' after 18 ms
[13:05:36] Finished 'createSrcFromDbObjects' after 18 ms
[13:05:36] Starting ''...
[13:05:36] Finished '' after 68 ms

Maybe I should set up something extra to make the import work

@mickeypearce
Copy link
Owner

mickeypearce commented Feb 22, 2022

I think I found a bug, schemas (users) to create are read from "DEV" environment. If you are trying to generate a source from non-DEV-named environment (dbconfig.json) it fails. Is this maybe the case?

@mickeypearce
Copy link
Owner

This line needs env as param:

const schemas = dbConfig.getSchemas();

@rpietka
Copy link
Author

rpietka commented Feb 24, 2022

If you talk about trying to download the schematic from DEV as below, it also fails in my case.
{
"DEV": {
"connectString": "0.0.0.0/base",
"users": [
{
"user": "aa",
"password": "aa"
}
]
}
}

@mickeypearce
Copy link
Owner

mickeypearce commented Feb 24, 2022

Try running the following select with SQL Developer or similar, maybe just with owner ("aa" in your example) in where cluase . This is where "create" command gets objects to generate from.

let allObjectsQuery = `
SELECT
owner,
object_id,
object_name,
object_type,
CAST(last_ddl_time AS TIMESTAMP) AS last_ddl_time,
status
FROM
all_objects
WHERE
upper(owner) = upper(:owner)
AND upper(object_type) = upper(nvl(:objecttype, object_type))
AND upper(object_name) = upper(nvl(:objectname, object_name))
AND object_name NOT LIKE 'SYS_PLSQL%'
`;

I suppose you have default values in oradew.json as "source.input" affects the set of objects you are generating.

@rpietka
Copy link
Author

rpietka commented Feb 24, 2022

I'm sorry my mistake. When I reconfigured the connection, I entered the wrong database password.
{ "DEV": { "connectString": "0.0.0.0/base", "users": [ { "user": "aa", "password": "aa" } ] } }
After setting up the DEV environment, I was able to import the database structure. Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants