[Vertica][VJDBC](3457) ERROR: Function ParquetExportFinalize(int) does not exist, or permission is denied for ParquetExportFinalize(int) - vertica

I got the following error when trying to export to parquet in vertica
[Vertica]VJDBC ERROR: Function ParquetExportFinalize(int) does not exist, or permission is denied for ParquetExportFinalize(int)

GRANT ALL ON LIBRARY public.ParquetExportLib to user;
GRANT ALL ON TRANSFORM FUNCTION public.ParquetExport(int) TO user;
GRANT ALL ON TRANSFORM FUNCTION public.ParquetExportMulti(int) TO user;
GRANT ALL ON TRANSFORM FUNCTION public.ParquetExportFinalize(int) TO user;

Related

Checking Authority without a Model Instance throws error

I have a policy defined in AuthServiceProvider and in blade file, I access it using #can and it throws following error.
Undefined property: Illuminate\Auth\Access\Gate::$check
Unfortunately, googling this sentence doesn't report anything so looks like it's just me facing this issue.
I'm on Laravel 5.4.
Policy Check in Blade File
#can("use-some-module", null)
You have access
#elsecan
You DO NOT have access
#endcan
Policy Defined in AuthServiceProvider
Gate::define('use-some-module', function ($loggedInUser) {
return <can access or not>
});

Laravel File put permission denied on Windows

I'm trying to save a file in windows and find a problem with File Class,
When I upload a file i get this error:
ErrorException in Filesystem.php line 111:
file_put_contents(./upload/Bambui/2016): failed to open stream:
Permission denied
and this is my function to save the file:
public function save()
{
$input = Input::only('empresa','tipo','data','data_pub','deliberacao','status','num_registro','publicacao','arquivo');
$diretorio = $this->atas->checkAndCreateDirectory($input['empresa'], substr($input['data'], 6, 4));
File::put($diretorio, $input['arquivo']);
}
I give permission to all users in my wamp folder to write and read also.
Thx for help, I found myself the answer and change the File class to Storage and did this
Storage::putFileAs('pdf/'.substr($input['data'], 6, 4), $input['arquivo'], $filename);
and works

Auth::user() with a relationship?

I have a regular users table, but I also have a user_settings table with the following relationship in my UserSettings.php file:
public function user()
{
return $this->belongsTo('App\Models\User');
}
And a settings method within my User.php file:
public function settings()
{
return $this->hasOne('App\Models\UserSettings');
}
I want to be able to access the user and their settings by doing Auth::user(), but doing Auth::user()->settings->column_name gives me an error:
Trying to get property of non-object
How can I get the user's settings using Auth::user()?
You can access it like so:
var_dump(Auth::user()->settings);
You cannot access it like so Auth::user()->settings->column_name because you have to foreach it.
foreach(Auth::user()->settings as $setting) {
var_dump($setting->column_name);
}
You must set up a settings method within User model:
public function settings()
{
return $this->hasOne('App\Models\Settings');
}
You must be getting
Trying to get property of non-object
error as there may be no entry in user_settings table for the particular user.
Your relationships look correct.
Just go to tinker and find the user for whom you are getting the error. Then try accessing the settings for that user.

How to get a file from the Amazon S3?

I'm trying to write and download the file to Amazon S3. The file is loaded but I can not get it back:
public function putFile()
{
$s3 = Storage::disk('s3');
$url = 'https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-xpa1/v/t1.0-9/p720x720/12631558_953568381347717_3978737099026165391_n.jpg?oh=9e14f5ea6f8e3a3fc8ffa07095d4c766&oe=57321C9D&__gda__=1463610491_c1f275837b7f5b4d2041597a3d7bb9c8';
$file = file_get_contents($url);
$s3->put('upload/test/file.jpg', $file);
}
public function getFile()
{
$contents = $s3->get('upload/test/file.jpg');
dd($contents);
}
if I call getFile() function, I got this error:
FileNotFoundException in FilesystemAdapter.php line 58:
upload/test/file.jpg
my Bucket permission:
Grantee: mgalex (List, Update/Delete, View Permissions, Edit Permissions)
Grantee: Any Authentificated AWS User (List, Update/Delete, View Permissions)
file is created with permissions:
Grantee: mgalex (Open/Download, View Permissions, Edit Permissions)
Problem with file permissions. If I set up manually permission to file "Any Authentificated AWS User", the code works. Tell me, what should I do, not to create manually permission for each file?
My settings in filesystem.php is correct. What can be wrong?
Please, help.

Parse.com update Role error

I'm getting {"code":101,"error":"object not found for update"} when calling save on my role after adding a user to it, all on Cloud Code.
Sample code:
var role_query = new Parse.Query('_Role')
role_query.equalTo('name', 'USER')
role_query.first().then(function(role) {
role.getUsers().add(user)
role.save()
})
The error was that I didn't have permission to update the role.
Solution was using Parse.Cloud.useMasterKey() at the beginning of the Cloud Code function.
In case you need to update roles on the client:
https://www.parse.com/questions/role-cant-assign-user-in-js

Resources