Comments (5)
Hey @mansj happy to hear you're finding this useful!
The problem seems very weird! Can you try running the following query with the parameters you pass to docsql:
SELECT table_name FROM information_schema.tables where table_schema='%s' AND table_name LIKE \"%s_%%_archive\" ORDER BY table_name DESC LIMIT 10000 OFFSET %d"
(you'll need db
, table
, keep
)
I suspect no tables are found here, thus they don't get deleted.
from docsql.
Thank you. I see a problem with the SQL you sent. There's a double '%' in the middle, right?
table_name LIKE \"%s_%%_archive\"
should probably be table_name LIKE \"%s_%_archive\"
If I change that on my end when running the query manually (also omitting the OFFSET and the table_schema, which I don't know what needs to be filled in) the result works.
from docsql.
The double %
will be converted to a single %
when Go formats our query, so that shouldn't be a problem (playground).
Schema is the name of your database, offset is the number of tables you want to preserve.
from docsql.
I see. In that case, the line seems to work as it is, because it returns all the archive tables, at the moment 117 of them in my database.
Here's the full line I'm running now:
SELECT table_name FROM information_schema.tables where table_schema='dm_stripped' AND table_name LIKE "dm_songs_%_archive" ORDER BY table_name DESC LIMIT 10000 OFFSET 10;
from docsql.
I also attempted to manually issue a "DROP TABLE" command as the user in question, and managed to drop an archive table no problem.
from docsql.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docsql.