mickeypearce/oradew-vscode

Generating a source from a database

Closed this issue · 5 comments

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

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?

This line needs env as param:

const schemas = dbConfig.getSchemas();

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"
}
]
}
}

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.

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.