Git Product home page Git Product logo

Comments (6)

C-Duv avatar C-Duv commented on July 19, 2024

I would find it useful too.
I'm guessing that creating a Ruckusing_Adapter_Flatfile_Base that extends Ruckusing_Adapter_Interface and writes to a file would do the trick?

This would make ruckusing usable without requiring a live database connection.

from ruckusing-migrations.

ruckus avatar ruckus commented on July 19, 2024

Most of the plumbing is in place. When $conf['log_dir'] is specified than a $ENV.log file is generated which contains all SQL statements sent to the server.

However, this file is formatted with timestamps and contains all queries that also retrieve table information.

You want a log which ONLY contains DML statements (CREATE / DELETE / INSERT / UPDATE, etc) and have those sent to a file w/o any additional formatting, timestamps, etc.

So really the process would involve this:

  1. Create a new config option for "dml_statement_query_log" or something
  2. When running all SQL detect if its a DML statement: send to the dml_statement_query_log

All Adapters currently implement determine_query_type() (which should be added to the Base Adapter) which can be leveraged in #2 to determine if the query should be logged.

If you want to take a stab at this in a PR I would be very thankful.

On Aug 6, 2014, at 1:52 AM, C-Duv [email protected] wrote:

I would find it useful too.
I'm guessing that creating a Ruckusing_Adapter_Flatfile_Base that extends Ruckusing_Adapter_Interface and writes to a file would do the trick?


Reply to this email directly or view it on GitHub.

from ruckusing-migrations.

C-Duv avatar C-Duv commented on July 19, 2024

When $conf['log_dir'] is specified than a $ENV.log file is generated which contains all SQL statements sent to the server.

So SQL statements goes to both server and log file?

from ruckusing-migrations.

ruckus avatar ruckus commented on July 19, 2024

As of now, yes, all SQL is logged to the log file.

But since it has other meta-data, such as timestamps and it contains all SELECT operations (e.g. fetching table info, etc) then its not exactly what you need.

On Aug 6, 2014, at 3:15 PM, C-Duv [email protected] wrote:

When $conf['log_dir'] is specified than a $ENV.log file is generated which contains all SQL statements sent to the server.

So SQL statements goes to both server and log file?


Reply to this email directly or view it on GitHub.

from ruckusing-migrations.

C-Duv avatar C-Duv commented on July 19, 2024

What I meant was: At current state, if I want to get all queries into a single "flat" file I can set $conf['log_dir'] but:

  • File will contains DML and non-DML SQL statements
  • SQL statements would still be sent to server: thus a live connection to the SQL server is required

You are suggesting to:

  • add an option that define a file location where to write DML statements
  • declare determine_query_type() into Ruckusing_Adapter_Base (already present in implemented Ruckusing_Adapter_*_Base)
  • Modify Ruckusing_Adapter_*_Base::query() so that it writes DML to that DML-only file.

I was more like: create a new Ruckusing_Adapter_Base (say Ruckusing_Adapter_Flatfile_Base) whose dsn is an array containing the file location.

But for the solution to be "offline" (no live connection to SQL server) we need a way to tell ruckusing the schema version starting point (since it cannot ask the server for that) when asking for SQL change statements (and default to version "0") right?

I'm just discovering ruckusing but once I've played with it a bit I can file a PR to answer this issue.

from ruckusing-migrations.

ruckus avatar ruckus commented on July 19, 2024

Yes, you got it.

I think trying to jigger it all around to work against a non-live server will be way too complex and outside the scope. Basically the whole framework queries the server to get all sorts of meta info about the tables / columns / indexes, etc.

So I stand by my original suggestion - which you have encapsulated below.

Thanks in advance for your contributions!

On Aug 6, 2014, at 4:00 PM, C-Duv [email protected] wrote:

What I meant was: At current state, if I want to get all queries into a single "flat" file I can set $conf['log_dir'] but:

File will contains DML and non-DML SQL statements
SQL statements would still be sent to server: thus a live connection to the SQL server is required
You are suggesting to:

add an option that define a file location where to write DML statements
declare determine_query_type() into Ruckusing_Adapter_Base (already present in implemented Ruckusing_Adapter___Base)
Modify Ruckusing_Adapter___Base::query() so that it writes DML to that DML-only file.
I was more like: create a new Ruckusing_Adapter_Base (say Ruckusing_Adapter_Flatfile_Base) whose dsn is an array containing the file location.

But for the solution to be "offline" (no live connection to SQL server) we need a way to tell ruckusing the schema version starting point (since it cannot ask the server for that) when asking for SQL change statements (and default to version "0") right?

I'm just discovering ruckusing but once I've played with it a bit I can file a PR to answer this issue.


Reply to this email directly or view it on GitHub.

from ruckusing-migrations.

Related Issues (20)

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.