GithubHelp home page GithubHelp logo

Archive tables never purged about docsql HOT 5 OPEN

mansj avatar mansj commented on June 6, 2024
Archive tables never purged

from docsql.

Comments (5)

odino avatar odino commented on June 6, 2024

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.

mansj avatar mansj commented on June 6, 2024

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.

odino avatar odino commented on June 6, 2024

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.

mansj avatar mansj commented on June 6, 2024

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.

mansj avatar mansj commented on June 6, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.