I am trying to run a Oozie Job that used to work perfectly earlier.
But now I get this following error:
Caused by: org.apache.openjpa.persistence.PersistenceException: The database 'v0201xxxxxxxxxxxxxxxxxxxxooziemetastore' has reached its size quota. Partition or delete data, drop indexes, or consult the documentation for possible resolutions. {prepstmnt 1642246000 UPDATE WF_ACTIONS SET error_code = ?, error_message = ?, external_status = ?, last_check_time = ?, pending_age = ?, status = ? WHERE id = ? [params=?, ?, ?, ?, ?, ?, ?]} [code=40544, state=S0001]
FailedObject: org.apache.oozie.WorkflowActionBean-0014872-140428144646972-oozie-hdp-W#RunHiveScript
at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4869)
at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4829)
at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136)
Sounds like your meta-store is probably full.
You should check the SQL Azure database you're using for the metastore, and ensure it's not hitting its size cap.
If you're using 150GB of metastore space, you may have a problem since that's the current limit, but if your database is capped lower, you can just scale up the size limit.
Related
I have a web application (builted with a servlet and JSP pages) and the DB is SQLITE.
In some point I want to check the whole table and replace any records if needed.
I try to update my table by (I use PreparedStatements)
sq = "INSERT OR REPLACE INTO myTable VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
All the records are 5000 and the process takes several minutes to complete... I noticed that for every record regardless if it is changed or not, the row is modified as I get always rowsAffected = 1
for(Label l:labels){
stm.setString(1, l.getOldName());
//etc...
rowsAffected = stm.executeUpdate();
System.out.println("rowsAffected = " + rowsAffected);
}
Is there any other more optimal way to update my table?
The INSERT statement always adds one row. All the REPLACE clause does is to delete the old row, if there is one that conflicts.
If you want to avoid changing rows unnecessarily, you have to do a SELECT first to check the old values, then do UPDATE or INSERT or nothing as needed.
To speed up the process, put the entire loop into a single transaction.
Based on a Textbox object, I am using an INSERT query to add the text into a record to a SQLite table:
INSERT INTO tblActivity ([Activity_Category],
[Activity_Category_Sub],
[Activity_Start],
[Activity_End],
[Activity_Duration])
Values ('" + clVariables.strActivityCurrent + "', '"
+ clVariables.strActivitySubCurrent + "', '"
+ clVariables.datActivityStart.ToString() + "', '"
+ clVariables.datActivityEnd.ToString() + "', "
+ clVariables.dblActivityDuration + ")"
It is possible that clVariables.strActivitySubCurrent could contain either " or ', and I wanted to know the correct way to be able to add these characters to the field.
Thank you.
The correct way is to use a prepared statement:
INSERT INTO tblActivity (
"Activity_Category",
"Activity_Category_Sub",
"Activity_Start",
"Activity_End",
"Activity_Duration")
VALUES (?, ?, ?, ?, ?)
You then bind the values to the parameters in the prepared statement (the ?, so we're using positional parameters here) when you execute it, and you don't have to work out how to quote the strings. Even better, the DB engine doesn't have to recompile the statement for each row you execute.
The only time this is awkward is if you are using the SQLite shell, which doesn't support parameters (there's not really a true host language to do the binding in) but you can do bulk import there in other ways (and you can get away without them for ad hoc querying work). But I'm guessing that you're hosting in another language, probably C#, in which case you've got no excuse for doing it wrong. It doesn't take more work to code, but it does take different work.
(Now, if you were taking table or column names from the user that would be different, as they can't be parameterized. It would also be a little bit horrifying.)
I am using sqlite database and I declared the models as in this gist
https://gist.github.com/mmahesh/7245561
I have added a model instance with transaction manager as
with transaction.manager:
model = Users(username='example',name='Example', email_primary='m#m.com', _password='example')
DBSession.add(model)
Whenever I execute initialize_sample_db development.ini, this error shows up
sqlalchemy.exc.IntegrityError: (IntegrityError) constraint failed 'INSERT INTO users (name, username, email_primary, email_secondary, _password, bio) VALUES (?, ?, ?, ?, ?, ?)' ('Example', 'example', 'm#m.com', None, 'example', None )
Additional Information:
when i use sqlite3 command tool and after '.d' command i get
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
COMMIT;
Thanks in advance
In table users you have defined column id as primary key.
However, in your INSERT statement you do not provide id.
That would be totally fine if id was auto-increment column - but it is not.
Solution is to add sqlite_autoincrement=True into your users table definition.
Also, your users table definitions seems to be too strict - you require most fields to be non-nullable. It depends on your task, but sometimes being too strict can be bad idea - it will also cause constraint violation if you forgot (or simply don't want) to fill one of those fields.
In my table called "test01" I keep getting an error when I run the site.
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '[test01]' at line 1
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: MySql.Data.MySqlClient.MySqlException: You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '[test01]' at
line 1
From what I can see it is because the code that it is generating when I bring toolbox items and drop them in design view is this:
SelectCommand="SELECT * FROM [test01]"
DeleteCommand="DELETE FROM [test01] WHERE [test_id] = ?"
InsertCommand="INSERT INTO [test01] ([test_id], [TestName], [TestDescription]) VALUES (?, ?, ?)"
UpdateCommand="UPDATE [test01] SET [TestName] = ?, [TestDescription] = ? WHERE [test_id] = ?">
When I remove the [ ] brackets it works fine. Is there something I can do to change the functionality of this?
I hope this question makes sense!
Brackets are a MSSQL way of qualifying stuff. You want backticks for MySQL.
SELECT * FROM `test01`
I am trying to query a sql lite database with only an offset and no limit.
SELECT [Id], [Name], [IntValue], [IntNulableValue] FROM [Product] OFFSET 10
I can do an offset query when I have a limit however (LIMIT 10 OFFSET 10).
Here is the error sql lite is giving me.
SQLite error near "10": syntax error
Just set LIMIT to -1.
For example:
SELECT * FROM table LIMIT -1 OFFSET 10
On the SQL as understood by SQLite page, you'll notice that OFFSET isn't understood without LIMIT.
http://sqlite.org/lang_select.html
According to the same documentation:
If the LIMIT expression evaluates to a negative value, then there is no upper bound on the number of rows returned.