Equivalent of SHOW CREATE SCHEMA in Presto - presto

Is there an equivalent of SHOW CREATE SCHEMA in presto? I just want to see the value of the location field.

Presto do not support SHOW CREATE SCHEMA. It only supports SHOW CREATE option for VIEW and TABLE.

Related

OBJECT_DEFINITION for VIEW in Azure Databricks

As the Title says, is it able to query object definition of the view in Databricks using SQL, especially for Azure Databricks?
like when using SQL Server, I'm able to query the view definition using function OBJECT_DEFINITION or Stored Procedure sp_helptext to display the SELECT statement within Views.
I'm looking all over the internet, don't find one that explains about this. May be there isn't an option?
thanks.
It's maybe not very obvious, but you can use SHOW CREATE TABLE SQL command for that - it works for both tables & views. For example if I have view as following:
create view if not exists tacls.tbl1_view as
select * except(grp) from tacls.tbl1;
then I can get definition with
show create table tacls.tbl1_view
the definition will be in the createtab_stmt column:

Fetch all tables in a particuler Postgres database using node?

I need to fetch all tables in a particular Postgres database using node. But not finding any way to achieve that. Is there any way to get that?
For example, suppose I have a database named 'TestDatabase' it contains 4 tables( just assume it can have less or more) Person, Company, Clothes, Animal.
I need to get the name of all of them using node.
I am also using node-postgres ('pg') to connect with the database.
As an alternative you can use information_schema. It is not better then the pg_* objects in the system catalog but is standardized and more portable. Here it is:
select table_schema||'.'||table_name as table_fullname
from information_schema."tables"
where table_type = 'BASE TABLE'
and table_schema not in ('pg_catalog', 'information_schema');
The system objects have been filtered by this expression
table_schema not in ('pg_catalog', 'information_schema')
You can further modify it to only include schemas that you need.
This is a generic solution. Use the query below:
SELECT
relname
FROM
pg_class
WHERE
relkind = 'r';
pg_class is the system catalog that holds information on table like objects. Hence the need to restrict relkind to 'r'. This will include all table types. To further restrict see relpersistence at link below.
https://www.postgresql.org/docs/current/catalog-pg-class.html

Schema crawler reading data from table

I understood we can read data from a table using command in Schema crawler.
How to do that programatically in java. I could see example to read schema , table etc. But how to get data?
Thanks in advance.
SchemaCrawler allows you to obtain database metadata, including result set metadata. Standard JDBC provides you a way to get data by using java.sql.ResultSet, and you can use SchemaCrawler for obtainting result set metadata using schemacrawler.utility.SchemaCrawlerUtility.getResultColumns(ResultSet).
Sualeh Fatehi, SchemaCrawler

Can orm2 create a table automatically?

I use Hibernate in J2ee, when the datebase has't table the framework can create table and when fields changed it can update datebase, Can orm2 be done?
As this wiki pages explains, orm2 can create the database tables if they do not exist. Update of an database table is possible by another library, however i haven't tried this: https://github.com/dresende/node-orm2/issues/103

Unable to create nested collection datatype

I am not able to create collection inside another collection in Cassandra. Please find error details below
cqlsh:TestKeyspace> create table users2(user_id text primary key, feeschedule map<text,set<text>>);
Bad Request: map type cannot contain another collection
Here I am trying to create column named feeschedule with type Map and Map have values which is of type List.
Could anybody suggest me how do I achieve it in Cassandra.
My Cassandra version details are given below:
cqlsh version- cqlsh 4.1.0
Cassandra version – 2.0.2
Thanks in advance,
You are correct, nested collections are not supported.
You will be able to do something similar with user-defined types, but not until 2.1: https://issues.apache.org/jira/browse/CASSANDRA-5590

Resources