Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RedshiftAdapter #496

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gronpipmaster
Copy link

Add support aws redshift

@jpfuentes2
Copy link
Owner

Is it possible to add tests for this?

@koenpunt
Copy link
Collaborator

If you make the RedshiftAdapter extend from PgsqlAdapter you only have to update the methods that differ from the original adapter. And you don't have to make changes to Table.php.

Also, your classfile uses spaces for indentation, where all other are using tabs.

@gronpipmaster
Copy link
Author

@koenpunt Yes, I wanted to do in the beginning, but https://github.com/jpfuentes2/php-activerecord/blob/master/lib/Connection.php#L132-L140 you do not use Connection of adapters through the namespace and I get the error 'PHP Fatal error: Class 'ActiveRecord\PgsqlAdapter' not found in' if remodel Connection of, reverse compatibility, and will need quite a lot to refactor. If it makes sense to do.

@jpfuentes2 Aws Redshift is an internal service of the Amazon, and without an account can not get there. If you can run tests on the old version Postrges sql <= 8.0.2, I do.

@koenpunt
Copy link
Collaborator

If you require the PgsqlAdapter in RedshiftAdapter.php, that should fix PHP Fatal error: Class 'ActiveRecord\PgsqlAdapter' not found in

require_once __DIR__ . '/PgsqlAdapter.php';

@@ -395,7 +395,7 @@ private function get_meta_data()
{
// as more adapters are added probably want to do this a better way
// than using instanceof but gud enuff for now
$quote_name = !($this->conn instanceof PgsqlAdapter);
$quote_name = !($this->conn instanceof PgsqlAdapter || $this->conn instanceof RedshiftAdapter);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that RedshiftAdapter extends PgsqlAdapter, $this->conn instanceof PgsqlAdapter would be sufficient here

…Adapter) -> !(->conn instanceof PgsqlAdapter)
@gronpipmaster
Copy link
Author

Accept?

@koenpunt
Copy link
Collaborator

To get this running on aws, I'll have to setup an ec2 and redshift instance? Or can it run standalone as well?

@gronpipmaster
Copy link
Author

Only redshift instance, and I am currently using this adapter. Сonnection redshift://user:pass@host:port/base as to any of your adapter.

@koenpunt
Copy link
Collaborator

We should add instructions on how to test this on a live instance, otherwise if any of the code gets updated later, there is no way to verify that your adapter still works. But before that I think we should refactor the test setup (#475, #485)

@jpfuentes2
Copy link
Owner

Why not add the instructions now and merge then refactor the test setup afterwards? Couldn't we ignore the adapter by default unless given a specific command?

@koenpunt
Copy link
Collaborator

The adapter is ignored by default (afaik), because it's not included in the test/helpers/config.php

@jpfuentes2
Copy link
Owner

Ah, then should we still block this if @gronpipmaster adds some instructions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants