Open bitjson opened 7 years ago
If someone is interested on implementing this. Here is the steps in a high level:
server-db-client-<client_name>.png
https://github.com/sqlectron/sqlectron-gui/tree/master/src/renderer/componentslistRoutines is the first one mentioned by the cockroachdb staff.
Not exactly sure how to test this on Windows with Cockroachdb.
Also buildSchemaFilter is not correct.
export async function listRoutines(conn, filter) {
const schemaFilter = buildSchemaFilter(filter, 'pg_catalog');
const sql = `
SELECT
nspname,
proname,
typname
FROM pg_catalog.pg_proc
JOIN pg_catalog.pg_type t ON prorettype = t.oid
JOIN pg_catalog.pg_namespace n ON pronamespace = n.oid
${schemaFilter ? `WHERE ${schemaFilter}` : ''}
GROUP BY nspname, proname, typname
ORDER BY proname, typname
`;
const data = await driverExecuteQuery(conn, { query: sql });
return data.rows.map((row) => ({
schema: row.mspname,
routineName: row.proname,
routineType: row.typname,
}));
}
SELECT a.attname as column_name,
t.typname as data_type
FROM pg_catalog.pg_attribute a
JOIN pg_type t ON ( t.oid = a.atttypid )
JOIN pg_class r ON ( r.oid = a.attrelid )
JOIN pg_namespace s ON ( s.oid = r.relnamespace )
WHERE r.relkind = 'r'
AND s.nspname = 'database_name'
AND r.relname = 'table_name';
For listTableColumns(conn, database, table, schema). Note that schema does not exist and only database exists in CockroachDB.
If schema
is not supported by the database you can just ignore that value.
What's the best way to interactively modify the client code on sqlectron gui and have it change the code?
I'm on Windows.
Won't be able to work on this until next weekend, I've got tables and their columns and constraints shown.
If anyone wants the work I can gist it.
Any updates on this? @fire could you gist it?
I can't find my copy anymore.
In my version I made a copy of https://github.com/sqlectron/sqlectron-core/blob/master/src/db/clients/postgresql.js and added https://github.com/sqlectron/sqlectron-gui/issues/312#issuecomment-322185375
Stopped working on it because there was no interest.
I'd love to see first-class support for CockroachDB – CockroachDB supports the PostgreSQL wire protocol, so it should be relatively simple to add support.