BigQuery - default expiration time - google-bigquery

How to update the default expiration time for a dataset to never.
Here is an example how it is set to 60 days,
but I would like the dataset to never expired.
ALTER SCHEMA mydataset
SET OPTIONS(default_table_expiration_days=60)

This will work:
ALTER SCHEMA mydataset SET OPTIONS(default_table_expiration_days=null);
It will actually set expiration to never and remove that option from the dataset schema information.

Related

Update already existing columns in table in database in postgresql?

Hi I have a task of assigning nick_name to new users, I added a new column and when a new user is getting created, a nick_name is assigned to it, but what should I do for already existing users (default is not an option here). Every time I do this manually using update statement, Is there a better way to do it?
Thanks
The basic sql-command is
update my_table set nick = username where nick is null;
So you can adjust it to fit the nickname to your needs.

Setting HBase Properties for Particular session

I have a scenario I need to increase hbase.client.scanner.caching to 10000 from 100. But I don't want to make this permanent change, I only need it for that particular session when I am querying from hive querying engine. Is there any way how to set this property for that particular session.
i.e
set hbase.client.scanner.caching = 10000;
SELECT count(*) FROM hive_external_table;
-- but setting the parameter is not taking any effect.
-- where hive_external_table is a external table mapped from hbase_table
Yes, you can definitely set the property value in the same way. Don't give whitespace between key=value.
Use following:
hive> set hbase.client.scanner.caching=10000;
hive> SELECT count(*) FROM hive_external_table;
It will override the default value for the current session.

Phoenix alter table add column fails

I am trying to add a column to an existing phoenix table using alter table command as below
ALTER TABLE TABLE1 ADD "db_name" VARCHAR(20);
Its failing with below warning
WARN query.ConnectionQueryServicesImpl: Unable to update meta data repo within 1 seconds for TABLE1
Let me know, If there is any timeout I need to increase to get this working.
When altering a table, Phoenix will by default check with the server to ensure it has the most up to date table metadata and statistics. This RPC may not be necessary when you know in advance that the structure of a table may never change. The UPDATE_CACHE_FREQUENCY property was added in Phoenix 4.7 to allow the user to declare how often the server will be checked for meta data updates. You can set this property on your table like below
ALTER TABLE TABLE1 SET UPDATE_CACHE_FREQUENCY=900000
Please refer this doc for tuning tips.

Alter DB2 identity to add Cycle Cache and a specific restart value

I want to alter a db2 identity to cycle cache and to make it (re)start with a specific value, something like:
ALTER TABLE ALTER COLUMN
SET GENERATED ALWAYS AS IDENTITY (CYCLE CACHE 100) RESTART WITH 32323
Is there a way of doing this so that I can add cycle cache as well as make it restart from a specific number?
What error are you seeing? What version and platform of DB2?
The following works on DB2 for IBM i 7.1
alter table mytable
alter column mycolumn
set generated always
set cycle
set cache 100
restart with 32323
This worked also
alter table mytable
alter column mycolumn
set generated always as identity
set cycle
set cache 100
restart with 32323

Altering data types within a table using SQL command ALTER

I have researched how to alter table data types and I understand how to do it but I cannot get it to work. I am trying to update my table Person within APP using the following command:
ALTER TABLE APP.PERSON ALTER uName varchar;
What I have tried so far:
using Modify but realised that, after I received errors, this should indeed be ALTER.
changing uName to UNAME.
changing it to a data type of varchar2.
adding in the size of the data type '(20)' and 'NOT NULL' at the end.
Where am I going wrong? I am using Netbeans 7.3 Beta 2 running on Mac OS X, this is all being done within the SQL Commands section of Netbeans, using Java-DB as my database if any of that matters.
It has already been answered here on SO. You basically need to create new column with desired datatype and delete the old one. However, if you take a look into Apache Derby doc, there is a SET DATA TYPE command, so try something like
ALTER TABLE APP.PERSON ALTER UNAME SET DATA TYPE VARCHAR(30)
EDIT
If code above doesn't work, then you just have to recreate the column as I suggested before.
ALTER TABLE APP.PERSON ADD COLUMN UNAME_NEW VARCHAR(30);
UPDATE APP.PERSON SET UNAME_NEW = UNAME;
ALTER TABLE APP.PERSON DROP COLUMN UNAME;
RENAME COLUMN APP.PERSON.UNAME_NEW TO UNAME;
Most databases require specific permissions to use DDL (Data Definition Language) commands like ALTER TABLE. Very often, the DB credentials used in an application tier do not have DDL permissions in the database.
Verify that the connection you are using has permission to run ALTER TABLE. If indeed it does, post the specific code you are using and any specific error messages.
I don't have JavaDB to test on, but according to the documentation it should be;
ALTER TABLE APP.PERSON ALTER uName SET DATA TYPE VARCHAR(20)