Column is not accessible using sybase - sas

I'm trying to load a table using SAS but getting an error. This code worked in the past, but since sybase was upgraded it doesn't work with SAS.
proc sql;
connect to odbc as db (dsn=sas_xxx uid=&user pwd=&pass insertbuff=2048connection=shared);
execute(set temporary option escape_character=on) by db;
execute(CREATE TABLE #tomatch (ID int,
DOB int,
NAME_LAST varchar(20),
NAME_FIRST varchar(15),
)) by db;
execute(LOAD TABLE #tomatch (ID, DOB, NAME_LAST, NAME_FIRST)
USING CLIENT FILE "/home/5n0rb/MIGRATE/input/FCRA/&location..csv"
QUOTES ON
ESCAPES OFF
FORMAT BCP
DELIMITED BY ','
ROW DELIMITED BY '\x0a'
SKIP 1) by db;
ERROR: CLI execute error: [SAP][ODBC Driver][SAP IQ]Syntax error - Column is not accessible in this context. --
(dflib/df_Heap.cxx 2763)

Related

Poco ODBC MS SQL: temp tables

I want to create temp tables and use it later in one session. I can create it, but then when I try to use to I receive:
[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid object name #my_table
I try the same queries in SSMS and everything works correctly.
For example
...
std::shared_ptr<Poco::Data::Session> session;
...
Poco::Data::Statement createStatement(*session);
createStatement<< create_temp_table_and_insert_into_temp_table;
createStatement.execute();
Poco::Data::Statement insertStatement(*session);
insertStatement<< select_from_temp_table;
insertStatement.execute(); <- exception Invalid object name
Another example
...
std::shared_ptr<Poco::Data::Session> session;
...
*session.get() << "IF(OBJECT_ID('tempdb..#test') is not null) drop table #test;";
*session.get() << "create table #test (s1 int,s2 int ,s3 int);";
*session.get() << "insert into #test select 1,2,3";
typedef Poco::Tuple<int, int, int> testParam;
std::vector<testParam> testParams;
*session.get() << QString("select * from #test").toStdString(), Poco::Data::Keywords::into(testParams),
Poco::Data::Keywords::now;
I tried the same with qt odbc driver and queries also work. I also tried Driver={ODBC Driver 17 for SQL Server} and old driver DRIVER={SQL Server} too.

Does AWS Athena supports Sequence File

Has any one tried creating AWS Athena Table on top of Sequence Files. As per the Documentation looks like it is possible. I was able to execute below create table statement.
create external table if not exists sample_sequence (
account_id string,
receiver_id string,
session_index smallint,
start_epoch bigint)
STORED AS sequencefile
location 's3://bucket/sequencefile/';
The Statement executed Successfully but when i try to read data from the table it throws below error
Your query has the following error(s):
HIVE_CANNOT_OPEN_SPLIT: Error opening Hive split s3://viewershipforneo4j/2017-09-26/000030_0 (offset=372128055, length=62021342) using org.apache.hadoop.mapred.SequenceFileInputFormat: s3://viewershipforneo4j/2017-09-26/000030_0 not a SequenceFile
This query ran against the "default" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 9f0983b0-33da-4686-84a3-91b14a39cd09.
Sequence file are valid one . Issue here is there is not deliminator defined.
Ie row format delimited fields terminated by is missing
if in your case if tab is column deliminator row data is in next row it will be
create external table if not exists sample_sequence (
account_id string,
receiver_id string,
session_index smallint,
start_epoch bigint)
row format delimited fields terminated by '\t'
STORED AS sequencefile
location 's3://bucket/sequencefile/';

Django with Oracle database 11g

I am new to the python language and django. I need to connect the django to the oracle database 11g, I have imported the cx_oracle library and using the instant client for connecting oracle with django, but when i run the command manage inspectdb > models.py. I get error as Invalid column identifier in the models.py. How could i solve it. I have only 2 tables in that schema i am connecting?
"Invalid column" suggests that you specified column name that doesn't exist in any of those tables, or you misspelled its name.
For example:
SQL> desc dept
Name
-----------------------------------------
DEPTNO
DNAME
LOC
SQL> select ndame from dept; --> misspelled column name
select ndame from dept
*
ERROR at line 1:
ORA-00904: "NDAME": invalid identifier
SQL> select imaginary_column from dept; --> non-existent column name
select imaginary_column from dept
*
ERROR at line 1:
ORA-00904: "IMAGINARY_COLUMN": invalid identifier
SQL>
Also, pay attention to letter case, especially if you created tables/columns using mixed case and enclosed those names into double quotes (if so, I'd suggest you to drop tables and recreate them, without double quotes. If you can't do that, you'll have to reference them using double quotes and exactly the same letter case).
So - check column names and compare them to your query. If you still can't make it work, post some more information - table description and your code.
I've faced the same problem. The problem is that Django expects your table have primary key (ID), so when your table is without key, it returns Invalid columns identifier.
https://docs.djangoproject.com/en/2.1/topics/db/models/#automatic-primary-key-fields

SQL String error? No Such Column

I'm using sqlite3 in my c++ program and am trying to run an SQL string in the
sqlite3_get_table function.
Here's my sql string.
SELECT name FROM sqlite_master WHERE type='table' AND name=test_table;
I keep getting the error "no such column "test_table"" .
All I am trying to do is confirm the existence of a table in my database. That's all.
Any clues as to what's wrong with my string.
In SQLite double quotes ('"') is the identifier-escape character, so assuming this is your SQL (raw SQL, nothing to do with C++):
SELECT
name
FROM
sqlite_master
WHERE
type = 'table'
AND
name = "test_table;"
Is equivalent to:
...
name = test_table
...which obviously isn't what you want.
You should use single-quoted strings in SQL, and the statement-terminating semicolon should go at the very end:
SELECT
name
FROM
sqlite_master
WHERE
type = 'table'
AND
name = 'test_table';

SQL Error ORA-01002 not autocommit and loop

I'm using pro c/c++ in a unix environment. Inside a c function I create a simple select statement which is not inside a loop and autocommit is disabled.
This is the dynamic sql;
char sql_statement[200];
int num1, num2;
...
snprintf(sql_statement, sizeof(sql_sattement), "select column1, column2 from '%s' where num = '%d' and code_cfg = '%d'", "customer", 0, 0);
exec sql prepare instruction_to_execute from :sql_statement;
exec sql declare crs cursor for instruction_to_execute;
exec sql open crs;
exec sql fetch crs into :num1, :num2;
...
Executing this code gives me ORA-01002 error. As I said before, this code is not inside a loop and autocommit is off.
But if I write this code statically, works fine. Below the code:
EXEC SQL
SELECT column1, column2
INTO :num1, :num2
FROM CUSTOMER
where num = 0
AND code_cfg = 0;
SQL instruction is simple. For my understanding this code should be executed fine.
In SO I found some answers:
ORA-01002: fetch out of sequence C++
ORA-01002: fetch out of sequence
Hibernate error “ORA-01002” when persisting entity with custom Sequence Generator
ORA-01002: fetch out of sequence
java.sql.SQLException: ORA-01002: fetch out of sequence