I have need to add additional Columns to each file under a folder.
I am getting error
E_CSC_USER_DATAPARTITIONEDOUTPUTNOTSUPPORTED: Data partitioned output is not supported.
#q =
EXTRACT OrderID int,
OrderDate DateTime?,
CustomerName string,
PhoneNumber string,
DeliveryAddressLine1 string,
DeliveryAddressLine2 string,
CityName string,
StockItemID int?,
Quantity int?,
UnitPrice float?,
filename string,
extension string
FROM "/Orders/{filename}.{extension}"
USING Extractors.Tsv(skipFirstNRows:1);
OUTPUT #q TO "/Orders/Processed/{filename}.{extension}"
USING Outputters.Csv(outputHeader:true);
Currently dynamic partitioned output (aka using {} wildcards in output paths) is currently in preview. If you're interested, please email usql at Microsoft dot com with more information about your scenario to see if the preview would work for you.
Otherwise, you could script your output via U-SQL or Powershell. Example here.
Related
I'm new to TIBCO BW6. This is my scenario. I have a .csv file, and one of my columns is a string in this format: '31/08/2021 15:18:00'
I created a process that reads my file and inserts a new row into my database. I have a problem with the date.
In my palette JDBC Update, the date is a timestamp. When I match the input, the right pattern for matching my string in datetime is pattern yyyy-mm-dd hh:mm:ss.
To do this kind of thing the best solution is generally to use the SQL database formatting functions in your SQL query.
Something like this (for ORACLE) :
insert into table_name
(my_date_field)
values (TO_DATE('2022/01/23 11:25:44', 'yyyy-mm-dd hh24:mi:ss'));
In BusinessWorks the query would look like this and you would have to map the value of the field corresponding to the '?' with your actual timestamp :
insert into table_name
(my_date_field)
values (TO_DATE(?, 'yyyy/mm/dd hh24:mi:ss'));
In a React Native App I'm attempting to insert data into a local sqlite db
let submissionID = "1-2-3";
this.dbQuery("INSERT INTO Submissions (ID, Data) VALUES("+submissionID+",'Test')");
(dbQuery is the name of a function I made to simplify my queries but the statement inside it should be the same)
If I viewed the Submissions table after this insert statement I would expect to see a row with [ID:"1-2-3",Data:"Test"] but instead I see [ID:"-4",Data:"Test"]
I created the table like so
CREATE TABLE IF NOT EXISTS Submissions(ID BLOB PRIMARY KEY NOT NULL, Data BLOB NOT NULL)
I used Blob because I read "The value is a blob of data, stored exactly as it was input." but I've also tried Text. I've also casted submissionID as a string like so
this.dbQuery("INSERT INTO Submissions (ID, Data) VALUES("+String(submissionID)+",'Test')");
But none of that worked. I do see here how sqlite takes advantage of arithmetic operators
https://www.w3resource.com/sqlite/arithmetic-operators.php
but I'm not sure how to stop it from doing so.
How would I get sqlite to treat my hyphens as hyphens instead of subtraction signs?
What you're doing is the equivalent of:
this.dbQuery("INSERT INTO Submissions (ID, Data) VALUES(1-2-3,'Test')");
passing the numeric expression 1-2-3 to the INSERT statement. The simplest fix is to quote the string literal.
let submissionID = "1-2-3";
this.dbQuery("INSERT INTO Submissions (ID, Data) VALUES('"+submissionID+"','Test')");
However, to guard against SQL injection attacks, you really ought to be using prepared statements instead of using string concatenation to build SQL statements.
Enclose the string in single quotes i.e.
this.dbQuery("INSERT INTO Submissions (ID, Data) VALUES('"+String(submissionID)+"','Test')");
Thus the value is treated as a literal by SQLite, without enclosing the value it will either be treated as a numeric value or as an identifier (column, table, trigger, view depending upon where it is coded and thus what the parser expects).
The data type (column affinity) has little bearing other than if you specified ID INTEGER PRIMARY KEY, then you could not store anything other than an integer. As ID INTEGER PRIMARY key has a special interpretation that is the column is an alias of the rowid.
I used Blob because I read "The value is a blob of data, stored
exactly as it was input." but I've also tried Text. I've also casted
submissionID as a string like so
That is only if the value to be inserted is a BLOB byte[] or in the case of raw SQL x'FF01FE02', otherwise SQLite will store the value according to how it interprets the type should be stored.
I have a table called deliverysimp into which I am trying to insert some data. I am aware that the data types for the columns are just affinities and not restrictions, however I need to store the parcelid column below as TEXT.
CREATE TABLE IF NOT EXISTS deliverysimp (parcelid TEXT, expected integer, primary key (parcelid))
I am using the following javascript to insert the data to the database:
context.executeSql("INSERT INTO deliverysimp(parcelid, expected) values(?,?)",
[
'' + delivery.parcelid,
delivery.expected
], function () { }, me.ErrorHandler);
You can see I have tried to add a blank '' + before the parcelid to try and force the affinity, but the behaviour is the same without; namely:
if I try to store the parcelid 33333333333322222222222222222222223 this is stored into the database as 3.3333333333322223e+34 and I need this to be a text/string representation.
Any ideas how I can get SQLite to honour this as TEXT?
I suspect that you already have a string, just not the string you expected. Since the number you have cannot be represented by an 8-byte integer, it gets converted into a real number and that gets converted into a string, i.e., '3.3333333333322223e+34'. So, if you want the value to be '33333333333322222222222222222222223', then that's what you have to insert into the table.
To check, do a SELECT parcelid, TYPEOF(parcelid) FROM deliverysimp; using the sqlite3 command-line tool and see what you get.
i am using lua module inside nginx for routing to a stored string.
The thing i want to do is to change the values of query string parameters from the stored string.
Is there any function which will give me table of query string parameters from a string?
And after changing the values, any function to change the values from the string.
Thanks
I think you're looking for ngx.encode_args and ngx.decode_args respectively.
I'm using SQLite 3.7.4 (within my c++ app under Ubuntu PP) and when I try to save string like "000000" it saves just one char "0". I tried it in console too - is it feature, or bug? How can I get rid of that?
For example:
CREATE TABLE status (readTime INTEGER, status STRING);
INSERT INTO status (readTime, status) values(1234, "000000");
INSERT INTO status (readTime, status) values(4321, "111111");
SELECT * FROM status;
1234|0
4321|111111
Some quick research points to the fact that STRING is not a recognized type in SQLite (or, I believe, most other SQL dialects). However, SQLite isn't strict with its types, so the type defaulted to NUMERIC. You should be able to change the column type to TEXT to resolve your issue.
Further reading: Type Affinity
"STRING" isn't a SQLite data type. Try "TEXT".