I need help with a permission error while accessing a freshly created dictionary.
My source file for a dictionary is as follows:
$ ls -l /root/organization.csv
-rwxrwxrwx 1 clickhouse clickhouse 154 Jul 7 14:56 /root/organization.csv
$ cat /root/organization.csv
1,"a0001","研发部"
2,"a0002","产品部"
3,"a0003","数据部"
4,"a0004","测试部"
5,"a0005","运维部"
6,"a0006","规划部"
7,"a0007","市场部"
I create my dictionary as follows:
CREATE DICTIONARY test_flat_dict
(
id UInt64,
code String,
name String
)
PRIMARY KEY id
SOURCE(FILE(PATH '/root/organization.csv' FORMAT CSV))
LAYOUT(HASHED())
LIFETIME(0);
Then I'm trying to test a dictionary by a simple SQL query:
SELECT * FROM test_flat_dict
But I'm getting the exception:
Received exception from server (version 21.6.3):
Code: 156. DB::Exception: Received from localhost:9000. DB::Exception: Failed to load dictionary 'eeedf011-4a41-4337-aeed-f0114a414337': std::exception. Code: 1001, type: std::__1::__fs::filesystem::filesystem_error, e.what() = filesystem error: in canonical: Permission denied [/root/organization.csv] [""],
What might be wrong with my dictionary?
As it stated on ClickHouse documentation:
When dictionary with source FILE is created via DDL command (CREATE
DICTIONARY ...), the source file needs to be located in user_files
directory, to prevent DB users accessing arbitrary file on ClickHouse
node.
I would doubt that ClickHouse has the ability to retrieve files from the root home folder, even if your file has 777 mode.
So I would propose you put the data file under ./user_files folder (it's in the root of ClickHouse data folder).
Related
i have multiple folders on my disk and each folder has pdf files (4 files in each folder). How can i insert files in each folder in oracle table rows. the folder name will make primary key (being unique social svc #). i have used code as is from this link but i get following error:-
ora-22285 non-existent directory or file for fileopen operation
ora-06512 at sys.dbns_lob line 805
i ve also granted all permissions on the directory to my user with command:-
grant all on directory blob_dir to testuser
pl tell me what am i doing wrong.
if you going to use BLOB data type then you can upload data from external file using SQL*Loader. In case you are going to use BFILE then you just need to copy files into Oracle Server file system and grant access to it via DIRECTORY object with READ privelege. BFILE provides read only access to external files via SQL.
After executing a pg_dump from PostgeSQL, I attempted to import the .sql file into CockroachDB, but received the following errors:
ERROR: unknown variable: "STATEMENT_TIMEOUT"
ERROR: unknown variable: "LOCK_TIMEOUT"
ERROR: unknown variable: "IDLE_IN_TRANSACTION_SESSION_TIMEOUT"
SET
SET
ERROR: unknown variable: "CHECK_FUNCTION_BODIES"
SET
ERROR: unknown variable: "ROW_SECURITY"
SET
ERROR: unknown variable: "DEFAULT_TABLESPACE"
ERROR: unknown variable: "DEFAULT_WITH_OIDS"
CREATE TABLE
ERROR: syntax error at or near "OWNER"
Any guidance?
CockroachDB has special support for using psql, which supports the COPY command (which is faster than batched INSERT statements).
You'll need to do two things:
Clean up the SQL file
Import it into CockroachDB (which sounds like you tried, but I'll include the steps here for anyone else who needs them):
Clean up the SQL File
After generating the .sql file, you need to perform a few editing steps before importing it:
Remove all statements from the file besides the CREATE TABLE and COPY statements.
Manually add the table's PRIMARY KEY constraint to the CREATE TABLE statement.
This has to be done manually because PostgreSQL attempts to add the primary key after creating the table, but CockroachDB requires the primary key be defined upon table creation.
Review any other constraints to ensure they're properly listed on the table.
Remove any unsupported elements, such as arrays.
Import Data
After reformatting the file, you can import it through psql:
$ psql -p [port] -h [node host] -d [database] -U [user] < [file name].sql
For reference, CockroachDB uses these defaults:
[port]: 26257
[user]: root
I am having trouble with Teradata's HCTAS procedure when I use it to create a table in Hadoop.
I call HCTAS to create the table,
CALL SYSLIB.HCTAS('test_table',null,null,'myserver','default');
*** Procedure has been executed.
but when I try to insert data into that table, I get a permission denied.
INSERT INTO test_table#myserver SELECT * FROM test_table;
*** Failure 7810 [TblOp] Permission denied: user=myuser, access=WRITE, inod
e="/apps/hive/warehouse/test_table":hive:hdfs:drwxr-xr-x
at org.apache.hadoo
p.hdfs.server.namenode.FSPermissionChecker.checkFsPermission(FSPermissionChec
ker.java:265)
at org.apache.hadoop.hdfs.s.
Statement# 1, Info =0
I checked Hadoop and found that the directory was created with owner as 'hive' instead of 'myuser'.
drwxr-xr-x - hive hdfs 0 2015-08-05 21:45 /apps/hive/warehouse/test_table
What should I do so that the directories will be created with 'myuser' as the owner?
Thanks
The 3rd parameter is used to specify the directory, try
CALL SYSLIB.HCTAS('test_table',null,'LOCATION "/usr/myuser"','myserver','default');
As you can see this is a write permissions problem, because myuser does not have permissions to write in /hive/warehouse/.
Oh the other hand, as you can see here, you can specify the location of the table where you are sure that myuser has write permissions (personal folder in the HDFS maybe). In this way you will not have write permissions problems.
I am trying to create a the following table in postgresql
CREATE TABLE retail_demo.categories_dim_hawq
(
category_id integer NOT NULL,
category_name character varying(400) NOT NULL
)
WITH (appendonly=true, compresstype=quicklz) DISTRIBUTED RANDOMLY;
I am getting the following error:
ERROR: cannot get table space location for content 0 table space 1663
(catalog.c:97)
I tried to create a new tablespace, I got the following:
ERROR: syntax error at or near "LOCATION" LINE 1: create TABLESPACE
moha LOCATION "/tmp/abc";
Thanks in advance,
Moha.
I got the answer
you’ll need to create a filespace, tablespace, database, and then create the table to do this follow the following steps:
12. If you are on the default database (using plsql command), you can get out to root db user (gpadmin) using CTRL + D.
13. gpfilespace -o .
14. enter the name of the filespace: hawqfilespace3
15. Choose filesystem name for this filespace: hdfs
16. Enter replica num for filespace: 0
17. Specify the HDFS location for the segments: bigdata01.intrasoft.com.jo:8020/xd
Note that /xd is one of Hadoop directories which has read write access.
18. The system will generate a configuration command to you, just execute it.
19. Copy and paste the command and click on enter to execute it.
20. The file space is now created successfully.
21. Now connect to the Database using the psql command.
22. Now create a tablespace on the file space you created.
create TABLESPACE hawqtablespace3 FILESPACE hawqfilespace3;
23. Create a database on this tablespace using the command.
CREATE DATABASE hawqdatabase3 WITH OWNER gpadmin TEMPLATE=template0 TABLESPACE hawqtablespace3;
24. Now you need to connect to the database you created, but first click CTRL + D to exit the user you are in.
25. Enter the command psql hawqdatabase3
I ran the below create script and it created the table:-
Create writable external table FLTR (like dbname.FLTR)
LOCATION ('gpfdist://172.90.38.190:8081/fltr.out')
FORMAT 'CSV' (DELIMITER ',' NULL '')
DISTRIBUTED BY (fltr_key);
But when I tried inserting into the file like insert into fltr.out select * from dbname.fltr
I got the below error, cannot find server connection.
Please help me out
I think your gpfdist is probably not running try:
gpfdist -p 8081 -l ~/gpfdist.log -d ~/ &
on 172.90.38.190.
This will start gpfidist using your home directory as the data directory.
When I do that my inserts work and create a file ~/fltr.out